GROMACS¶
generate_lambdas(num_sim, turn_off_coulomb=False)
¶
Generates van der Waals and Coulomb lambda schedules for Gromacs alchemical transformations.
Parameters: - num_sim (int): Number of state points. - turn_off_coulomb (bool): If True, Coulomb interactions are turned off and the schedule is dedicated to vdw.
Returns: - Tuple[List[float], List[float]]: Lambda schedules for van der Waals and Coulomb interactions.
Source code in martignac/utils/gromacs.py
generate_solvent_with_gromacs(gro_solvent_mol, box_length, output_name='solvent', scale=0.1)
¶
Generates a command to solvate a given solvent molecule file using GROMACS.
This function constructs a command for the GROMACS 'solvate' tool, which is used to solvate a given solvent molecule file within a cubic box of a specified length. The density of the solvent can be adjusted using the scale parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gro_solvent_mol |
str
|
The path to the GRO file of the solvent molecules. |
required |
box_length |
float
|
The length of each side of the cubic box in which the solvent molecules will be placed, in nm. |
required |
output_name |
str
|
The base name for the output GRO file. Defaults to "solvent". |
'solvent'
|
scale |
float
|
The scaling factor for adjusting the density of the solvent. Defaults to 0.1. |
0.1
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The command to execute in GROMACS to generate the solvated system. |
Source code in martignac/utils/gromacs.py
gromacs_simulation_command(mdp, top, gro, name, n_max_warn=10, n_threads=1, verbose=True)
¶
Prepares and executes a molecular dynamics simulation using GROMACS.
This function generates the necessary commands to prepare (grompp) and run (mdrun) a simulation in GROMACS. It allows for specifying the input files, the number of threads, and whether to run in verbose mode. The function combines the preparation and execution steps into a single command, facilitating streamlined execution of simulations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mdp |
str
|
The path to the MDP file containing the simulation parameters. |
required |
top |
str
|
The path to the topology file for the system. |
required |
gro |
str
|
The path to the GRO file containing the system's initial structure. |
required |
name |
str
|
The base name for the output files. |
required |
n_max_warn |
int
|
The maximum number of allowed warnings during the preparation step. Defaults to 10. |
10
|
n_threads |
int
|
The number of threads to use for the simulation. Defaults to 1. |
1
|
verbose |
bool
|
If True, runs the simulation in verbose mode. Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The command to execute in GROMACS that combines the preparation and execution steps. |
Source code in martignac/utils/gromacs.py
run_gmx_wham(tpr_files, pullf_files, output_profile, output_hist, output_bstrap, output_bsprof, num_boostrap=100, unit='kT', z_min=0.0, z_max=5.0)
¶
Generates a command to perform Weighted Histogram Analysis Method (WHAM) analysis using GROMACS.
This function constructs a command for the GROMACS 'wham' tool, which is used to analyze the results of simulations, particularly for calculating free energy landscapes from umbrella sampling simulations. It supports specifying multiple input files for tpr and pullf files, outputting various analysis results, and setting the number of bootstrap analyses to improve statistical reliability.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tpr_files |
str
|
The path to the text file containing a list of TPR files for the analysis. |
required |
pullf_files |
str
|
The path to the text file containing a list of pull force files for the analysis. |
required |
output_profile |
str
|
The path for the output free energy profile. |
required |
output_hist |
str
|
The path for the output histogram file. |
required |
output_bstrap |
str
|
The path for the output bootstrap results file. |
required |
output_bsprof |
str
|
The path for the output bootstrap profile file. |
required |
num_boostrap |
int
|
The number of bootstrap analyses to perform. Defaults to 100. |
100
|
unit |
str
|
The unit for the free energy calculation. Defaults to "kT". |
'kT'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The command to execute in GROMACS for WHAM analysis. |
Source code in martignac/utils/gromacs.py
solvate_solute_command(gro_solute, gro_solvent, top_solute, top_output='topol.top', output_name='solvate')
¶
Generates a command to solvate a solute with a given solvent using GROMACS.
This function constructs a command for the GROMACS 'solvate' tool, which is used to combine a solute and solvent in a simulation box. The dimensions of the box are extracted from the solvent .gro file. It also updates the topology file to include the solvent molecules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gro_solute |
str
|
The path to the GRO file of the solute. |
required |
gro_solvent |
str
|
The path to the GRO file of the solvent molecules. |
required |
top_solute |
str
|
The path to the topology file of the solute. |
required |
top_output |
str
|
The path for the output topology file. Defaults to "topol.top". |
'topol.top'
|
output_name |
str
|
The base name for the output GRO file. Defaults to "solvate". |
'solvate'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The command to execute in GROMACS to solvate the solute with the solvent. |