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, random_state=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.

Parameters:
  • 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

set_crystal()[source]

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

set_lattice(lattice)[source]

Generate the initial lattice

set_molecules(molecules, torsions)[source]

Initialize and store molecular information.

This function processes a list of molecules and initializes each one as a pyxtal_molecule object. If torsions are provided, they are applied to the respective molecules during initialization. It stored information in the self.molecules attribute.

Parameters:
  • molecules (list) – A list of molecules, where each entry can either be: - A SMILES string or file path representing a molecule. - An already-initialized pyxtal_molecule object.

  • torsions (list) – A list of torsion angles. The length of torsions must be equal to the length of molecules, or None can be provided if no torsions are needed.

set_orientations()[source]

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 self.group.wyckoffs_organized[j][k]

set_sites(sites)[source]

Initialize and store symmetry sites for each molecule.

This function processes a list of symmetry sites, validates them against the expected number of molecules, and stores them in the self.sites dictionary. Each entry in the sites list can be either a dictionary or another type (list, etc.), and if no valid site is provided for a molecule, None is assigned for that molecule’s site.

Parameters:

sites (list) –

A list of sites corresponding to self.molecules. They can be: - A dictionary of site information (keys represent Wyckoff letters or

other identifiers, and values are the corresponding information).

  • A list or other type representing site information.

  • None, if no symmetry site information is available for that molecule.

set_volume()[source]

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