Comparison of systems¶
Simple methods for comparing two ChemicalSystem instances:
- ChemicalSystem.has_same_atoms(other: ChemicalSystem, attributes: List[Literal['gui', 'adf', 'band', 'forcefield', 'dftb', 'reaxff', 'qe']] = []) bool
- ChemicalSystem.has_same_atoms(other: ChemicalSystem, comp: atom_comparator_func_t) bool
Checks if two systems have identical atoms in the same order.
Atoms are compared one by one using either a user-defined comparator function, or the
Atom.has_identical_attributesmethod with a user defined list of (optional) attributes groups to consider in the comparison.
- ChemicalSystem.has_same_coords(other: ChemicalSystem, tol: float = 0.001, unit: str = 'angstrom') bool
Checks if the atomic coordinates of two systems are within a threshold of each other.
This check is intended for systems that have the same number of atoms and all atoms in the same order. (You likely want to call
has_same_atomsbefore calling this method.) The thresholdtolis compared against the distance between two corresponding atoms. This ensures that the return value of this method does not depend on an overall rotation of the two systems.
- ChemicalSystem.has_same_geometry(other: ChemicalSystem, tol: float = 0.001, unit: str = 'angstrom') bool
Checks if the atomic coordinates and lattice vectors of two systems are within a threshold of each other. This is just a shorthand for calling
has_same_coordsandlattice.is_close()on the two systems.
- ChemicalSystem.has_same_regions(other: ChemicalSystem) bool
Checks if two systems have identical regions, meaning region names match and each region includes the same atoms.
This only checks the indices of the atoms assigned to the different regions. It does not check if atoms with the same index are actually the same. Use
has_same_atomsfor that.
- ChemicalSystem.has_same_selection(other: ChemicalSystem, consider_selection_order: bool = False) bool
Checks if two systems have the same atom selection.
This only checks the indices of the selected atoms. It does not check if atoms with the same index are actually the same. Use
has_same_atomsfor that.By default the selection order is ignored in the check and the two selections are compared as a set. This can be changed via the
consider_selection_orderargument.