principia_materia.translation_group package

Submodules

Module contents

principia_materia.translation_group.fit_in_supercell(qpoint, supa, decimal=6)

Check if q-point fit in a supercell.

Parameters:
  • qpoint (array of floats of Fraction, shape (dim, ) or (N, ..., N', dim)) – qpoint(s) to check the fit.

  • supa (array of int, shape(dim, dim)) – Supercell matrix.

  • decimal (int, optional, default to 6) – Decimal points for tolerance.

Returns:

fit – Whether the q-point(s) fit in the given supercell.

Return type:

bool or array of bool

principia_materia.translation_group.get_structure(inp=None, vec=None, pg=None, supa=None, atoms=None, orbitals=None, scale=None, strict_symmetry=False, lattice_coordinate=True, tol=1e-06, stype='auto', copy=False)

Construct a translation group object based on input data.

There are several types of inputs accepted:

  1. If a translation group object (i.e. an object of type Lattice/LatticeFTG/Cluster/Kpoints/Crystal/CrystalFTG) is passed in as inp, it will return the object back directly, or return a copy of the object if copy==True.

  2. If A YAML file containing information to construct the object, is passed in as inp, it will be parsed and its content will be used to construct the object.

  3. The key information of the object can be directly passed in.

The keyword stype determines which type of the translation group object to construct. It can be set to each of the translation group type, or “auto”. If stype is not “auto” input type 1 is used, it will check if the input object is an instance of stype.

If stype==auto, and input type 2 or 3 is passed in, then the type of object to construct will be determined using the following rule:

  1. If vec is provided (either in YAML file or in arguments), and atoms, supa are missing, Lattice will be constructed.

  2. If vec and supa are provided and pg, atoms, are missing, LatticeFTG will be constructed.

  3. If vec, supa and pg are provided and atoms, are missing, Kpoints will be constructed.

  4. If atoms is provided and vec, supa are missing, Cluster will be constructed.

  5. If vec, atoms are provided and supa is missing, Crystal will be constructed.

  6. If vec, atoms and supa are all provided, CrystalFTG will be constructed.

In cases 1, 4, 5, 6 pg is optional, and in cases 4, 5, 6 orbitals is optional.

Parameters:
  • inp (str or translation group object, default to None) – A YAML file/YAML string containing information to construct the translation group object, or a translation group object. If inp is provided, vec, pg, supa, atoms, orbitals should not be provided through the arguments, vice versa.

  • vec (arrays of float, shape(dim, dim), default to None) – The lattice vectors, in row convention.

  • pg (str or PointGroup object, default to None) – The point group of the lattice.

  • supa (array of int, shape(dim, dim), default to None) – Super lattice matrix.

  • atoms (dict (preferably ordered), with str as keys and array of float as values, default None) – A dictionary of names of atoms and their positions.

  • orbitals (str or list of str or nested list of str, default to None) – Orbital names to assign to the atoms.

  • scale (float or array of float with shape of (dim, ), default to None) – Scale the lattice vectors.

  • strict_symmetry (bool, optional, default to False) – In case of LatticeFTG or Kpoints, whether to allow points be rotated out of the given grid.

  • lattice_coordinate (bool, optional, default to True) – In case of Crystal or CrystalFTG, the positions are in lattice coordinate if lattice_coordinate==True, otherwise they are in cartesian coordinate.

  • tol (float, optional, default to 1.0E-6) – Tolerance threshold.

  • stype (str or traslation group types, optional, default to "auto") – The type of translation group object to construct.

  • copy (bool, optional, default to False) – In the case when inp is a translation group object, whether to return the object directly or a copy of it.

Examples

>>> struct = get_structure("structure.yml")
>>> type(struct)
<class 'principia_materia.translation_group.crystal_ftg.CrystalFTG'>
>>> print(struct.to_dict())
OrderedDict([('vec', array([[2., 0., 0.],
       [0., 2., 0.],
       [0., 0., 2.]])), ('atoms', OrderedDict([('H', array([[0., 0., 0.]])), ('He', array([[0.25, 0.25, 0.25],
       [0.75, 0.75, 0.75]]))])), ('orbitals', ['s', 'd', 'p']), ('supa', array([[2, 0, 0],
       [0, 2, 0],
       [0, 0, 1]]))])
principia_materia.translation_group.register_structure_datawrapper_type(wrapper)
principia_materia.translation_group.register_structure_hdf5wrapper_type(wrapper)
principia_materia.translation_group.save_structure(structure, file=None, use_config=False)

Save structure object into YAML file.

Parameters:
  • structure (Lattice, Cluster, LatticeFTG, Crystal, Kpoints or CrystalFTG object) – A structure object to save.

  • file (str, optional, default to None) – The file to save YAML string into, if None return the string.