mxtaltools.common.ase_interface

mxtaltools.common.ase_interface.ase_mol_from_crystaldata(crystal_batch, index: int = None, highlight_canonical_conformer: bool = False, mode=None, cutoff: float = 4, return_crystal: bool = False, highlight_mol_ind: bool = False)[source]

Extract an atomic structure from a Crystaldata object according to its batch index, and convert it into an ase mol object. Several options for visualization of crystals.

Parameters:
  • crystal_batch (Crystaldata object)

  • index (int, optional) – Batch index of Crystaldata object to extract. Default is None.

  • highlight_canonical_conformer (bool, optional) – Whether to give the canonical conformer a different atom type for color comparison.

  • mode ('conformer', 'unit cell', 'inside cell', 'convolve with', 'distance', or None (default None)) – Assuming the input Crystaldata is a molecule cluster larger than a single unit cell, we have several options to pare down to the desired visualization. ‘conformer’ : only the ‘canonical conformer’ ‘unit cell’ : all molecules with centroids inside the unit cell ‘inside cell’ : all atoms inside the unit cell ‘convolve with’ : all atoms within convolution range of the canonical conformer ‘distance’ : all atoms within a certain distance of the canonical conformer None : show all atoms in the crystal

  • cutoff (float, optional) – Distance fed to the ‘distance’ exclusion level option

  • return_crystal (bool, optional) – Whether to return an ase mol for the crystal. Does not always work properly. Ase does not understand our crystals correctly.

Return type:

ase mol object

mxtaltools.common.ase_interface.ase_write_cif(batch, inds, path, mode)[source]
mxtaltools.common.ase_interface.data_batch_to_ase_mols_list(crystaldata_batch, max_ind: int = inf, specific_inds=None, show_mols: bool = False, **kwargs)[source]

Helper function for converting Crystaldata batches into lists of ase objects.

Parameters:
  • crystaldata_batch – batch of Crystaldata objects

  • max_ind (int) – Maximum batch ind to include in the list

  • show_mols (bool) – whether to visualize the list of mol objects

Return type:

list of ase mol objects

mxtaltools.common.ase_interface.get_niggli_cell(crystal_batch, index, radians: bool = False)[source]