httk.atomistic.structure module

class httk.atomistic.structure.Structure(assignments, rc_sites=None, rc_cell=None, other_reps=None)[source]

Bases: HttkObject

A Structure represents N sites of, e.g., atoms or ions, in any periodic or non-periodic arrangement. The structure object is meant to be immutable and assumes that no internal variables are changed after its creation. All methods that ‘changes’ the object creates and returns a new, updated, structure object.

This is the general heavy weight structure object. For lightweight structure objects, use UnitcellStructure or RepresentativeStructure.

Naming conventions in httk.atomistic:

Structure cell type abbreviations:
rc = Representative cell: only representative atoms are given inside the conventional cell.

they need to be replicated by the symmetry elements.

uc = Unit cell: any (imprecisely defined) unit cell (usually the unit cell used to define the structure

if it was not done via a representative cell.) with all atoms inside.

pc = Primitive unit cell: a smallest possible unit cell (the standard one) with all atoms inside.

cc = Conventional unit cell: the high symmetry unit cell (rc) with all atoms inside.

For cells:
cell = an abstract name for any reasonable representation of a ‘cell’ that defines

the basis vectors used for representing the structure. When a ‘cell’ is returned, it is an object of type Cell

basis = a 3x3 sequence-type with (in rows) the three basis vectors (for a periodic system, defining the unit cell, and defines the unit of repetition for the periodic dimensions)

lengths_and_angles = (a,b,c,alpha,beta,gamma): the basis vector lengths and angles

niggli_matrix = ((v1*v1, v2*v2, v3*v3),(2*v2*v3, 2*v1*v3, 2*v2*v3)) where v1, v2, v3 are the vectors forming the basis

metric = ((v1*v1,v1*v2,v1*v3),(v2*v1,v2*v2,v2*v3),(v3*v1,v3*v2,v3*v3))

For sites:
These following prefixes are used to describe types of site specifications:

representative cell/rc = only representative atoms are given, which are then to be repeated by structure symmetry group to give all sites

unit cell/uc = all atoms in unitcell

reduced = coordinates given in cell vectors

cartesian = coordinates given as direct cartesian coordinates

sites = used as an abstract name for any sensible representation of a list of coordinates and a cell,

when a ‘sites’ is returned, it is an object of type Sites

counts = number of atoms of each type (one per entry in assignments)

coordgroups = coordinates represented as a 3-level-list of coordinates, e.g. [[[0,0,0],[0.5,0.5,0.5]],[[0.25,0.25,0.25]]] where level-1 list = groups: one group for each equivalent atom

counts and coords = one list with the number of atoms of each type (one per entry in assignments) and a 2-level list of coordinates.

For assignments of atoms, etc. to sites:

assignments = abstract name for any representation of assignment of atoms. When returned, will be object of type Assignment.

atomic_numbers = a sequence of integers for the atomic number of each species

occupations = a sequence where the assignments are repeated for each coordinate as needed (prefixed with uc or rc depending on which coordinates)

For cell scaling:

scaling = abstract name for any representation of cell scaling

scale = multiply all basis vectors with this number

volume = rescaling the cell such that it takes this volume

For periodicity:

periodicity = abstract name of a representation of periodicity

pbc = ‘periodic boundary conditions’ = sequence of True and False for which basis vectors are periodic / non-periodic

nonperiodic_vecs = integer, number of basis vectors, counted from the first, which are non-periodic

For spacegroup:

spacegroup = abstract name for any spacegroup representation. When returned, is of type Spacegroup.

hall_symbol = specifically the hall_symbol string representation of the spacegroup

add_ref(ref)[source]
add_refs(refs)[source]
add_tag(tag, val)[source]
add_tags(tags)[source]
property anonymous_formula
property anonymous_wyckoff_sequence
property cc
property cc_formula_parts
clean()[source]
classmethod create(structure=None, assignments=None, rc_cell=None, rc_basis=None, rc_lengths=None, rc_angles=None, rc_cosangles=None, rc_niggli_matrix=None, rc_metric=None, rc_a=None, rc_b=None, rc_c=None, rc_alpha=None, rc_beta=None, rc_gamma=None, rc_sites=None, rc_reduced_coordgroups=None, rc_cartesian_coordgroups=None, rc_reduced_coords=None, rc_cartesian_coords=None, rc_reduced_occupationscoords=None, rc_cartesian_occupationscoords=None, rc_occupancies=None, rc_counts=None, wyckoff_symbols=None, multiplicities=None, spacegroup=None, hall_symbol=None, spacegroupnumber=None, setting=None, rc_scale=None, rc_scaling=None, rc_volume=None, uc_cell=None, uc_basis=None, uc_lengths=None, uc_angles=None, uc_cosangles=None, uc_niggli_matrix=None, uc_metric=None, uc_a=None, uc_b=None, uc_c=None, uc_alpha=None, uc_beta=None, uc_gamma=None, uc_sites=None, uc_reduced_coordgroups=None, uc_cartesian_coordgroups=None, uc_reduced_coords=None, uc_cartesian_coords=None, uc_reduced_occupationscoords=None, uc_cartesian_occupationscoords=None, uc_occupancies=None, uc_counts=None, uc_scale=None, uc_scaling=None, uc_volume=None, uc_is_primitive_cell=False, uc_is_conventional_cell=False, volume_per_atom=None, periodicity=None, nonperiodic_vecs=None, refs=None, tags=None)[source]

A Structure represents N sites of, e.g., atoms or ions, in any periodic or non-periodic arrangement.

This is a swiss-army-type constructor that allows a selection between a large number of optional arguments.

Note: if redundant and non-compatible information is given, the behavior is undefined. E.g., don’t try to call this with a structure + a volume in hopes to get a copy with rescaled volume.

To create a new structure, three primary components are:
  • cell: defines the basis vectors in which reduced coordinates are expressed, and the

    unit of repetition (if the structure has any periodicity - see the ‘periodicity’ parameter)

  • assignments: a list of ‘things’ (atoms, ions, etc.) that goes on the sites in the structure

  • sites: a sensible representation of location / coordinates of the sites.

Note: rc_-prefixes are consistently enforced for any quantity that would be different in a UnitcellStructure. This is to allow for painless change between the various structure-type objects without worrying about accidently using the wrong type of sites object.

Input parameters:

  • ONE OF: ‘cell’; ‘basis’, ‘length_and_angles’; ‘niggli_matrix’; ‘metric’; all of: a,b,c, alpha, beta, gamma. (cell requires a Cell object or a very specific format, so unless you know what you are doing, use one of the others.)

  • ONE OF: ‘assignments’, ‘atomic_numbers’, ‘occupancies’ (assignments requires an Assignments object or a sequence.), occupations repeats similar site assignments as needed

  • ONE OF: ‘rc_sites’, ‘rc_coords’ (IF rc_occupations OR rc_counts are also given), ‘uc_coords’ (IF uc_occupations OR uc_counts are also given) ‘rc_B_C’, where B=reduced or cartesian, C=coordgroups, coords, or occupationscoords

    Notes:

    • occupationscoords may differ from coords by order, since giving occupations as, e.g., [‘H’,’O’,’H’] does not necessarily have the same order of the coordinates as the format of counts+coords as (2,1), [‘H’,’O’].

    • rc_sites and uc_sites requires a Sites object or a very specific format, so unless you know what you are doing, use one of the others.)

  • ONE OF: scale or volume:

    scale = multiply the basis vectors with this scaling factor, volume = the representative (conventional) cell volume (overrides ‘scale’ if both are given) volume_per_atom = cell volume / number of atoms

  • ONE OF periodicity or nonperiodic_vecs

See help(Structure) for more information on the data format of all these data representations.

property element_wyckoff_sequence
property extended
property extensions
find_symmetry()[source]
property formula
property formula_counts
property formula_spaceseparated
property formula_symbols
get_refs()[source]
get_tag(tag)[source]
get_tags()[source]
property hall_symbol
property has_rc_repr

Returns True if the structure already contains the representative coordinates + spacegroup, and thus can be queried for this data without launching an expensive symmetry finder operation.

property has_uc_repr

Returns True if the structure contains any unit cell-type coordinate representation, and thus can be queried for this data without launching a somewhat expensive cell filling operation.

io
property number_of_elements
property pbc
property pc
property pc_a
property pc_alpha
property pc_b
property pc_beta
property pc_c
property pc_counts
property pc_formula_parts
property pc_gamma
property pc_nbr_atoms
property pc_volume
property rc
property rc_a
property rc_alpha
property rc_b
property rc_basis
property rc_beta
property rc_c
property rc_cartesian_coordgroups
property rc_cartesian_coords
property rc_cartesian_occupationscoords
property rc_cell_orientation
property rc_counts
property rc_gamma
property rc_lengths_and_angles
property rc_nbr_atoms
property rc_occupancies
property rc_occupationssymbols
property rc_reduced_coordgroups
property rc_reduced_coords
property rc_volume
property spacegroup
property spacegroup_number
property spacegroup_number_and_setting
supercell
property symbols
tidy()[source]
transform(matrix, max_search_cells=20, max_atoms=5000, force_hall_symbol=None)[source]
property uc
property uc_a
property uc_alpha
property uc_b
property uc_basis
property uc_beta
property uc_c
property uc_cartesian_coordgroups
property uc_cartesian_coords
property uc_cartesian_occupationscoords
property uc_cell
property uc_cell_orientation
property uc_counts
property uc_formula
property uc_formula_counts
property uc_formula_parts
property uc_formula_symbols
property uc_gamma
property uc_lengths_and_angles
property uc_nbr_atoms
property uc_occupancies
property uc_occupationssymbols
property uc_reduced_coordgroups
property uc_reduced_coords
property uc_reduced_occupationscoords
property uc_sites
property uc_volume
classmethod use(other)[source]
property volume_per_atom
property wyckoff_sequence
class httk.atomistic.structure.StructureRef(structure, reference)[source]

Bases: HttkObject

class httk.atomistic.structure.StructureTag(structure, tag, value)[source]

Bases: HttkObject

httk.atomistic.structure.main()[source]