site_analysis.site_collection

class SiteCollection(sites: Sequence[site_analysis.site.Site])[source]

Bases: abc.ABC

Parent class for collections of sites.

Collections of specific site types should inherit from this class.

sites

List of Site-like objects.

Type:list
analyse_structure(atoms, structure)[source]

Perform a site analysis for a set of atoms on a specific structure.

This method should be implemented in the derived subclass.

Parameters:
  • atoms (list(Atom)) – List of Atom objects to be assigned to sites.
  • struture (pymatgen.Structure) – Pymatgen Structure object used to specificy the atomic coordinates.
Returns:

None

assign_site_occupations(atoms, structure)[source]

Assigns atoms to sites for a specific structure.

This method should be implemented in the derived subclass

Parameters:
  • atoms (list(Atom)) – List of Atom objects to be assigned to sites.
  • struture (pymatgen.Structure) – Pymatgen Structure object used to specificy the atomic coordinates.
Returns:

None

Notes

The atom coordinates should already be consistent with the coordinates in structure. Recommended usage is via the analyse_structure() method.

neighbouring_sites(site_index)[source]

If implemented, returns a list of sites that neighbour a given site.

This method should be implemented in the derived subclass.

Parameters:site_index (int) – Index of the site to return a list of neighbours for.
reset_site_occupations()[source]

Occupations of all sites in this site collection are set as empty.

Parameters:None
Returns:None
site_by_index(index)[source]

Returns the site with a specific index.

Parameters:index (int) – index for the site to be returned.
Returns:(Site)
Raises:ValueError – If a site with the specified index is not contained in this SiteCollection.
sites_contain_points(points: numpy.ndarray, structure: Optional[pymatgen.core.structure.Structure] = None) → bool[source]

If implemented, Checks whether the set of sites contain a corresponding set of fractional coordinates. :param points: 3xN numpy array of fractional coordinates.

There should be one coordinate for each site being checked.
Returns:(bool)

Notes

Specific SiteCollection subclass implementations may require additional arguments to be passed.

update_occupation(site, atom)[source]

Updates site and atom attributes for this atom occupying this site.

Parameters:
  • site (Site) – The site to be updated.
  • atom (Atom) – The atom to be updated.
Returns:

None

Notes

This method does the following:

  1. If the atom has moved to a new site, record a old_site –> new_site transition.
  2. Add this atom’s index to the list of atoms occupying this site.
  3. Add this atom’s fractional coordinates to the list of coordinates observed occupying this site.
  4. Assign this atom this site index.