gpridge.integrations.oracle¶
Oracle contract for a saddle or path search.
evaluate returns energy in eV and Cartesian forces in eV/Angstrom.
The gradient is the negative of the force, which is the sign the simple
NEB oracle uses. The force callback writes the force itself and writes
a variance of 0, the value used when the evaluation is the true surface
and has no surrogate variance.
One instance is used by one thread. close is idempotent. A closed
oracle rejects later evaluations. Fixed atoms are put back on the
reference coordinates before the evaluator runs, and their force
components are then zero. The caller’s position array is not modified.
The cell is the cell stored at construction. A caller who passes a
different cell gets GeometryError from evaluate. write_oracle
and write_force catch that error and write non-finite output, which
is the C callback’s rejected-evaluation signal.
Classes¶
One evaluation in GPRidge units. |
|
A Cartesian energy and force evaluation with a fixed geometry contract. |
|
Duck-typed calculator over one |
Module Contents¶
- class gpridge.integrations.oracle.Evaluation¶
One evaluation in GPRidge units.
- forces_eV_per_A: numpy.ndarray¶
- gradient_eV_per_A: numpy.ndarray¶
- class gpridge.integrations.oracle.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.oracle.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)¶