pymatgen.io.lammps.utils module

class LammpsRunner(input_filename='lammps.in', bin='lammps')[source]

Bases: object

LAMMPS wrapper

Parameters:
  • input_filename (string) – input file name
  • bin (string) – command to run, excluding the input file name
run()[source]

Write the input/data files and run LAMMPS.

class PackmolRunner(mols, param_list, input_file='pack.inp', tolerance=2.0, filetype='xyz', control_params={'maxit': 20, 'nloop': 600}, auto_box=True, output_file='packed.xyz', bin='packmol')[source]

Bases: object

Wrapper for the Packmol software that can be used to pack various types of molecules into a one single unit.

Parameters:
  • mols – list of Molecules to pack
  • input_file – name of the packmol input file
  • tolerance – min distance between the atoms
  • filetype – input/output structure file type
  • control_params – packmol control parameters dictionary. Basically all parameters other than structure/atoms
  • param_list – list of parameters containing dicts for each molecule
  • auto_box – put the molecule assembly in a box
  • output_file – output file name. The extension will be adjusted according to the filetype
convert_obatoms_to_molecule(atoms, residue_name=None, site_property='ff_map')[source]

Convert list of openbabel atoms to MOlecule.

Parameters:
  • atoms ([OBAtom]) – list of OBAtom objects
  • residue_name (str) – the key in self.map_residue_to_mol. Usec to restore the site properties in the final packed molecule.
  • site_property (str) – the site property to be restored.
Returns:

Molecule object

restore_site_properties(site_property='ff_map', filename=None)[source]

Restore the site properties for the final packed molecule.

Parameters:
  • site_property (str) –
  • filename (str) – path to the final packed molecule.
Returns:

Molecule

run(copy_to_current_on_exit=False, site_property=None)[source]

Write the input file to the scratch directory, run packmol and return the packed molecule.

Parameters:
  • copy_to_current_on_exit (bool) – Whether or not to copy the packmol input/output files from the scratch directory to the current directory.
  • site_property (str) – if set then the specified site property for the the final packed molecule will be restored.
Returns:

Molecule object

write_pdb(mol, filename, name=None, num=None)[source]

dump the molecule into pdb file with custom residue name and number.

class Polymer(start_monomer, s_head, s_tail, monomer, head, tail, end_monomer, e_head, e_tail, n_units, link_distance=1.0, linear_chain=False)[source]

Bases: object

Generate polymer chain via Random walk. At each position there are a total of 5 possible moves(excluding the previous direction).

Parameters:
  • start_monomer (Molecule) – Starting molecule
  • s_head (int) – starting atom index of the start_monomer molecule
  • s_tail (int) – tail atom index of the start_monomer
  • monomer (Molecule) – The monomer
  • head (int) – index of the atom in the monomer that forms the head
  • tail (int) – tail atom index. monomers will be connected from tail to head
  • end_monomer (Molecule) – Terminal molecule
  • e_head (int) – starting atom index of the end_monomer molecule
  • e_tail (int) – tail atom index of the end_monomer
  • n_units (int) – number of monomer units excluding the start and terminal molecules
  • link_distance (float) – distance between consecutive monomers
  • linear_chain (bool) – linear or random walk polymer chain