Skip to content

Commit

Permalink
Fix quantity types (#106)
Browse files Browse the repository at this point in the history
* Fix amber

* Fix asap

* Fix bopfox

* Fix dftbplus

* Fix dlpoly

* Fix gromos

* Fix gulp

* Fix h5md

* Fix libatoms

* Fix namd

* Fix tinker

* Fix xtb

* Fix gromacs

* Fix lammps

* More fixes

* Linting fix

* debugging

* resolved indexing issues

* removed prints

* fix for inhomogeneous labels

---------

Co-authored-by: jrudz <rudzinski@mpip-mainz.mpg.de>
Co-authored-by: Joseph Rudzinski <JFRudzinski@users.noreply.github.com>
  • Loading branch information
3 people committed May 16, 2024
1 parent 68f0d2b commit 7e2734d
Show file tree
Hide file tree
Showing 27 changed files with 5,106 additions and 3,568 deletions.
350 changes: 201 additions & 149 deletions atomisticparsers/amber/metainfo/amber.py

Large diffs are not rendered by default.

45 changes: 27 additions & 18 deletions atomisticparsers/asap/metainfo/asap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import numpy as np # pylint: disable=unused-import
import typing # pylint: disable=unused-import
import numpy as np # pylint: disable=unused-import
import typing # pylint: disable=unused-import
from nomad.metainfo import ( # pylint: disable=unused-import
MSection, MCategory, Category, Package, Quantity, Section, SubSection, SectionProxy,
Reference
MSection,
MCategory,
Category,
Package,
Quantity,
Section,
SubSection,
SectionProxy,
Reference,
)
import simulationworkflowschema

Expand All @@ -29,38 +36,40 @@


class MolecularDynamics(simulationworkflowschema.MolecularDynamics):

m_def = Section(validate=False, extends_base_section=True)

x_asap_langevin_friction = Quantity(
type=np.dtype(np.float64),
type=np.float64,
shape=[],
description='''
description="""
Friction coeffient used in Langevin dynamics
''')
""",
)

x_asap_temperature = Quantity(
type=np.dtype(np.float64),
type=np.float64,
shape=[],
description='''
description="""
Temperature used in molecular-dynamics
''')
""",
)

x_asap_timestep = Quantity(
type=np.dtype(np.float64),
type=np.float64,
shape=[],
description='''
description="""
Timestep in molecular dynamics
''')
""",
)


class GeometryOptimization(simulationworkflowschema.GeometryOptimization):

m_def = Section(validate=False, extends_base_section=True)

x_asap_maxstep = Quantity(
type=np.dtype(np.float64),
type=np.float64,
shape=[],
description='''
description="""
Maxstep in Angstrom for geometry optimization
''')
""",
)
7 changes: 6 additions & 1 deletion atomisticparsers/asap/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ def index():
for constraint in traj.constraints:
as_dict = constraint.todict()
indices = as_dict["kwargs"].get("a", as_dict["kwargs"].get("indices"))
indices = (
indices
if isinstance(indices, (np.ndarray, list))
else [int(indices)]
)
constraints.append(
dict(
atom_indices=np.asarray(indices),
atom_indices=[np.asarray(indices)],
kind=get_constraint_name(as_dict),
)
)
Expand Down
131 changes: 76 additions & 55 deletions atomisticparsers/bopfox/metainfo/bopfox.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import numpy as np # pylint: disable=unused-import
import numpy as np # pylint: disable=unused-import

from nomad.metainfo import ( # pylint: disable=unused-import
MSection, MCategory, Category, Package, Quantity, Section, SubSection, SectionProxy,
Reference, JSON
MSection,
MCategory,
Category,
Package,
Quantity,
Section,
SubSection,
SectionProxy,
Reference,
JSON,
)
import runschema.run # pylint: disable=unused-import
import runschema.calculation # pylint: disable=unused-import
Expand All @@ -32,173 +40,186 @@


class Method(runschema.calculation.Method):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_simulation_parameters = Quantity(
type=JSON,
shape=[],
description='''
''')
description="""
""",
)


class Energy(runschema.calculation.Energy):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_bond = SubSection(
sub_section=runschema.calculation.EnergyEntry.m_def,
description='''
description="""
Contains the value and information regarding the bond energy.
''')
""",
)

x_bopfox_prom = SubSection(
sub_section=runschema.calculation.EnergyEntry.m_def,
description='''
description="""
Contains the value and information regarding the promotion energy.
''')
""",
)

x_bopfox_rep1 = SubSection(
sub_section=runschema.calculation.EnergyEntry.m_def,
description='''
description="""
Contains the value and information regarding the first repulsion energy.
''')
""",
)

x_bopfox_rep2 = SubSection(
sub_section=runschema.calculation.EnergyEntry.m_def,
description='''
description="""
Contains the value and information regarding the second repulsion energy.
''')
""",
)

x_bopfox_rep3 = SubSection(
sub_section=runschema.calculation.EnergyEntry.m_def,
description='''
description="""
Contains the value and information regarding the third repulsion energy.
''')
""",
)


class Forces(runschema.calculation.Forces):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_analytic = SubSection(
sub_section=runschema.calculation.ForcesEntry.m_def,
description='''
description="""
Contains the value and information regarding the analytic forces.
''')
""",
)

x_bopfox_rep1 = SubSection(
sub_section=runschema.calculation.ForcesEntry.m_def,
description='''
description="""
Contains the value and information regarding the first analytic forces.
''')
""",
)

x_bopfox_rep2 = SubSection(
sub_section=runschema.calculation.ForcesEntry.m_def,
description='''
description="""
Contains the value and information regarding the second analytic forces.
''')
""",
)

x_bopfox_rep3 = SubSection(
sub_section=runschema.calculation.ForcesEntry.m_def,
description='''
description="""
Contains the value and information regarding the third analytic forces.
''')
""",
)


class x_bopfox_onsite_levels_value(runschema.calculation.AtomicValues):

m_def = Section(validate=False)

value = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
description="""
Value of the onsite level projected on orbital and spin channel.
''')
""",
)


class x_bopfox_onsite_levels(runschema.calculation.Atomic):

m_def = Section(validate=False)

orbital_projected = SubSection(sub_section=x_bopfox_onsite_levels_value.m_def, repeats=True)
orbital_projected = SubSection(
sub_section=x_bopfox_onsite_levels_value.m_def, repeats=True
)


class Calculation(runschema.calculation.Calculation):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_onsite_levels = SubSection(sub_section=x_bopfox_onsite_levels.m_def, repeats=True)
x_bopfox_onsite_levels = SubSection(
sub_section=x_bopfox_onsite_levels.m_def, repeats=True
)


class Interaction(runschema.method.Interaction):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_valence = Quantity(
type=str,
shape=['n_atoms'],
description='''
shape=["n_atoms"],
description="""
Valence of the atoms described by the interaction.
''')
""",
)

x_bopfox_chargetransfer = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
shape=["*"],
description="""
Charge transfer parameters.
''')
""",
)

x_bopfox_cutoff = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
description="""
Cutoff distance for the interaction.
''')
""",
)

x_bopfox_dcutoff = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
description="""
Distance from cutoff where the cutoff function is applied.
''')
""",
)


class Model(runschema.method.Model):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_parameters = Quantity(
type=JSON,
shape=[],
description='''
''')
description="""
""",
)


class xTB(runschema.method.xTB):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_parameters = Quantity(
type=JSON,
shape=[],
description='''
''')
description="""
""",
)


class AtomParameters(runschema.method.AtomParameters):

m_def = Section(validate=False, extends_base_section=True)

x_bopfox_valenceorbitals = Quantity(
type=np.dtype(np.int32),
shape=[],
description='''
''')
description="""
""",
)

x_bopfox_stonerintegral = Quantity(
type=np.dtype(np.float64),
shape=[3],
description='''
''')
description="""
""",
)
6 changes: 3 additions & 3 deletions atomisticparsers/bopfox/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def write_to_archive(self) -> None:
name=key,
functional_form=val[0],
parameters=val[1:],
atom_labels=bond.get("bond"),
atom_labels=[bond.get("bond")],
x_bopfox_valence=bond.get("valence"),
x_bopfox_cutoff=bond.get("rcut"),
x_bopfox_dcutoff=bond.get("dcut"),
Expand All @@ -496,7 +496,7 @@ def write_to_archive(self) -> None:
name=key,
functional_form=val[0],
parameters=val[1:],
atom_labels=bond.get("bond"),
atom_labels=[bond.get("bond")],
x_bopfox_cutoff=bond.get("r2cut"),
x_bopfox_dcutoff=bond.get("d2cut"),
)
Expand All @@ -508,7 +508,7 @@ def write_to_archive(self) -> None:
name=key,
functional_form=val[0],
parameters=val[1:],
atom_labels=bond.get("bond"),
atom_labels=[bond.get("bond")],
x_bopfox_cutoff=bond.get("r2cut"),
x_bopfox_dcutoff=bond.get("d2cut"),
)
Expand Down
Loading

0 comments on commit 7e2734d

Please sign in to comment.