Construct Atomic Environment

flare.utils.env_getarray.get_2_body_arrays(positions, atom: int, cell, r_cut, cutoff_2, species, sweep, nspecie, species_mask, twobody_mask)

Returns distances, coordinates, species of atoms, and indices of neighbors in the 2-body local environment. This method is implemented outside the AtomicEnvironment class to allow for njit acceleration with Numba.

Parameters:
  • positions (np.ndarray) – Positions of atoms in the structure.
  • atom (int) – Index of the central atom of the local environment.
  • cell (np.ndarray) – 3x3 array whose rows are the Bravais lattice vectors of the cell.
  • cutoff_2 (np.ndarray) – 2-body cutoff radius.
  • species (np.ndarray) – Numpy array of species represented by their atomic numbers.
  • nspecie – number of atom types to define bonds
  • species_mask – mapping from atomic number to atom types
  • twobody_mask – mapping from the types of end atoms to bond types
Type:

int

Type:

np.ndarray

Type:

np.ndarray

Returns:

Tuple of arrays describing pairs of atoms in the 2-body local environment.

bond_array_2: Array containing the distances and relative coordinates of atoms in the 2-body local environment. First column contains distances, remaining columns contain Cartesian coordinates divided by the distance (with the origin defined as the position of the central atom). The rows are sorted by distance from the central atom.

bond_positions_2: Coordinates of atoms in the 2-body local environment.

etypes: Species of atoms in the 2-body local environment represented by their atomic number.

bond_indices: Structure indices of atoms in the local environment.

Return type:

np.ndarray, np.ndarray, np.ndarray, np.ndarray

flare.utils.env_getarray.get_3_body_arrays(bond_array_2, bond_positions_2, ctype, etypes, r_cut, cutoff_3, nspecie, species_mask, cut3b_mask)

Returns distances and coordinates of triplets of atoms in the 3-body local environment.

Parameters:
  • bond_array_2 (np.ndarray) – 2-body bond array.
  • bond_positions_2 (np.ndarray) – Coordinates of atoms in the 2-body local environment.
  • ctype – atomic number of the center atom
  • cutoff_3 (np.ndarray) – 3-body cutoff radius.
  • nspecie – number of atom types to define bonds
  • species_mask – mapping from atomic number to atom types
  • cut3b_mask – mapping from the types of end atoms to bond types
Type:

int

Type:

int

Type:

np.ndarray

Type:

np.ndarray

Returns:

Tuple of 4 arrays describing triplets of atoms in the 3-body local environment.

bond_array_3: Array containing the distances and relative coordinates of atoms in the 3-body local environment. First column contains distances, remaining columns contain Cartesian coordinates divided by the distance (with the origin defined as the position of the central atom). The rows are sorted by distance from the central atom.

cross_bond_inds: Two dimensional array whose row m contains the indices of atoms n > m that are within a distance cutoff_3 of both atom n and the central atom.

cross_bond_dists: Two dimensional array whose row m contains the distances from atom m of atoms n > m that are within a distance cutoff_3 of both atom n and the central atom.

triplet_counts: One dimensional array of integers whose entry m is the number of atoms that are within a distance cutoff_3 of atom m.

Return type:

(np.ndarray, np.ndarray, np.ndarray, np.ndarray)

flare.utils.env_getarray.get_m2_body_arrays(positions, atom: int, cell, r_cut, manybody_cutoff_list, species, sweep: <sphinx.ext.autodoc.importer._MockObject object at 0x7f53bef93910>, nspec, spec_mask, manybody_mask, cutoff_func=<function quadratic_cutoff>)
Parameters:
  • positions (np.ndarray) – Positions of atoms in the structure.
  • atom (int) – Index of the central atom of the local environment.
  • cell (np.ndarray) – 3x3 array whose rows are the Bravais lattice vectors of the cell.
  • manybody_cutoff_list (float) – 2-body cutoff radius.
  • species (np.ndarray) – Numpy array of species represented by their atomic numbers.
Returns:

Tuple of arrays describing pairs of atoms in the 2-body local environment.

flare.utils.env_getarray.get_m3_body_arrays(positions, atom: int, cell, cutoff: float, species, sweep, cutoff_func=<function quadratic_cutoff>)

Note: here we assume the cutoff is not too large, i.e., 2 * cutoff < cell_size

flare.utils.env_getarray.q3_value_mc(distances, cross_bond_inds, cross_bond_dists, triplets, r_cut, species_list, etypes, cutoff_func, q_func=<function coordination_number>)

Compute value of many-body many components descriptor based on distances of atoms in the local many-body environment.

Parameters:
  • distances (np.ndarray) – distances between atoms i and j
  • r_cut (float) – cutoff hyperparameter
  • ref_species (int) – species to consider to compute the contribution
  • etypes (np.ndarray) – atomic species of neighbours
  • cutoff_func (callable) – cutoff function
  • q_func (callable) – many-body pairwise descrptor function
Returns:

the value of the many-body descriptor

Return type:

float