From b70743dd06794fb920c71b012ff509f016dbd2ad Mon Sep 17 00:00:00 2001 From: andrewtarzia Date: Thu, 10 Oct 2024 10:03:22 +0200 Subject: [PATCH] Update docs. --- docs/source/_autosummary/cgexplore.rst | 1 + .../cgexplore.topologies.CGM12L24.rst | 26 ++++++++++++++ .../cgexplore.topologies.CGM4L8.rst | 25 +++++++++++++ .../cgexplore.topologies.M4L82.rst | 34 ++++++++++++++++++ .../_autosummary/cgexplore.topologies.rst | 35 +++++++++++++++++++ .../cgexplore.utilities.AtomliteDatabase.rst | 1 + .../cgexplore.utilities.extract_property.rst | 6 ++++ .../_autosummary/cgexplore.utilities.rst | 2 ++ ...xplore.utilities.write_chemiscope_json.rst | 6 ++++ docs/source/databasing.rst | 21 +++++++++-- docs/source/index.rst | 6 ++-- src/cgexplore/_internal/scripts/get_values.py | 3 +- .../_internal/utilities/utilities.py | 11 +++--- 13 files changed, 167 insertions(+), 10 deletions(-) create mode 100644 docs/source/_autosummary/cgexplore.topologies.CGM12L24.rst create mode 100644 docs/source/_autosummary/cgexplore.topologies.CGM4L8.rst create mode 100644 docs/source/_autosummary/cgexplore.topologies.M4L82.rst create mode 100644 docs/source/_autosummary/cgexplore.topologies.rst create mode 100644 docs/source/_autosummary/cgexplore.utilities.extract_property.rst create mode 100644 docs/source/_autosummary/cgexplore.utilities.write_chemiscope_json.rst diff --git a/docs/source/_autosummary/cgexplore.rst b/docs/source/_autosummary/cgexplore.rst index cdaf00b1..c66d97d8 100644 --- a/docs/source/_autosummary/cgexplore.rst +++ b/docs/source/_autosummary/cgexplore.rst @@ -35,5 +35,6 @@ optimisation systems_optimisation terms + topologies utilities diff --git a/docs/source/_autosummary/cgexplore.topologies.CGM12L24.rst b/docs/source/_autosummary/cgexplore.topologies.CGM12L24.rst new file mode 100644 index 00000000..e96ecf4e --- /dev/null +++ b/docs/source/_autosummary/cgexplore.topologies.CGM12L24.rst @@ -0,0 +1,26 @@ +cgexplore.topologies.CGM12L24 +============================= + +.. currentmodule:: cgexplore.topologies + +.. autoclass:: CGM12L24 + :members: + :inherited-members: + :undoc-members: + :show-inheritance: + + + + + .. rubric:: Methods + + .. autosummary:: + :nosignatures: + + ~CGM12L24.get_vertex_alignments + + + + + + \ No newline at end of file diff --git a/docs/source/_autosummary/cgexplore.topologies.CGM4L8.rst b/docs/source/_autosummary/cgexplore.topologies.CGM4L8.rst new file mode 100644 index 00000000..ec23d039 --- /dev/null +++ b/docs/source/_autosummary/cgexplore.topologies.CGM4L8.rst @@ -0,0 +1,25 @@ +cgexplore.topologies.CGM4L8 +=========================== + +.. currentmodule:: cgexplore.topologies + +.. autoclass:: CGM4L8 + :members: + :inherited-members: + :undoc-members: + :show-inheritance: + + + + + .. rubric:: Methods + + .. autosummary:: + :nosignatures: + + + + + + + \ No newline at end of file diff --git a/docs/source/_autosummary/cgexplore.topologies.M4L82.rst b/docs/source/_autosummary/cgexplore.topologies.M4L82.rst new file mode 100644 index 00000000..8fe48f8b --- /dev/null +++ b/docs/source/_autosummary/cgexplore.topologies.M4L82.rst @@ -0,0 +1,34 @@ +cgexplore.topologies.M4L82 +========================== + +.. currentmodule:: cgexplore.topologies + +.. autoclass:: M4L82 + :members: + :inherited-members: + :undoc-members: + :show-inheritance: + + + + + .. rubric:: Methods + + .. autosummary:: + :nosignatures: + + + + + + + .. rubric:: Attributes + + .. autosummary:: + + ~M4L82.paired_wall_1_coord + ~M4L82.paired_wall_2_coord + ~M4L82.wall_1_shift + ~M4L82.wall_2_shift + + \ No newline at end of file diff --git a/docs/source/_autosummary/cgexplore.topologies.rst b/docs/source/_autosummary/cgexplore.topologies.rst new file mode 100644 index 00000000..77d282e5 --- /dev/null +++ b/docs/source/_autosummary/cgexplore.topologies.rst @@ -0,0 +1,35 @@ +cgexplore.topologies +==================== + +.. automodule:: cgexplore.topologies + + + + + + + + .. rubric:: Classes + + .. autosummary:: + :toctree: + :template: class.rst + :nosignatures: + + CGM12L24 + CGM4L8 + M4L82 + + + + + + + + + + + + + + diff --git a/docs/source/_autosummary/cgexplore.utilities.AtomliteDatabase.rst b/docs/source/_autosummary/cgexplore.utilities.AtomliteDatabase.rst index 97062a47..915c0978 100644 --- a/docs/source/_autosummary/cgexplore.utilities.AtomliteDatabase.rst +++ b/docs/source/_autosummary/cgexplore.utilities.AtomliteDatabase.rst @@ -20,6 +20,7 @@ cgexplore.utilities.AtomliteDatabase ~AtomliteDatabase.add_entries ~AtomliteDatabase.add_molecule ~AtomliteDatabase.add_properties + ~AtomliteDatabase.get_database ~AtomliteDatabase.get_entries ~AtomliteDatabase.get_entry ~AtomliteDatabase.get_molecule diff --git a/docs/source/_autosummary/cgexplore.utilities.extract_property.rst b/docs/source/_autosummary/cgexplore.utilities.extract_property.rst new file mode 100644 index 00000000..89fe6314 --- /dev/null +++ b/docs/source/_autosummary/cgexplore.utilities.extract_property.rst @@ -0,0 +1,6 @@ +cgexplore.utilities.extract\_property +===================================== + +.. currentmodule:: cgexplore.utilities + +.. autofunction:: extract_property \ No newline at end of file diff --git a/docs/source/_autosummary/cgexplore.utilities.rst b/docs/source/_autosummary/cgexplore.utilities.rst index 0305f19b..de5ff430 100644 --- a/docs/source/_autosummary/cgexplore.utilities.rst +++ b/docs/source/_autosummary/cgexplore.utilities.rst @@ -35,6 +35,7 @@ cgexplore.utilities check_directory convert_pyramid_angle draw_pie + extract_property get_supramolecule get_unforced_supramolecule optimise_ligand @@ -43,6 +44,7 @@ cgexplore.utilities run_soft_md_cycle shift_beads soften_forcefield + write_chemiscope_json yield_near_models yield_shifted_models diff --git a/docs/source/_autosummary/cgexplore.utilities.write_chemiscope_json.rst b/docs/source/_autosummary/cgexplore.utilities.write_chemiscope_json.rst new file mode 100644 index 00000000..562863bf --- /dev/null +++ b/docs/source/_autosummary/cgexplore.utilities.write_chemiscope_json.rst @@ -0,0 +1,6 @@ +cgexplore.utilities.write\_chemiscope\_json +=========================================== + +.. currentmodule:: cgexplore.utilities + +.. autofunction:: write_chemiscope_json \ No newline at end of file diff --git a/docs/source/databasing.rst b/docs/source/databasing.rst index 310ef875..f2a71b17 100644 --- a/docs/source/databasing.rst +++ b/docs/source/databasing.rst @@ -1,5 +1,8 @@ -Databasing -========== +Sharing with collaborators +========================== + +Databasing with atomlite +------------------------ .. seealso:: @@ -9,3 +12,17 @@ Databasing :maxdepth: 1 AtomliteDatabase <_autosummary/cgexplore.utilities.AtomliteDatabase> + + +Mapping with chemiscope +----------------------- + +.. seealso:: + + chemiscope: https://chemiscope.org/ + +.. toctree:: + :maxdepth: 1 + + write_chemiscope_json <_autosummary/cgexplore.utilities.write_chemiscope_json> + extract_property <_autosummary/cgexplore.utilities.extract_property> diff --git a/docs/source/index.rst b/docs/source/index.rst index 71161c58..0961cdda 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,16 +4,16 @@ :maxdepth: 2 Analysis - Databasing + Sharing with collaborators Forcefields Molecular Optimisation - Systems Optimisation + Systems optimisation Terms Utilities Executables Topologies - First Paper Example + First paper example .. toctree:: :hidden: diff --git a/src/cgexplore/_internal/scripts/get_values.py b/src/cgexplore/_internal/scripts/get_values.py index cfcef5fb..8b2d99e1 100644 --- a/src/cgexplore/_internal/scripts/get_values.py +++ b/src/cgexplore/_internal/scripts/get_values.py @@ -65,7 +65,8 @@ def main() -> None: entry = database.get_entry(key=args.name) try: value = extract_property( - path=args.path, properties=entry.properties + path=args.path, + properties=entry.properties, ) except KeyError as ex: diff --git a/src/cgexplore/_internal/utilities/utilities.py b/src/cgexplore/_internal/utilities/utilities.py index 945de6bf..0096f459 100644 --- a/src/cgexplore/_internal/utilities/utilities.py +++ b/src/cgexplore/_internal/utilities/utilities.py @@ -90,16 +90,19 @@ def draw_pie( ax.scatter(xpos, ypos, **marker) -def extract_property(path: list[str], properties: dict) -> atomlite.Json: +def extract_property( + path: list[str], + properties: dict[str, atomlite.Json], +) -> atomlite.Json: """Extract property from nested dict.""" if len(path) == 1: value = properties[path[0]] elif len(path) == 2: # noqa: PLR2004 - value = properties[path[0]][path[1]] + value = properties[path[0]][path[1]] # type: ignore[index,call-overload] elif len(path) == 3: # noqa: PLR2004 - value = properties[path[0]][path[1]][path[2]] + value = properties[path[0]][path[1]][path[2]] # type: ignore[index,call-overload] elif len(path) == 4: # noqa: PLR2004 - value = properties[path[0]][path[1]][path[2]][path[3]] + value = properties[path[0]][path[1]][path[2]][path[3]] # type: ignore[index,call-overload] else: msg = f"{path} is too deep ({len(path)})." raise RuntimeError(msg)