PACKMOL¶
generate_solvent_with_packmol(gro_solvent_mol, box_length, output_pdb, packmol_input_file='packmol.inp')
¶
Generates a solvent box with specified dimensions using PACKMOL.
This function converts a GROMACS .gro file of a solvent molecule to a .pdb file, calculates the number of molecules needed to fill a box of the given volume, and generates a PACKMOL input file to create a solvent box. The function then returns the command to run PACKMOL with the generated input file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gro_solvent_mol |
str
|
Path to the .gro file of the solvent molecule. |
required |
box_length |
float
|
Length of the cubic box in nm to be filled with solvent molecules. |
required |
output_pdb |
str
|
Path where the output .pdb file containing the solvent box should be saved. |
required |
packmol_input_file |
str
|
Path to the PACKMOL input file to be generated. Defaults to "packmol.inp". |
'packmol.inp'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The command to run PACKMOL with the generated input file. |
Note
PACKMOL must be installed and accessible from the command line to execute the returned command successfully.
Source code in martignac/utils/packmol.py
place_solute_in_solvent_with_packmol(gro_solute, gro_solvent, output_pdb, restraint_along_x=None, restraint_along_y=None, restraint_along_z=None, restraint_std_dev=1.0, packmol_input_file='packmol.inp')
¶
Places a solute molecule within a solvent box using PACKMOL with optional positional restraints.
This function prepares a PACKMOL input file to place a solute molecule within a pre-existing solvent box, allowing for the specification of positional restraints along the x, y, and z axes. This can be particularly useful for simulations where the solute needs to be positioned at a specific location within the solvent box, such as near a surface or interface. The function returns the command to run PACKMOL with the generated input file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gro_solute |
str
|
Path to the .gro file of the solute molecule. |
required |
gro_solvent |
str
|
Path to the .gro file of the solvent box. |
required |
output_pdb |
str
|
Path where the output .pdb file, containing both solute and solvent, should be saved. |
required |
restraint_along_x |
Optional[float]
|
Optional x-coordinate to restrain the solute molecule along the x-axis. |
None
|
restraint_along_y |
Optional[float]
|
Optional y-coordinate to restrain the solute molecule along the y-axis. |
None
|
restraint_along_z |
Optional[float]
|
Optional z-coordinate to restrain the solute molecule along the z-axis. |
None
|
restraint_std_dev |
float
|
Standard deviation for the positional restraint, defining the allowed fluctuation range. |
1.0
|
packmol_input_file |
str
|
Path to the PACKMOL input file to be generated. Defaults to "packmol.inp". |
'packmol.inp'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The command to run PACKMOL with the generated input file. |
Note
PACKMOL must be installed and accessible from the command line to execute the returned command successfully.