diff --git a/.ci_support/environment-old.yml b/.ci_support/environment-old.yml index 06c549d9..1a65b2a7 100644 --- a/.ci_support/environment-old.yml +++ b/.ci_support/environment-old.yml @@ -22,3 +22,4 @@ dependencies: - pyiron_lammps =0.3.2 - pyiron_vasp =0.2.4 - sphinx_parser =0.0.1 +- semantikon =0.0.16 diff --git a/.ci_support/environment.yml b/.ci_support/environment.yml index 6ccec235..9ae1635c 100644 --- a/.ci_support/environment.yml +++ b/.ci_support/environment.yml @@ -16,3 +16,4 @@ dependencies: - sphinx_parser =0.0.1 - tqdm =4.67.1 - pyiron_vasp =0.2.5 +- semantikon =0.0.16 diff --git a/atomistics/calculators/lammps/libcalculator.py b/atomistics/calculators/lammps/libcalculator.py index 5578dad3..634afadd 100644 --- a/atomistics/calculators/lammps/libcalculator.py +++ b/atomistics/calculators/lammps/libcalculator.py @@ -6,6 +6,8 @@ import pandas from jinja2 import Template from pylammpsmpi import LammpsASELibrary +from semantikon.converter import units +from semantikon.typing import u from atomistics.calculators.interface import get_quantities_from_tasks from atomistics.calculators.lammps.commands import ( @@ -40,12 +42,13 @@ from atomistics.calculators.interface import TaskName +@units def optimize_positions_and_volume_with_lammpslib( structure: Atoms, potential_dataframe: DataFrame, min_style: str = "cg", etol: float = 0.0, - ftol: float = 0.0001, + ftol: u(float, units="eV/angstrom") = 0.0001, maxiter: int = 100000, maxeval: int = 10000000, thermo: int = 10, @@ -82,12 +85,13 @@ def optimize_positions_and_volume_with_lammpslib( return structure_copy +@units def optimize_positions_with_lammpslib( structure: Atoms, potential_dataframe: DataFrame, min_style: str = "cg", etol: float = 0.0, - ftol: float = 0.0001, + ftol: u(float, units="eV/angstrom") = 0.0001, maxiter: int = 100000, maxeval: int = 10000000, thermo: int = 10, @@ -143,15 +147,16 @@ def calc_static_with_lammpslib( return result_dict +@units def calc_molecular_dynamics_nvt_with_lammpslib( structure: Atoms, potential_dataframe: pandas.DataFrame, - Tstart: float = 100.0, - Tstop: float = 100.0, - Tdamp: float = 0.1, + Tstart: u(float, units="kelvin") = 100.0, + Tstop: u(float, units="kelvin") = 100.0, + Tdamp: u(float, units="picosecond") = 0.1, run: int = 100, thermo: int = 10, - timestep: float = 0.001, + timestep: u(float, units="picosecond") = 0.001, seed: int = 4928459, dist: str = "gaussian", lmp=None, @@ -197,18 +202,19 @@ def calc_molecular_dynamics_nvt_with_lammpslib( return result_dict +@units def calc_molecular_dynamics_npt_with_lammpslib( structure: Atoms, potential_dataframe: pandas.DataFrame, - Tstart: float = 100.0, - Tstop: float = 100.0, - Tdamp: float = 0.1, + Tstart: u(float, units="kelvin") = 100.0, + Tstop: u(float, units="kelvin") = 100.0, + Tdamp: u(float, units="picosecond") = 0.1, run: int = 100, thermo: int = 100, - timestep: float = 0.001, - Pstart: float = 0.0, - Pstop: float = 0.0, - Pdamp: float = 1.0, + timestep: u(float, units="picosecond") = 0.001, + Pstart: u(float, units="bar") = 0.0, + Pstop: u(float, units="bar") = 0.0, + Pdamp: u(float, units="picosecond") = 1.0, seed: int = 4928459, dist: str = "gaussian", lmp=None, @@ -257,16 +263,17 @@ def calc_molecular_dynamics_npt_with_lammpslib( return result_dict +@units def calc_molecular_dynamics_nph_with_lammpslib( structure: Atoms, potential_dataframe: pandas.DataFrame, run: int = 100, thermo: int = 100, timestep: float = 0.001, - Tstart: float = 100.0, - Pstart: float = 0.0, - Pstop: float = 0.0, - Pdamp: float = 1.0, + Tstart: u(float, units="kelvin") = 100.0, + Pstart: u(float, units="bar") = 0.0, + Pstop: u(float, units="bar") = 0.0, + Pdamp: u(float, units="picosecond") = 1.0, seed: int = 4928459, dist: str = "gaussian", lmp=None, @@ -312,15 +319,16 @@ def calc_molecular_dynamics_nph_with_lammpslib( return result_dict +@units def calc_molecular_dynamics_langevin_with_lammpslib( structure: Atoms, potential_dataframe: pandas.DataFrame, run: int = 100, thermo: int = 100, - timestep: float = 0.001, - Tstart: float = 100.0, - Tstop: float = 100, - Tdamp: float = 0.1, + timestep: u(float, units="picosecond") = 0.001, + Tstart: u(float, units="kelvin") = 100.0, + Tstop: u(float, units="kelvin") = 100.0, + Tdamp: u(float, units="picosecond") = 0.1, seed: int = 4928459, dist: str = "gaussian", lmp=None, @@ -368,19 +376,20 @@ def calc_molecular_dynamics_langevin_with_lammpslib( return result_dict +@units def calc_molecular_dynamics_thermal_expansion_with_lammpslib( structure: Atoms, potential_dataframe: pandas.DataFrame, - Tstart: float = 15.0, - Tstop: float = 1500.0, + Tstart: u(float, units="kelvin") = 15.0, + Tstop: u(float, units="kelvin") = 1500.0, Tstep: int = 5, - Tdamp: float = 0.1, + Tdamp: u(float, units="picosecond") = 0.1, run: int = 100, thermo: int = 100, timestep: float = 0.001, - Pstart: float = 0.0, - Pstop: float = 0.0, - Pdamp: float = 1.0, + Pstart: u(float, units="bar") = 0.0, + Pstop: u(float, units="bar") = 0.0, + Pdamp: u(float, units="picosecond") = 1.0, seed: int = 4928459, dist: str = "gaussian", lmp=None, diff --git a/atomistics/workflows/phonons/helper.py b/atomistics/workflows/phonons/helper.py index 3fd5297c..5b635a87 100644 --- a/atomistics/workflows/phonons/helper.py +++ b/atomistics/workflows/phonons/helper.py @@ -5,6 +5,8 @@ import structuretoolkit from ase.atoms import Atoms from phonopy import Phonopy +from semantikon.converter import units +from semantikon.typing import u from atomistics.shared.output import OutputPhonons, OutputThermodynamic from atomistics.workflows.phonons.units import VaspToTHz, kJ_mol_to_eV @@ -260,10 +262,11 @@ def restore_magmoms( return structure +@units def generate_structures_helper( structure: Atoms, primitive_matrix: Optional[np.ndarray] = None, - displacement: float = 0.01, + displacement: u(float, units="angstrom") = 0.01, number_of_snapshots: Optional[int] = None, interaction_range: float = 10.0, factor: float = VaspToTHz,