gpridge._api¶
Core convenience functions for running GPR dimer searches.
Functions¶
Return a dict of all InputParameters, dimer settings included. |
|
|
Return a parameter dict with preset values for common use cases. |
Return a dict of GP-relevant parameters with sensible defaults. |
|
|
Wrap an rgpot-style PES as a |
|
Install a saved kernel onto a dimer that has already been initialized. |
|
Run an atomic dimer saddle point search. |
Module Contents¶
- gpridge._api.default_parameters()¶
Return a dict of all InputParameters, dimer settings included.
The dimer keys (separation, rotation and translation methods, tolerances, phase limits) carry the values
gprdruns with, fromgpridge._core.canonical_dimer_parameters().prior_mu,prior_nu, andprior_s2default to the published Student-t values (0, 20, and 1), both in the literal dict and in that update. Zero is not a sentinel: the densities divide byprior_nuandprior_s2.initialize()copies this initial triple onto the Student-t magnitude, Gaussian length-scale, and log-normal priors; during data-bearing hyperparameter fitting,setHyperparameters()overwrites Student-ts2withtarget_varianceand Gaussians2withseed_length_scale_**2so the scales do not remain shared. The remaining keys are neutral placeholders that a search fills in (coordinates, cell, GP hyperparameters). Modify the returned dict and pass it torun_dimer().The keys correspond directly to the
InputParametersstruct fields in the C++ code. Array-valued parameters (R_init,G_init,orient_init,param_trans,dist_sp,cell_dimensions) must be numpy arrays of the correct size.- Returns:
params – A dictionary with all default parameter values.
- Return type:
- gpridge._api.preset_parameters(name='default')¶
Return a parameter dict with preset values for common use cases.
Presets override specific keys of
default_parameters():"default"– same asdefault_parameters()"fast"– fewer iterations, looser convergence"accurate"– more iterations, tighter convergence
- gpridge._api.default_gpr_parameters()¶
Return a dict of GP-relevant parameters with sensible defaults.
This is the minimal parameter set needed to construct and train a
GaussianProcessRegressionmodel without running a dimer search. Modify the returned dict and pass it toGaussianProcessRegression.initialize().- Returns:
params – Dictionary with GP-specific default parameter values.
- Return type:
- gpridge._api.from_rgpot(pot)¶
Wrap an rgpot-style PES as a
PotentialWrapper.potis a boundrgpot::PotentialBaseor a callable matching rgpotoperator():pot(positions, atomic_numbers, cell) -> (energy, forces) # or (energy, forces, energy_variance) # or (energy, forces, energy_variance, force_noise_rms)
This is the Python hook for
PotentialWrapper::from_rgpot. C++ callers use the templatedfrom_rgpot(RgPot&)/from_rgpot(shared_ptr<RgPot>)overloads or the C++-onlyfrom_rgpot(shared_ptr<rgpot::PotentialBase>). rgpot does not publish nanobind types; a real C++ pot is held through that base. The returned wrapper is the same type-erased PES the CLI attaches.- Parameters:
pot (
objectorcallable) – Bound C++ PotentialBase, or an rgpot-style callable.- Return type:
- gpridge._api.install_dimer_kernel(dimer, gp, init_data=None)¶
Install a saved kernel onto a dimer that has already been initialized.
A path loads that file. A fitted GaussianProcess is written and then loaded, so its hyperparameters move with its rows. An unfitted model with no path leaves the dimer’s own kernel in place and does not ask the dimer for a model. A file whose kernel describes a different search leaves that kernel in place too: the seed rows were already given to the dimer, which is how the command-line search treats the same file.
- gpridge._api.run_dimer(params, initial_obs, mid_point_obs, orientation, atoms_config, potential_fn, *, gp=None, init_data=None)¶
Run an atomic dimer saddle point search.
This is a convenience wrapper that creates the C++ objects and executes the GPR dimer algorithm in a single call.
- Parameters:
params (
dict) –Parameter dictionary. Start from
default_parameters()(which carries the settingsgprdruns with) and override the keys you need. The keys that matter most are:dimer_sep– dimer separation distanceT_dimer– force convergence thresholdnum_bigiter– max outer iterationsnum_iter– max inner iterationsmethod_rot– rotation method ("LBFGS_alg")method_trans– translation method ("LBFGS_alg")param_trans–[step_length, max_step_length]cell_dimensions– 3x3 cell as flat 9-element arraycell_periodic– periodic axes a, b, c as three ints; the minimum image acts along the periodic ones only
initial_obs (
Observation) – Initial observation data. SetRto the initial coordinates (shape(N_obs, 3*N_atoms)),Eto energies (shape(N_obs, 1)), andGto gradients (shape(N_obs, 3*N_atoms)).mid_point_obs (
Observation) – Observation at the dimer mid-point (same field layout as initial_obs but with a single row).orientation (
numpy.ndarray) – Initial dimer orientation, shape(1, 3*N_moving).atoms_config (
AtomsConfiguration) – Atomic configuration. Setpositions(shape(1, 3*N_atoms)),is_frozen(shape(1, N_atoms), dtype uint8),id(shape(1, N_atoms), dtype uint32), andatomic_nrs(shape(1, N_atoms), dtype int32).potential_fn (
callableorPotentialWrapper) – An EON-style callbackfn(positions, atomic_numbers, forces, box) -> energy, or aPotentialWrapper(including one fromfrom_rgpot()).
- Returns:
dimer – The dimer object after the search. Check
get_converged()andget_termination_reason()before you use the geometry. Retrieve results with:dimer.get_final_energy()dimer.get_final_coord_of_mid_point()dimer.get_final_gradient_at_mid_point()dimer.get_final_curvature()dimer.get_total_force_calls()dimer.get_iterations()
- Return type: