gpridge.ase_bridge

ASE overlay helpers for gpridge step / compute surface.

Geometry and oracle wiring shared by GPNEB, gpridge.session, and optional pyeonclient bridges.

Typical path:

from gpridge.ase_bridge import (
    path_matrix_from_images,
    neb_oracle_from_calculator,
    apply_gpneb_result,
)

Attributes

ase_potential

OracleFn

Signature of an oracle. It takes flat positions and returns the energy and the flat gradient.

Functions

atoms_config_from_ase(atoms[, frozen_indices])

Create an AtomsConfiguration from an ASE Atoms object.

observation_from_ase(atoms_list)

Create an Observation from a list of ASE Atoms objects.

require_ase()

Import ASE or raise with install hint.

path_matrix_from_images(→ numpy.ndarray)

Stack ASE Atoms positions into (n_images, 3*n_atoms) float64.

apply_path_matrix(→ None)

Write path matrix rows into ASE Atoms positions (and optional energy info).

images_from_endpoints(→ List[Any])

Build ASE image list from endpoints via C++ path init.

neb_oracle_from_calculator(→ OracleFn)

Build (positions_flat) -> (energy, gradient) for gp_neb / run_ocineb.

dimer_force_fn_from_calculator(template, calculator, *)

PotentialWrapper callback: writes forces in place, returns energy.

apply_gpneb_result(→ None)

Push GPNEBResult geometries and energies into ASE images.

make_atoms_configuration(atoms, *[, gp_params, ...])

Build and fully initialize AtomsConfiguration for gp_neb.

Module Contents

gpridge.ase_bridge.atoms_config_from_ase(atoms, frozen_indices=None)

Create an AtomsConfiguration from an ASE Atoms object.

Parameters:
  • atoms (ase.Atoms) – ASE Atoms object.

  • frozen_indices (array-like of int, optional) – Indices of atoms to mark as frozen. If None, all atoms are treated as moving.

Returns:

atoms_config

Return type:

AtomsConfiguration

gpridge.ase_bridge.observation_from_ase(atoms_list)

Create an Observation from a list of ASE Atoms objects.

Each Atoms object supplies energy and forces via atoms.get_potential_energy() / atoms.get_forces().

Parameters:

atoms_list (list of ase.Atoms) – Atoms objects with calculators attached.

Returns:

obs

Return type:

Observation

gpridge.ase_bridge.ase_potential
gpridge.ase_bridge.OracleFn

Signature of an oracle. It takes flat positions and returns the energy and the flat gradient.

gpridge.ase_bridge.require_ase()

Import ASE or raise with install hint.

gpridge.ase_bridge.path_matrix_from_images(images: Sequence[Any]) → numpy.ndarray

Stack ASE Atoms positions into (n_images, 3*n_atoms) float64.

gpridge.ase_bridge.apply_path_matrix(images: Sequence[Any], path: numpy.ndarray, *, energies: Sequence[float] | None = None) → None

Write path matrix rows into ASE Atoms positions (and optional energy info).

gpridge.ase_bridge.images_from_endpoints(reactant: Any, product: Any, n_intermediate: int, *, path_method: str = 'idpp', spring_constant: float = 0.1, sidpp_alpha: float = 0.33) → List[Any]

Build ASE image list from endpoints via C++ path init.

Parameters:
  • reactant – ASE Atoms (or objects with get_positions / copy / set_positions).

  • product – ASE Atoms (or objects with get_positions / copy / set_positions).

  • n_intermediate – Number of interior images (excluding endpoints).

  • path_method – linear | idpp | idpp_collective | sidpp | sidpp_geodesic.

gpridge.ase_bridge.neb_oracle_from_calculator(template: Any, calculator: Any, *, gp: Any = None, observers: Any = None) → OracleFn

Build (positions_flat) -> (energy, gradient) for gp_neb / run_ocineb.

Gradient is -forces (C++ NEB convention). When gp is given, each evaluation is appended via gp.add_evaluated_observation. When observers (a gpridge._observers.OracleObservers) is given, each evaluation is reported to it.

gpridge.ase_bridge.dimer_force_fn_from_calculator(template: Any, calculator: Any, *, gp: Any = None, observers: Any = None)

PotentialWrapper callback: writes forces in place, returns energy.

gp and observers receive each evaluation as in neb_oracle_from_calculator().

gpridge.ase_bridge.apply_gpneb_result(images: Sequence[Any], result: Any) → None

Push GPNEBResult geometries and energies into ASE images.

gpridge.ase_bridge.make_atoms_configuration(atoms: Any, *, gp_params: dict | None = None, frozen_indices=None)

Build and fully initialize AtomsConfiguration for gp_neb.