pymatgen.analysis.fragmenter module

class Fragmenter(molecule, edges=None, depth=1, open_rings=True, opt_steps=10000)[source]

Bases: monty.json.MSONable

Standard constructor for molecule fragmentation

Parameters:
  • molecule (Molecule) – The molecule to fragment
  • edges (list) – List of index pairs that define graph edges, aka molecule bonds. If not set, edges will be determined with OpenBabel.
  • depth (int) – The number of levels of iterative fragmentation to perform, where each level will include fragments obtained by breaking one bond of a fragment one level up. Defaults to 1. However, if set to 0, instead all possible fragments are generated using an alternative, non-iterative scheme.
  • open_rings (bool) – Whether or not to open any rings encountered during fragmentation. Defaults to False. If true, any bond that fails to yield disconnected graphs when broken is instead removed and the entire structure is optimized with OpenBabel in order to obtain a good initial guess for an opened geometry that can then be put back into QChem to be optimized without the ring just reforming.
  • opt_steps (int) – Number of optimization steps when opening rings. Defaults to 1000.
open_ring(mol_graph, bond, opt_steps)[source]

Function to actually open a ring using OpenBabel’s local opt. Given a molecule graph and a bond, convert the molecule graph into an OpenBabel molecule, remove the given bond, perform the local opt with the number of steps determined by self.steps, and then convert the resulting structure back into a molecule graph to be returned.