get_packmol_input#

mbgdml.structure_gen.packmol_gen.get_packmol_input(shape, length_scale, mol_numbers, mol_paths, output_path=None, periodic=False, dist_tolerance=2.0, filetype='xyz', seed=-1, periodic_shift=1.0)[source]#

Packmol input file lines for a box containing one or more species.

Parameters:
  • shape (str) – Desired packmol shape. Supported options: sphere, box.

  • length_scale (float) –

    Relevant length scale in Angstroms for the packmol shape.

    • sphere: diameter;

    • box: side length.

  • mol_numbers (numpy.ndarray, ndim: 1) – Number of molecules for each species.

  • mol_paths (list of str) – Paths to xyz files for each species in the same order as mol_numbers.

  • output_path (str, default: None) – Path to save the xyz file. If None, then no output line is included.

  • periodic (bool, default: False) – Will periodic boundary conditions be used?

  • dist_tolerance (bool, default: 2.0) – The minimum distance between pairs of atoms of different molecules.

  • filetype (str, default: xyz) – Packmol output format.

  • seed (int, default: -1) – Random number generator seed. If equal to -1 then a random seed is generated.

  • periodic_shift (float, default: 1.0) – Reduce the length scale by this much in Angstroms on all sides. This means periodic images will be 2.0 Angstroms apart (with the default value).

Examples

>>> shape = "box"
>>> length_scale = 10.0
>>> num_mols = np.array([33], dtype=np.uint16)
>>> mol_paths = "./1h2o.xyz"
>>> packmol_box_input(
... shape, length_scale, num_mols, mol_paths, periodic=True
... )
['tolerance 2.0\n', 'filetype xyz\n\n', 'structure ./1h2o.xyz\n',
'    number 33\n', '    inside box 1.0 1.0 1.0 9.0 9.0 9.0\n', 'end structure\n\n']