gpridge.integrations.geometry¶
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¶
Functions¶
|
Return a copy of |
|
Return a boolean mask of length |
|
Copy positions into a contiguous |
|
Copy a |
|
Return three periodicity flags. |
|
True when both cells are absent or every component is within tolerance. |
|
Write reference coordinates onto the fixed rows of |
|
Set the force rows of fixed atoms to zero. |
|
Pack a cell as nine row-major doubles. |
|
Return |
|
Build the LAMMPS triclinic cell, rows |
Module Contents¶
- gpridge.integrations.geometry.CELL_MATCH_A = 1e-08¶
- gpridge.integrations.geometry.as_atomic_numbers(values, n_atoms: int) numpy.ndarray¶
Return a copy of
n_atomspositive atomic numbers.
- gpridge.integrations.geometry.as_mask(fixed, n_atoms: int) numpy.ndarray¶
Return a boolean mask of length
n_atoms.Nonefreezes nothing. A boolean array is a mask. An integer array is a list of atom indices.
- gpridge.integrations.geometry.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 inx, y, zatom order. A(3, n_atoms)array is rejected so a column-major layout is not read as coordinates.
- gpridge.integrations.geometry.as_cell(cell) numpy.ndarray | None¶
Copy a
(3, 3)cell in Angstrom, or returnNone.
- gpridge.integrations.geometry.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.
- gpridge.integrations.geometry.cells_match(left: numpy.ndarray | None, right: numpy.ndarray | None) bool¶
True when both cells are absent or every component is within tolerance.
- gpridge.integrations.geometry.restore_fixed_positions(positions: numpy.ndarray, reference: numpy.ndarray, mask: numpy.ndarray) numpy.ndarray¶
Write reference coordinates onto the fixed rows of
positions.
- gpridge.integrations.geometry.zero_fixed_components(forces: numpy.ndarray, mask: numpy.ndarray) numpy.ndarray¶
Set the force rows of fixed atoms to zero.
- gpridge.integrations.geometry.cell_to_box9(cell: numpy.ndarray) numpy.ndarray¶
Pack a cell as nine row-major doubles.
- gpridge.integrations.geometry.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.
- gpridge.integrations.geometry.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 factorsxy,yz, andxz. The rows are(xhi-xlo, 0, 0),(xy, yhi-ylo, 0), and(xz, yz, zhi-zlo).