principia_materia.translation_group.cluster module

class principia_materia.translation_group.cluster.Cluster(atoms, orbitals=None, tol=1e-06)

Bases: object

A cluster of atoms or particles.

We will only refer to them as atoms for now.

Parameters:
  • atoms (dict of str as keys and array of float as values) – A dictionary of names of atoms and their positions.

  • orbitals (str or array of str) – Orbital names to assign to the atoms.

  • tol (float) – Tolerance.

dim

Dimension of the cluster.

Type:

int

natoms

Number of atoms in the cluster.

Type:

int

nspecies

Number of different species in the cluster.

Type:

int

positions

Positions of atoms in the cluster.

Type:

array of float, shape(natoms, dim)

orbitals

A list of all orbitals of the all the atoms in the cluster.

Type:

array of tuple<int, str>

norbitals

Total number of orbitals in the cluster.

Type:

float

atoms

A dictionary of names of atoms and their positions.

Type:

dict of str as keys and array of float as values

species

A dictionary of names of atoms and their index in all the atoms in the cluster.

Type:

dict of str as keys and array of int as values

center

The averanged positions of all the atoms in the cluster.

Type:

array of float, shape(dim, )

property atoms

A dictionary of atoms and their positions.

property atoms_species_map

A list of indices of species of each atom.

axial_strain(strain)

Apply axial strain to the cluster.

Parameters:

strain (array of float, shape(dim, dim) or shape(dim, )) – The strain matrix or the diagonal of the diaongal strain matrix.

property center

The center of the cluster.

This center is defined as average positions of all atoms.

check_atoms_overlap(tol=None)

Check if atoms overlap with each other.

copy()

Return a copy of the object.

Returns:

new – A copy of the object itself.

Return type:

Cluster

property dim

Dimension of the cluster.

find_atoms(positions)

Find the indices of atoms of the same position.

If an atom is not found, in return index will be -1.

Parameters:

positions (array of float, shape (dim, ) or (N, dim)) – Positions of atoms to be found. If input shape is (dim, ), it will be reshaped into (1, dim) and N = 1.

Returns:

atoms_index – The indices of atoms.

Return type:

array of int, shape (N, )

property natoms

Number of atoms in the cluster.

property norbitals

Number of orbitals in the cluster.

property nspecies

Number of species in the cluster.

property orbitals

A list of all orbitals of atoms in the cluster.

property positions

The coordinates of all atoms.

rotate(rotation)

Rotate atoms (in place).

Parameters:

rotation (arrat of floats, shape(dim, dim)) – The rotation matrix in column convention.

rotate_atoms(rotation)

Return the rotated positions of atoms.

Parameters:

rotation (arrat of floats, shape(dim, dim)) – The rotation matrix in column convention.

shift_atom(atom_index, shift)

Shift an atom.

Parameters:
  • atom_index (int) – Index of the atom to shift.

  • shift (float or array of float, shape(dim, )) – The shift amount.

shift_atoms(shift)

Shift all atoms.

Parameters:

shift (float or array of float, shape(dim, ), or array of float shape(natoms, dim)) – The shift amount.

shift_origin(shift)

Shift the origin of the cluster.

Parameters:

shift (arrat of floats, shape(dim, )) – The shift amount.

property species

The dictionary of species and the indices of atoms of each species.

property species_names

A list of names of species.

strain(strain)

Apply strain to the cluster.

Parameters:

strain (array of float, shape(dim, dim) or shape(dim, )) – The strain matrix.

to_dict()

Return a dictionary containing key information about the cluster.

principia_materia.translation_group.cluster.get_cluster_io_wrapper(title='Cluster')

YAML data wrapper for Cluster class.