pyxtal.molecular_crystal module

Module for generating molecular crystals

class pyxtal.molecular_crystal.molecular_crystal(dim, group, molecules, numMols, factor=1.1, thickness=None, area=None, lattice=None, torsions=None, tm=<pyxtal.tolerance.Tol_matrix object>, sites=None, conventional=True, seed=None, use_hall=False)[source]

Bases: object

Class for storing and generating molecular crystals based on symmetry constraints. Based on the crystal.random_crystal class for atomic crystals. Given a spacegroup, list of molecule objects, molecular stoichiometry, and a volume factor, generates a molecular crystal consistent with the given constraints.

  • dim – dimenion (1, 2, 3)

  • group – the group number (1-75, 1-80, 1-230)

  • molecules – a list of pymatgen.core.structure.Molecule objects for each type of molecule. Alternatively, you may supply a file path, or the name of molecules from the built_in database

  • numMols – A list of the number of each type of molecule within the primitive cell (NOT the conventioal cell)

  • factor – A volume factor used to generate a larger or smaller unit cell. Increasing this gives extra space between molecules

  • lattice (optional) – the Lattice object to define the unit cell

  • conventional (optional) – count the atomic numbers in a conventional cell

  • tm (optional) – the Tol_matrix object to define the distances

  • sites (optional) – pre-assigned wyckoff sites (e.g., [[“4a”], [“2b”]])

  • seed (optional) – seeds

  • use_hall – False


The main code to generate a random molecular crystal. If successful, self.valid is True


Generate the initial lattice

set_molecules(molecules, torsions)[source]

Get molecular information

  • molecules – list of molecules

  • torsions – list of torsions


Calculates the valid orientations for each Molecule and Wyckoff position. Returns a list with 4 indices:

  • index 1: the molecular prototype’s index within self.molecules

  • index 2: the WP’s 1st index (based on multiplicity)

  • index 3: the WP’s 2nd index (within the group of same multiplicity)

  • index 4: the index of a valid orientation for the molecule/WP pair

For example, self.valid_orientations[i][j][k] would be a list of valid orientations for self.molecules[i], in the Wyckoff position[j][k]


initialize Wyckoff sites


sites – list


Given the molecular stoichiometry, estimate the volume for a unit cell.