mstk.wrapper.Packmol

class mstk.wrapper.Packmol(packmol_bin)

Wrapper for Packmol for building initial coordinates for simulation

Parameters:

packmol_bin (str) – Path of the packmol binary executable

Methods

__init__(packmol_bin)

build_box(files, numbers, output[, size, ...])

Build a box directly from molecule files.

gen_inp(files, numbers, output[, size, ...])

Generate input file for running packmol.

build_box(files, numbers, output, size=None, length=None, slab=None, slab_multiple=False, tolerance=0.2, seed=None, inp_file='build.inp', silent=False)

Build a box directly from molecule files.

Currently, rectangular box of following models are supported:

  • Homogeneous bulk liquid or gas model

  • Liquid-vapor interface model

  • Multi-component liquid-liquid interface model

The input molecule files can be in XYZ or PDB format. The format for all input files and output files should be the same.

Parameters:
  • files (list of str) – List of input XYZ or PDB files

  • numbers (list of int) – Numbers to be packed of each molecules

  • output (str) – File name of the ouput XYZ or PDB file

  • size (list of float, or None) – Size of the packed rectangular box, in unit of nanometer If not set, argument length should be provided.

  • length (float or None) – Length of the packed cubic box, in unit of nanometer If not set, argument size should be provided.

  • slab (float or None) – If a vapor-liquid interface model is to be packed, it gives the z-coordinates of the interface, in unit of nanometer It conflicts with argument slab_multiple.

  • slab_multiple (bool or None) – Set it to True if a liquid-liquid interface model is to be packed. It conflicts with argument slab.

  • tolerance (float) – The minimum distance between atoms belongs to different molecules, in unit of nanometer

  • seed (int or None) – The seed for randomizing positions. If not provided, a randomly generated seed will be used.

  • inp_file (str) – The input file for running packmol to be written.

  • silent (bool) – If set to True, packmol will run silently without writing output on the screen. The error message will still be written on the screen.

static gen_inp(files, numbers, output, size=None, length=None, slab=None, slab_multiple=False, tolerance=0.2, seed=None, inp_file='build.inp')

Generate input file for running packmol.

It is the same as build_box() except that packmol is not called after input file generated. See build_box() for the details of parameters.