Skip to content

Commit

Permalink
Restructure helpers directory (#341)
Browse files Browse the repository at this point in the history
* Restructure helpers directory

---------

Co-authored-by: Harvey Devereux <[email protected]>
Co-authored-by: Jacob Wilkins <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent 8d53a1f commit 15a6b49
Show file tree
Hide file tree
Showing 20 changed files with 509 additions and 472 deletions.
165 changes: 93 additions & 72 deletions docs/source/apidoc/janus_core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,72 @@ Module contents
Submodules
----------

janus\_core.cli.janus module
----------------------------
janus\_core.calculations.base module
------------------------------------

.. automodule:: janus_core.cli.janus
.. automodule:: janus_core.calculations.base
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.singlepoint module
----------------------------------
janus\_core.calculations.descriptors module
-------------------------------------------

.. automodule:: janus_core.cli.singlepoint
.. automodule:: janus_core.calculations.descriptors
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.geomopt module
------------------------------
janus\_core.calculations.eos module
-----------------------------------

.. automodule:: janus_core.cli.geomopt
.. automodule:: janus_core.calculations.eos
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.md module
-------------------------
janus\_core.calculations.geom\_opt module
-----------------------------------------

.. automodule:: janus_core.cli.md
.. automodule:: janus_core.calculations.geom_opt
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.train module
----------------------------
janus\_core.calculations.md module
----------------------------------

.. automodule:: janus_core.cli.train
.. automodule:: janus_core.calculations.md
:members:
:special-members:
:private-members:
:inherited-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.phonons module
------------------------------
janus\_core.calculations.phonons module
---------------------------------------

.. automodule:: janus_core.cli.phonons
.. automodule:: janus_core.calculations.phonons
:members:
:special-members:
:private-members:
:inherited-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.eos module
--------------------------
janus\_core.calculations.single\_point module
---------------------------------------------

.. automodule:: janus_core.cli.eos
.. automodule:: janus_core.calculations.single_point
:members:
:special-members:
:private-members:
Expand All @@ -94,107 +96,106 @@ janus\_core.cli.descriptors module
:undoc-members:
:show-inheritance:

janus\_core.cli.types module
----------------------------
janus\_core.cli.eos module
--------------------------

.. automodule:: janus_core.cli.types
.. automodule:: janus_core.cli.eos
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.cli.utils module
----------------------------
janus\_core.cli.geomopt module
------------------------------

.. automodule:: janus_core.cli.utils
.. automodule:: janus_core.cli.geomopt
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.base module
------------------------------------
janus\_core.cli.janus module
----------------------------

.. automodule:: janus_core.calculations.base
.. automodule:: janus_core.cli.janus
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.single\_point module
---------------------------------------------
janus\_core.cli.md module
-------------------------

.. automodule:: janus_core.calculations.single_point
.. automodule:: janus_core.cli.md
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.geom\_opt module
-----------------------------------------
janus\_core.cli.phonons module
------------------------------

.. automodule:: janus_core.calculations.geom_opt
.. automodule:: janus_core.cli.phonons
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.md module
janus\_core.cli.singlepoint module
----------------------------------

.. automodule:: janus_core.calculations.md
.. automodule:: janus_core.cli.singlepoint
:members:
:special-members:
:private-members:
:inherited-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.phonons module
---------------------------------------
janus\_core.cli.train module
----------------------------

.. automodule:: janus_core.calculations.phonons
.. automodule:: janus_core.cli.train
:members:
:special-members:
:private-members:
:inherited-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.eos module
-----------------------------------
janus\_core.cli.types module
----------------------------

.. automodule:: janus_core.calculations.eos
.. automodule:: janus_core.cli.types
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.calculations.descriptors module
-------------------------------------------
janus\_core.cli.utils module
----------------------------

.. automodule:: janus_core.calculations.descriptors
.. automodule:: janus_core.cli.utils
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.helpers.mlip\_calculators module
--------------------------------------------
janus\_core.helpers.janus\_types module
---------------------------------------

.. automodule:: janus_core.helpers.mlip_calculators
.. automodule:: janus_core.helpers.janus_types
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:
:exclude-members: clear,copy,setdefault,items,keys,get,pop,popitem,fromkeys,update,values
:special-members:

janus\_core.helpers.log module
------------------------------
Expand All @@ -206,16 +207,15 @@ janus\_core.helpers.log module
:undoc-members:
:show-inheritance:

janus\_core.helpers.janus\_types module
---------------------------------------
janus\_core.helpers.mlip\_calculators module
--------------------------------------------

.. automodule:: janus_core.helpers.janus_types
.. automodule:: janus_core.helpers.mlip_calculators
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:
:exclude-members: clear,copy,setdefault,items,keys,get,pop,popitem,fromkeys,update,values
:special-members:

janus\_core.helpers.utils module
--------------------------------
Expand All @@ -227,51 +227,72 @@ janus\_core.helpers.utils module
:undoc-members:
:show-inheritance:

janus\_core.helpers.train module
--------------------------------
janus\_core.helpers.stats
-------------------------

.. automodule:: janus_core.helpers.train
.. automodule:: janus_core.helpers.stats
:members:
:special-members:
:private-members:
:inherited-members:
:undoc-members:
:show-inheritance:

janus\_core.helpers.stats
-------------------------
janus\_core.helpers.struct\_io
------------------------------

.. automodule:: janus_core.helpers.stats
.. automodule:: janus_core.helpers.struct_io
:members:
:special-members:
:private-members:
:inherited-members:
:undoc-members:
:show-inheritance:

janus\_core.helpers.post_process module
---------------------------------------
janus\_core.processing.correlator module
----------------------------------------

.. automodule:: janus_core.helpers.post_process
.. automodule:: janus_core.processing.correlator
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.helpers.correlator module
-------------------------------------
janus\_core.processing.observables module
-----------------------------------------

.. automodule:: janus_core.helpers.correlator
.. automodule:: janus_core.processing.observables
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.helpers.observables module
janus\_core.processing.post\_process module
-------------------------------------------

.. automodule:: janus_core.processing.post_process
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.processing.symmetry module
--------------------------------------

.. automodule:: janus_core.helpers.observables
.. automodule:: janus_core.processing.symmetry
:members:
:special-members:
:private-members:
:undoc-members:
:show-inheritance:

janus\_core.training.train module
---------------------------------

.. automodule:: janus_core.training.train
:members:
:special-members:
:private-members:
Expand Down
6 changes: 3 additions & 3 deletions docs/source/developer_guide/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ Alternatively, using ``tox``::
Adding a new Observable
=======================

Additional built-in observable quantities may be added for use by the ``janus_core.helpers.correlator.Correlation`` class. These should conform to the ``__call__`` signature of ``janus_core.helpers.janus_types.Observable``. For a user this can be accomplished by writing a function, or class also implementing a commensurate ``__call__``.
Additional built-in observable quantities may be added for use by the ``janus_core.processing.correlator.Correlation`` class. These should conform to the ``__call__`` signature of ``janus_core.helpers.janus_types.Observable``. For a user this can be accomplished by writing a function, or class also implementing a commensurate ``__call__``.

Built-in observables are collected within the ``janus_core.helpers.observables`` module. For example the ``janus_core.helpers.observables.Stress`` observable allows a user to quickly setup a given correlation of stress tensor components (with and without the ideal gas contribution). An observable for the ``xy`` component is obtained without the ideal gas contribution as:
Built-in observables are collected within the ``janus_core.processing.observables`` module. For example the ``janus_core.processing.observables.Stress`` observable allows a user to quickly setup a given correlation of stress tensor components (with and without the ideal gas contribution). An observable for the ``xy`` component is obtained without the ideal gas contribution as:

.. code-block:: python
Expand All @@ -203,4 +203,4 @@ A new built-in observables can be implemented by a class with the method:
The ``__call__`` should contain all the logic for obtaining some ``float`` value from an ``Atoms`` object, alongside optional positional arguments and kwargs. The args and kwargs are set by a user when specifying correlations for a ``janus_core.calculations.md.MolecularDynamics`` run. See also ``janus_core.helpers.janus_types.CorrelationKwargs``. These are set at the instantiation of the ``janus_core.calculations.md.MolecularDynamics`` object and are not modified. These could be used e.g. to specify an observable calculated only from one atom's data.
``janus_core.helpers.observables.Stress`` includes a constructor to take a symbolic component, e.g. ``"xx"`` or ``"yz"``, and determine the index required from ``ase.Atoms.get_stress`` on instantiation for ease of use.
``janus_core.processing.observables.Stress`` includes a constructor to take a symbolic component, e.g. ``"xx"`` or ``"yz"``, and determine the index required from ``ase.Atoms.get_stress`` on instantiation for ease of use.
3 changes: 2 additions & 1 deletion janus_core/calculations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
PathLike,
)
from janus_core.helpers.log import config_logger, config_tracker
from janus_core.helpers.utils import FileNameMixin, input_structs, none_to_dict
from janus_core.helpers.struct_io import input_structs
from janus_core.helpers.utils import FileNameMixin, none_to_dict


class BaseCalculation(FileNameMixin):
Expand Down
4 changes: 3 additions & 1 deletion janus_core/calculations/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
MaybeSequence,
PathLike,
)
from janus_core.helpers.utils import check_calculator, none_to_dict, output_structs
from janus_core.helpers.mlip_calculators import check_calculator
from janus_core.helpers.struct_io import output_structs
from janus_core.helpers.utils import none_to_dict


class Descriptors(BaseCalculation):
Expand Down
3 changes: 2 additions & 1 deletion janus_core/calculations/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
OutputKwargs,
PathLike,
)
from janus_core.helpers.utils import none_to_dict, output_structs
from janus_core.helpers.struct_io import output_structs
from janus_core.helpers.utils import none_to_dict


class EoS(BaseCalculation):
Expand Down
Loading

0 comments on commit 15a6b49

Please sign in to comment.