hillclimber 0.1.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hillclimber might be problematic. Click here for more details.

@@ -0,0 +1,18 @@
1
+ from hillclimber.actions import PrintCVAction
2
+ from hillclimber.cvs import DistanceCV, CoordinationNumberCV, TorsionCV, RadiusOfGyrationCV
3
+ from hillclimber.metadynamics import MetaDBiasCV, MetaDynamicsConfig, MetaDynamicsModel
4
+ from hillclimber.selectors import IndexSelector, SMARTSSelector, SMILESSelector
5
+
6
+ __all__ = [
7
+ "PrintCVAction",
8
+ "DistanceCV",
9
+ "CoordinationNumberCV",
10
+ "TorsionCV",
11
+ "RadiusOfGyrationCV",
12
+ "IndexSelector",
13
+ "SMILESSelector",
14
+ "SMARTSSelector",
15
+ "MetaDynamicsModel",
16
+ "MetaDBiasCV",
17
+ "MetaDynamicsConfig",
18
+ ]
hillclimber/actions.py ADDED
@@ -0,0 +1,30 @@
1
+ import dataclasses
2
+
3
+ import ase
4
+
5
+ from hillclimber.interfaces import CollectiveVariable
6
+
7
+
8
+ @dataclasses.dataclass
9
+ class PrintCVAction:
10
+ """Node for PRINT action."""
11
+
12
+ cvs: list[CollectiveVariable]
13
+ stride: int = 1
14
+ file: str = "COLVAR"
15
+
16
+ def to_plumed(self, atoms: ase.Atoms) -> list[str]:
17
+ """Convert the action node to a PLUMED input string."""
18
+ all_labels = set()
19
+ for cv in self.cvs:
20
+ labels, _ = cv.to_plumed(atoms)
21
+ all_labels.update(labels)
22
+
23
+ # Create the PRINT command with the unique labels
24
+ print_command = (
25
+ f"PRINT ARG={','.join(sorted(all_labels))} STRIDE={self.stride} FILE={self.file}"
26
+ )
27
+
28
+ # Return the command as a list
29
+ return [print_command]
30
+
hillclimber/calc.py ADDED
@@ -0,0 +1,15 @@
1
+ from ase.calculators.calculator import Calculator, all_changes
2
+ from ase.calculators.plumed import Plumed
3
+
4
+
5
+ class NonOverwritingPlumed(Plumed):
6
+ def calculate(self, atoms=None, properties=None, system_changes=all_changes):
7
+ if properties is None:
8
+ properties = ["energy", "forces"]
9
+ Calculator.calculate(self, atoms, properties, system_changes)
10
+ energy, forces = self.compute_energy_and_forces(
11
+ self.atoms.get_positions(), self.istep
12
+ )
13
+ self.istep += 1
14
+ self.results = {f"model_{k}": v for k, v in self.calc.results.items()}
15
+ self.results["energy"], self.results["forces"] = energy, forces