gmx solvate only updates topology when the solvent is "SOL"
"gmx solvate -p" only updates topology when the solvent is "SOL". It would be nice to add this feature for other solvents as well.
For example, compare that it works for SOL:
echo 3 3 3
} > empty.gro
gmx solvate -cp empty.gro -cs spc216.gro -p empty.top -o out.gro
- now empty.top lists the number of SOL added.
However, when I instead try:
gmx solvate -cp empty.gro -cs ./methanol5ns.gro -p empty.top -o out.gro
then the out.gro output is as expected but the lines are not added to the .top file as desired.
Note that the following output from gmx solvate indicates that the necessary information is already known by the program that the molecule is MEOH and 354 such residues were added.
Found 1 molecule type:
MEOH ( 6 atoms): 354 residues
Generated solvent containing 2124 atoms in 354 residues
Writing generated configuration to out.gro
Output configuration contains 2124 atoms in 354 residues
Volume : 27 (nm^3)
Density : 741.494 (g/l)
Number of SOL molecules: 0
I have included a charmm methanol .itp and .gro for reproduction, but you don't even need that. Just take share/gromacs/top/spc216.gro and change all "SOL" to some other name and again gmx solvate will fail to update the topology.
Fix gmx solvate topology updating
The topology update of gmx solvate was hardcoded to SOL molecules
(and some of the reported quantities also registered HOH and WAT).
Changed to allow updates based on any solvent molecule information.
Also, now allows for updates with multiple solvent molecule types
in the input solvent configuration
Added test case for topology update with multiple solvents
#1 Updated by Pedro Lacerda almost 4 years ago
Something like the following non-working patch may do the job. The solvent name is hard-coded in solvate.cpp. Simply get the name from the first molecule in the solvent structure. It works only for a single molecule solvent.
I did not verify but there is a hard-coded distance frequency to put the solvent in the box. If there is a empty region between two solvent molecules because the hard-coded distance is too great, or the program failed to acquire the correct one from solvent structure, the program will results in a defective structure with empty regions between solvent molecules. The scheme to remove overlapping molecules does not apply of course, except if the `defaultDistance` is too low.