Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect md steps #380

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ipsuite/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from .analysis import (
BoxHeatUp,
BoxScale,
CalibrationMetrics,
CollectMDSteps,
ConnectivityCheck,
DebugCheck,
DipoleHistogram,
Expand Down Expand Up @@ -168,6 +169,7 @@ __all__ = [
"ThresholdCheck",
"TemperatureCheck",
"AnalyseDensity",
"CollectMDSteps",
# Calculators
"CP2KSinglePoint",
"ASEGeoOpt",
Expand Down
3 changes: 2 additions & 1 deletion ipsuite/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from ipsuite.analysis.bond_stretch import BondStretchAnalyses
from ipsuite.analysis.ensemble import ModelEnsembleAnalysis
from ipsuite.analysis.md import AnalyseDensity
from ipsuite.analysis.md import AnalyseDensity, CollectMDSteps
from ipsuite.analysis.model import (
BoxHeatUp,
BoxScale,
Expand Down Expand Up @@ -62,4 +62,5 @@
"ForcesUncertaintyHistogram",
"EnergyUncertaintyHistogram",
"AnalyseDensity",
"CollectMDSteps",
]
15 changes: 15 additions & 0 deletions ipsuite/analysis/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import zntrack

from ipsuite import base
from ipsuite.calculators.ase_md import ASEMD
from ipsuite.utils.ase_sim import get_density_from_atoms


Expand Down Expand Up @@ -36,3 +37,17 @@ def run(self):
}

self.results = pd.DataFrame(densities, columns=["density"])


class CollectMDSteps(base.IPSNode):
mds: list[ASEMD] = zntrack.deps()
metrics: dict = zntrack.metrics()

def run(self):
steps: list[int] = [x.steps_before_stopping for x in self.mds]

self.metrics = {
"total": int(np.sum(steps)),
"mean": float(np.mean(steps)),
"std": float(np.std(steps)),
}
Loading