Add matplotlib energy landscape plot helper with selectable layouts Unit test included. - #415
Conversation
…Unit test included.
Add a test for molecules and surfaces SO215, SO103
…s included SO215, SO103
SO215, SO103
|
|
||
|
|
||
| @requires_optional_package("matplotlib") | ||
| def plot_energy_landscape( |
There was a problem hiding this comment.
Re-export in top-level plams?
https://github.com/SCM-NV/PLAMS/blob/trunk/src/scm/plams/__init__.py#L151
There was a problem hiding this comment.
Well, every plot_* function in src/scm/plams/tools/plot.py has the same decorator, 10 in total. I thought it was on purpose.
$ grep -H -A1 'requires_optional_package("matplotlib")' src/scm/plams/tools/plot.py
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_band_structure(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_phonons_band_structure(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_phonons_dos(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_phonons_thermodynamic_properties(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-@requires_optional_package("ase")
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_image_grid(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_correlation(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_msd(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_work_function(
--
src/scm/plams/tools/plot.py:@requires_optional_package("matplotlib")
src/scm/plams/tools/plot.py-def plot_energy_landscape(
There was a problem hiding this comment.
I meant add to the top level init.py (see link above) so it can be imported directly from plams
| connector_color: str = "black", | ||
| connector_linestyle: Any = (0, (4, 4)), | ||
| label_states: bool = True, | ||
| layout: str = "auto", |
There was a problem hiding this comment.
Can we help out the user here: Literal["auto", "dfs", "bfs", "longest_path", "force", "crossings"]?
There was a problem hiding this comment.
I added this in the function's documentation:
- Use
"auto"to compare the available strategies and pick the one with the cleanest connector pattern. - Use
"dfs"to follow one branch deeply before backtracking, which can resemble a reaction-path view. - Use
"bfs"to expand level by level from one endpoint, keeping nearby states grouped together. - Use
"longest_path"to place the main backbone of the network first and then attach side branches around it. - Use
"force"to apply a simple force-based relaxation that spreads states while reducing visual crowding. - Use
"crossings"to minimize connector crossings directly, which can help for dense networks.
There was a problem hiding this comment.
I would use the Literal type hint as these are the only options, so users with IDEs will get highlighting for an incorrect option
…landscape examples and tests SO215, SO103
… landscape function SO215
Thanks! |
SO105
Now we can do these things :)
Also, including the molecules:
For surfaces, it also works!