Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtarzia committed Oct 10, 2024
1 parent 49c6a30 commit b70743d
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/source/_autosummary/cgexplore.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
optimisation
systems_optimisation
terms
topologies
utilities

26 changes: 26 additions & 0 deletions docs/source/_autosummary/cgexplore.topologies.CGM12L24.rst
Original file line number Diff line number Diff line change
@@ -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






25 changes: 25 additions & 0 deletions docs/source/_autosummary/cgexplore.topologies.CGM4L8.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cgexplore.topologies.CGM4L8
===========================

.. currentmodule:: cgexplore.topologies

.. autoclass:: CGM4L8
:members:
:inherited-members:
:undoc-members:
:show-inheritance:




.. rubric:: Methods

.. autosummary::
:nosignatures:







34 changes: 34 additions & 0 deletions docs/source/_autosummary/cgexplore.topologies.M4L82.rst
Original file line number Diff line number Diff line change
@@ -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


35 changes: 35 additions & 0 deletions docs/source/_autosummary/cgexplore.topologies.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cgexplore.topologies
====================

.. automodule:: cgexplore.topologies







.. rubric:: Classes

.. autosummary::
:toctree:
:template: class.rst
:nosignatures:

CGM12L24
CGM4L8
M4L82














Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cgexplore.utilities.extract\_property
=====================================

.. currentmodule:: cgexplore.utilities

.. autofunction:: extract_property
2 changes: 2 additions & 0 deletions docs/source/_autosummary/cgexplore.utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cgexplore.utilities
check_directory
convert_pyramid_angle
draw_pie
extract_property
get_supramolecule
get_unforced_supramolecule
optimise_ligand
Expand All @@ -43,6 +44,7 @@ cgexplore.utilities
run_soft_md_cycle
shift_beads
soften_forcefield
write_chemiscope_json
yield_near_models
yield_shifted_models

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cgexplore.utilities.write\_chemiscope\_json
===========================================

.. currentmodule:: cgexplore.utilities

.. autofunction:: write_chemiscope_json
21 changes: 19 additions & 2 deletions docs/source/databasing.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Databasing
==========
Sharing with collaborators
==========================

Databasing with atomlite
------------------------

.. seealso::

Expand All @@ -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>
6 changes: 3 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
:maxdepth: 2

Analysis <analysis>
Databasing <databasing>
Sharing with collaborators <databasing>
Forcefields <forcefields>
Molecular <molecular>
Optimisation <optimisation>
Systems Optimisation <systems_optimisation>
Systems optimisation <systems_optimisation>
Terms <terms>
Utilities <utilities>
Executables <executables>
Topologies <topologies>
First Paper Example <first_paper_example>
First paper example <first_paper_example>

.. toctree::
:hidden:
Expand Down
3 changes: 2 additions & 1 deletion src/cgexplore/_internal/scripts/get_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 7 additions & 4 deletions src/cgexplore/_internal/utilities/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b70743d

Please sign in to comment.