gpridge.integrations¶
Optional oracles for saddle and path searches.
Importing this package does not import ASE, LAMMPS, OpenMM, PLUMED, or GROMACS. Those libraries are used only when a caller constructs the matching oracle and, for OpenMM and PLUMED, only inside that constructor.
Submodules¶
- gpridge.integrations.ase_oracle
- gpridge.integrations.errors
- gpridge.integrations.examples
- gpridge.integrations.geometry
- gpridge.integrations.gromacs_quantities
- gpridge.integrations.lammps_oracle
- gpridge.integrations.openmm_oracle
- gpridge.integrations.oracle
- gpridge.integrations.plumed_bias
- gpridge.integrations.units
Attributes¶
Exceptions¶
The engine rejected this geometry and can be called again. |
|
Positions, cell, atom order, or fixed-atom data do not match the oracle. |
|
Base for a rejected geometry, a closed oracle, or a failed evaluation. |
|
The oracle has been closed, or a context manager was entered twice. |
|
The engine unit style has no conversion into eV and Angstrom. |
Classes¶
Evaluate an existing calculator on copies of an atoms template. |
|
Convert one GROMACS-unit evaluation into the GPRidge oracle. |
|
One serial LAMMPS instance, evaluated with |
|
Single-point energy and forces from one OpenMM context. |
|
One evaluation in GPRidge units. |
|
A Cartesian energy and force evaluation with a fixed geometry contract. |
|
Duck-typed calculator over one |
|
Physical oracle plus one PLUMED bias. |
Functions¶
|
Read a full-atom freeze from |
Package Contents¶
- class gpridge.integrations.ASEOracle(template, calculator, **kwargs)¶
Bases:
gpridge.integrations.oracle.OracleEvaluate an existing calculator on copies of an atoms template.
- gpridge.integrations.fixed_mask_from_constraints(constraints, n_atoms: int) numpy.ndarray¶
Read a full-atom freeze from
FixAtomsconstraints.
- exception gpridge.integrations.EngineEvaluationError¶
Bases:
IntegrationErrorThe engine rejected this geometry and can be called again.
- exception gpridge.integrations.GeometryError¶
Bases:
IntegrationErrorPositions, cell, atom order, or fixed-atom data do not match the oracle.
- exception gpridge.integrations.IntegrationError¶
Bases:
ExceptionBase for a rejected geometry, a closed oracle, or a failed evaluation.
- exception gpridge.integrations.LifecycleError¶
Bases:
IntegrationErrorThe oracle has been closed, or a context manager was entered twice.
- exception gpridge.integrations.UnsupportedUnits¶
Bases:
IntegrationErrorThe engine unit style has no conversion into eV and Angstrom.
- gpridge.integrations.CELL_MATCH_A = 1e-08¶
- class gpridge.integrations.GromacsQuantityOracle(evaluate, **kwargs)¶
Bases:
gpridge.integrations.oracle.OracleConvert one GROMACS-unit evaluation into the GPRidge oracle.
- class gpridge.integrations.LammpsOracle(instance, *, atom_ids, units: str, container_A: numpy.ndarray, owns: bool = False, **kwargs)¶
Bases:
gpridge.integrations.oracle.OracleOne serial LAMMPS instance, evaluated with
run 0.- property atom_ids: numpy.ndarray¶
- property container_A: numpy.ndarray¶
LAMMPS box in Angstrom, including a non-periodic container.
- classmethod from_instance(instance, *, atom_ids, atomic_numbers, units: str, fixed=None, reference_positions_A=None, owns: bool = False) LammpsOracle¶
Bind a live
lammps.lammpsinstance.The import of
lammpsis left to the caller, who constructedinstance.unitsismetalorreal.
- class gpridge.integrations.OpenMMOracle(reader, **kwargs)¶
Bases:
gpridge.integrations.oracle.OracleSingle-point energy and forces from one OpenMM context.
- classmethod from_context(context, atomic_numbers, *, fixed=None, reference_positions_A=None, unit_module=None) OpenMMOracle¶
Bind a live
openmm.Context.unit_moduledefaults toopenmm.unitand is imported only on this path.
- classmethod from_reader(reader, atomic_numbers, *, fixed=None, reference_positions_A=None) OpenMMOracle¶
Bind a reader that already speaks nanometres and kJ/mol.
- class gpridge.integrations.Evaluation¶
One evaluation in GPRidge units.
- forces_eV_per_A: numpy.ndarray¶
- gradient_eV_per_A: numpy.ndarray¶
- class gpridge.integrations.Oracle(evaluator=None, *, atomic_numbers, reference_positions_A, fixed=None, cell_A=None, pbc=None)¶
A Cartesian energy and force evaluation with a fixed geometry contract.
- property atomic_numbers: numpy.ndarray¶
- property reference_positions_A: numpy.ndarray¶
- property fixed: numpy.ndarray¶
- property cell_A: numpy.ndarray | None¶
- property pbc: numpy.ndarray¶
- evaluate(positions, *, cell=_UNSET, atomic_numbers=None) Evaluation¶
Energy, force, and gradient at
positions.celldefaults to the stored cell and is not a request to drop periodicity. Pass a cell only to assert that it matches.
- as_neb_oracle()¶
Return
positions -> (energy_eV, gradient)with a flat gradient.Exceptions propagate. The C buffer writers are
write_oracleandwrite_force.
- as_calculator() OracleCalculator¶
Return a calculator with
get_potential_energyandget_forces.
- write_oracle(n_coords: int, positions, energy, gradient) None¶
Fill the simple C oracle buffers.
energy[0]is eV.gradientisdE/dRin eV/Angstrom, lengthn_coords, inx, y, zatom order. A rejected evaluation writes non-finite values and recordslast_failure.
- write_force(n_atoms: int, positions, atomic_numbers, forces, energy, variance=None, box=None) None¶
Fill the C force-callback buffers.
forcesreceives-dE/dR. On successvariance[0]is 0 whenvarianceis present.box, when present, is nine row-major cell components and must match the stored cell. With no box buffer, the callback uses the stored cell directly. A rejected evaluation writes non-finite energy, forces, and variance, and leavesboxunchanged.
- class gpridge.integrations.OracleCalculator(oracle: Oracle)¶
Duck-typed calculator over one
Oracle.get_potential_energyandget_forcesshare one evaluation for a given positions, atomic-number, and cell key. The next distinct geometry evaluates again.force_consistentselects the same energy: this calculator has one energy per geometry.- implemented_properties = ('energy', 'forces')¶
- name = 'gpridge-oracle'¶
- calculate(atoms=None, properties=None, system_changes=None)¶
- get_potential_energy(atoms=None, force_consistent=False)¶
- get_forces(atoms=None)¶
- class gpridge.integrations.PlumedBias(inner: gpridge.integrations.oracle.Oracle, kernel, *, masses_amu, advance_step: bool = False, owns_kernel: bool = False, owns_inner: bool = False, step: int = 0)¶
Bases:
gpridge.integrations.oracle.OraclePhysical oracle plus one PLUMED bias.
- classmethod from_input(inner: gpridge.integrations.oracle.Oracle, lines, *, masses_amu, timestep_ps: float, kT_eV: float, charges=None, logfile: str | None = None, restart: bool = False, advance_step: bool = False, plumed_module=None, input_units: str = 'plumed') PlumedBias¶
Create a PLUMED kernel and add it to
inner.linesis the PLUMED action text, one action per string.plumed_moduledefaults to theplumedpackage and is imported only on this path. The kernel is finalized when the bias is closed.inneris left open.
- gpridge.integrations.ANGSTROM_IN_NM = 0.1¶
- gpridge.integrations.EV_IN_KJ_PER_MOL = 96.48533212331002¶
- gpridge.integrations.KCAL_MOL_IN_EV = 0.043364104241800934¶
- gpridge.integrations.KJ_MOL_IN_EV = 0.010364269656262174¶
- gpridge.integrations.NM_IN_ANGSTROM = 10.0¶