gpridge._adapters ================= .. py:module:: gpridge._adapters .. autoapi-nested-parse:: Adapters for external potential energy surface packages. Functions --------- .. autoapisummary:: gpridge._adapters.ase_potential gpridge._adapters.atoms_config_from_ase gpridge._adapters.observation_from_ase Module Contents --------------- .. py:function:: ase_potential(atoms) Create a potential callback from an ASE ``Atoms`` object. The returned callable has the signature expected by :class:`~gpridge.PotentialWrapper`:: fn(positions, atomic_numbers, forces, box) -> energy The ``Atoms`` object is updated in-place on every call (positions and cell are overwritten), so the same object can be inspected after the search completes. :param atoms: An ASE ``Atoms`` object with a calculator attached. The calculator must support ``get_potential_energy()`` and ``get_forces()``. :type atoms: :py:class:`ase.Atoms` :returns: **potential_fn** -- A function suitable for passing to :class:`~gpridge.PotentialWrapper` or :func:`~gpridge.run_dimer`. :rtype: :py:class:`callable` :raises ImportError: If ASE is not installed. :raises ValueError: If *atoms* has no calculator attached. .. rubric:: Examples >>> from ase.build import molecule >>> from ase.calculators.emt import EMT >>> h2 = molecule("H2") >>> h2.calc = EMT() >>> pot_fn = ase_potential(h2) .. py:function:: atoms_config_from_ase(atoms, frozen_indices=None) Create an :class:`AtomsConfiguration` from an ASE ``Atoms`` object. :param atoms: ASE Atoms object. :type atoms: :py:class:`ase.Atoms` :param frozen_indices: Indices of atoms to mark as frozen. If ``None``, all atoms are treated as moving. :type frozen_indices: :py:class:`array-like` of :py:class:`int`, *optional* :returns: **atoms_config** :rtype: :py:class:`~gpridge._core.AtomsConfiguration` .. py:function:: observation_from_ase(atoms_list) Create an :class:`Observation` from a list of ASE ``Atoms`` objects. Each Atoms object supplies energy and forces via ``atoms.get_potential_energy()`` / ``atoms.get_forces()``. :param atoms_list: Atoms objects with calculators attached. :type atoms_list: :py:class:`list` of :py:class:`ase.Atoms` :returns: **obs** :rtype: :py:class:`~gpridge._core.Observation`