gpridge.integrations.geometry ============================= .. py:module:: gpridge.integrations.geometry .. autoapi-nested-parse:: Cartesian layout shared by the optional oracles. Atom ``i`` occupies coordinates ``3i``, ``3i+1``, and ``3i+2`` in ``x, y, z`` order. A cell is three row vectors ``a, b, c`` in Angstrom. The C force callback stores that cell as nine row-major doubles. An isolated system has no cell. A zero matrix is not a cell. Two cells name the same box when every component differs by at most ``CELL_MATCH_A`` Angstrom. Fixed atoms are restored to the reference coordinates before an engine sees them, and their reported force is then set to zero. Attributes ---------- .. autoapisummary:: gpridge.integrations.geometry.CELL_MATCH_A Functions --------- .. autoapisummary:: gpridge.integrations.geometry.as_atomic_numbers gpridge.integrations.geometry.as_mask gpridge.integrations.geometry.normalize_positions gpridge.integrations.geometry.as_cell gpridge.integrations.geometry.as_pbc gpridge.integrations.geometry.cells_match gpridge.integrations.geometry.restore_fixed_positions gpridge.integrations.geometry.zero_fixed_components gpridge.integrations.geometry.cell_to_box9 gpridge.integrations.geometry.cell_and_pbc_from_atoms gpridge.integrations.geometry.cell_from_lammps_box Module Contents --------------- .. py:data:: CELL_MATCH_A :value: 1e-08 .. py:function:: as_atomic_numbers(values, n_atoms: int) -> numpy.ndarray Return a copy of ``n_atoms`` positive atomic numbers. .. py:function:: as_mask(fixed, n_atoms: int) -> numpy.ndarray Return a boolean mask of length ``n_atoms``. ``None`` freezes nothing. A boolean array is a mask. An integer array is a list of atom indices. .. py:function:: normalize_positions(values, n_atoms: int) -> numpy.ndarray Copy positions into a contiguous ``(n_atoms, 3)`` array. The accepted layouts are ``(n_atoms, 3)`` and a flat ``(3*n_atoms,)`` vector in ``x, y, z`` atom order. A ``(3, n_atoms)`` array is rejected so a column-major layout is not read as coordinates. .. py:function:: as_cell(cell) -> numpy.ndarray | None Copy a ``(3, 3)`` cell in Angstrom, or return ``None``. .. py:function:: as_pbc(pbc, cell: numpy.ndarray | None) -> numpy.ndarray Return three periodicity flags. With no cell, every flag is false. With a cell and ``pbc is None``, every flag is true. .. py:function:: cells_match(left: numpy.ndarray | None, right: numpy.ndarray | None) -> bool True when both cells are absent or every component is within tolerance. .. py:function:: restore_fixed_positions(positions: numpy.ndarray, reference: numpy.ndarray, mask: numpy.ndarray) -> numpy.ndarray Write reference coordinates onto the fixed rows of ``positions``. .. py:function:: zero_fixed_components(forces: numpy.ndarray, mask: numpy.ndarray) -> numpy.ndarray Set the force rows of fixed atoms to zero. .. py:function:: cell_to_box9(cell: numpy.ndarray) -> numpy.ndarray Pack a cell as nine row-major doubles. .. py:function:: cell_and_pbc_from_atoms(atoms) Return ``(cell_A or None, pbc)`` from an atoms-like object. All-false periodicity is an isolated system, including a cell array that is present and zero. A periodic object supplies a ``(3, 3)`` cell in Angstrom. .. py:function:: cell_from_lammps_box(boxlo, boxhi, xy: float, yz: float, xz: float) -> numpy.ndarray Build the LAMMPS triclinic cell, rows ``a, b, c``, in Angstrom. LAMMPS stores the box as ``boxlo``, ``boxhi``, and the tilt factors ``xy``, ``yz``, and ``xz``. The rows are ``(xhi-xlo, 0, 0)``, ``(xy, yhi-ylo, 0)``, and ``(xz, yz, zhi-zlo)``.