pyspinw.structure#

Magnetic structures

Classes

Structure(sites, unit_cell[, spacegroup, ...])

Representation of the magnetic structure

class pyspinw.structure.Structure(sites: list[Site], unit_cell: UnitCell, spacegroup: SymmetryGroup | None = None, supercell: Supercell | None = None, skip_checks: bool = False, show_unit_cell_warning: bool = True, assume_symmetric_sites_are_provided: bool = False, cooerce_spin_data_to_match_supercell: bool = True, symmetric_sites: list[Site] | None = None)#

Bases: SPWSerialisable

Representation of the magnetic structure

all_neighbours(site: Site, n=1, element: str | None = None, direction_filter: DirectionalityFilter | None = None) → list[list[tuple[Site, CellOffset]]]#

Get list-of-lists containing (i<=n)-th nearest neighbours along with their cell offsets

Parameters:
  • n – maximum n for n-th nearest neighbour

  • element – Restrict search to this element

  • direction_filter – Filter the results using this

Returns:

a list of (site, offset) pairs for each order up-to and including neighbour

anisotropy_constraints(site: Site | str | ArrayLike, do_print=True)#

Get the constraints on anisotropies for a given site

exchange_constraints(site_1: Site | str | ArrayLike, site_2: Site | str | ArrayLike, do_print=True)#

Get the constraints for the exchange matrix between two sites

expand()#

Expand supercell into a single, bigger cell

full_structure_site_list()#

All the sites in the structure

matplotlib_site_data()#

Data for making matplotlib scatter plots of sites

neighbours(site: Site, n=1, element: str | None = None, direction_filter: DirectionalityFilter | None = None)#

Get a list of n-th nearest neighbours, along with cell offsets

Parameters:
  • n – maximum n for n-th nearest neighbour

  • element – Restrict search to this element

  • direction_filter – Filter the results using this

Returns:

a list of (site, offset) for n-th nearest neighbour

one_neighbour(site: Site, n=1, element: str | None = None, direction_filter: DirectionalityFilter | None = None)#

Get one, arbitrary, n-th nearest neighbours, along with cell offsets

Parameters:
  • n – maximum n for n-th nearest neighbour

  • element – Restrict search to this element

  • direction_filter – Filter the results using this

Returns:

a list of (site, offset) for n-th nearest neighbour

print_summary()#

Print out details of this structure

serialisation_name = 'structure'#
site_by_name(name: str)#

Get a single site by its name

site_pairs()#

Generator for pairs of sites

property sites: list[Site]#

Get the sites used to define the structure and implied by symmetry

sites_by_element(element: str | None) → list[Site]#

Get list of sites with the specified element in the metadata

sites_by_name(name) → list[Site]#

Get sites where name matches regex

property spacegroup: SpaceGroup#

Get the spacegroup

property supercell: Supercell#

Get the supercell

Get a list of sites related to the specified site by symmetry, including the original site

property text_summary: str#

Textual details of this structure

property unit_cell: UnitCell#

Get the unit cell

updated(sites: list[Site] | None = None, unit_cell: UnitCell | None = None, spacegroup: SymmetryGroup | None = None, supercell: Supercell | None = None)#

Make a copy of this structure, but with selected (not None) fields replaced

without_elements(*elements)#

Get the structure without sites with given elements

without_nonmagnetic() → Structure#

Get a copy of this structure with non-magnetic sites removed