Bug #1747

gmx solvate clobbers (not given as a command line input)

Added by Chris Neale over 5 years ago. Updated over 5 years ago.

preprocessing (pdb2gmx,grompp)
Target version:
Affected version - extra info:
all since 3.3 or earlier
Affected version:


gromacs 5.0.5 gmx solvate seems to create its own file called, which causes any existing to be moved to . The original file is not lost, but this is unexpected and (so far as I know) undocumented behaviour. I suggest that if gmx solvate needs to create a temporary .top file then this should ideally be a guaranteed unused filename, or at the very least something much more unlikely to be in use than Details from a test demonstration follow.

$ ls


$ cat empty.gro 
5 5 5


$ cat 
; Include forcefield parameters
#include "charmm27.ff/forcefield.itp" 

; Include water topology
#include "charmm27.ff/tips3p.itp" 

; Position restraint for each water oxygen
[ position_restraints ]
;  i funct       fcx        fcy        fcz
   1    1       1000       1000       1000

; Include topology for ions
#include "charmm27.ff/ions.itp" 

[ system ]
; Name
Gnomes, ROck Monsters And Chili Sauce

[ molecules ]
; Compound        #mols


$ gmx solvate -cp empty.gro -cs spc216.gro -p -o waterbox.gro
GROMACS:    gmx solvate, VERSION 5.0.5

GROMACS is written by:
Emile Apol         Rossen Apostolov   Herman J.C. Berendsen Par Bjelkmar       
Aldert van Buuren  Rudi van Drunen    Anton Feenstra     Sebastian Fritsch  
Gerrit Groenhof    Christoph Junghans Peter Kasson       Carsten Kutzner    
Per Larsson        Justin A. Lemkul   Magnus Lundborg    Pieter Meulenhoff  
Erik Marklund      Teemu Murtola      Szilard Pall       Sander Pronk       
Roland Schulz      Alexey Shvetsov    Michael Shirts     Alfons Sijbers     
Peter Tieleman     Christian Wennberg Maarten Wolf       
and the project leaders:
Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

Copyright (c) 1991-2000, University of Groningen, The Netherlands.
Copyright (c) 2001-2014, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out for more information.

GROMACS is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

GROMACS:      gmx solvate, VERSION 5.0.5
Executable:   /project2/p/pomes/cneale/GPC/exe/intel/gromacs-5.0.5/exec_serial/bin/gmx
Library dir:  /project2/p/pomes/cneale/GPC/exe/intel/gromacs-5.0.5/exec_serial/share/gromacs/top
Command line:
  gmx solvate -cp empty.gro -cs spc216.gro -p -o waterbox.gro

Reading solute configuration
Warning: Number of atoms in empty.gro is 0
Containing 0 atoms in 0 residues
Initialising inter-atomic distances...
Note: no atoms in empty.gro
Reading solvent configuration
"216H2O,WATJP01,SPC216,SPC-MODEL,300K,BOX(M)=1.86206NM,WFVG,MAR. 1984" 
solvent configuration contains 648 atoms in 216 residues

Initialising inter-atomic distances...

WARNING: Masses and atomic (Van der Waals) radii will be guessed
         based on residue and atom names, since they could not be
         definitively assigned from the information in your input
         files. These guessed numbers might deviate from the mass
         and radius of the atom type. Please check the output
         files if necessary.

NOTE: From version 5.0 gmx uses the Van der Waals radii
from the source below. This means the results may be different
compared to previous GROMACS versions.

A. Bondi
van der Waals Volumes and Radii
J. Phys. Chem. 68 (1964) pp. 441-451
-------- -------- --- Thank You --- -------- --------

Will generate new solvent configuration of 3x3x3 boxes
Generating configuration
Sorting configuration
Found 1 molecule type:
    SOL (   3 atoms):  5832 residues
Calculating Overlap...
box_margin = 0.25992
Removed 3393 atoms that were outside the box
Neighborsearching with a cut-off of 0.25992

NOTE: This file uses the deprecated 'group' cutoff_scheme. This will be
removed in a future release when 'verlet' supports all interaction forms.

NOTE: This file uses the deprecated 'group' cutoff_scheme. This will be
removed in a future release when 'verlet' supports all interaction forms.

Table routines are used for coulomb: FALSE
Table routines are used for vdw:     FALSE
Cut-off's:   NS: 0.25992   Coulomb: 0.25992   LJ: 0.25992
System total charge: 0.000
Potential shift: LJ r^-12: 0.000e+00 r^-6: 0.000e+00, Coulomb 0e+00

Grid: 19 x 19 x 19 cells
Successfully made neighbourlist
nri = 19811, nrj = 130088
Checking Protein-Solvent overlap: tested 0 pairs, removed 0 atoms.
Checking Solvent-Solvent overlap: tested 14524 pairs, removed 1881 atoms.
Added 4074 molecules
Generated solvent containing 12222 atoms in 4074 residues
Writing generated configuration to waterbox.gro

Output configuration contains 12222 atoms in 4074 residues
Volume                 :         125 (nm^3)
Density                :     974.999 (g/l)
Number of SOL molecules:   4074   

Processing topology

Back Off! I just backed up to ./
Adding line for 4074 solvent molecules to topology file (

Back Off! I just backed up to ./

gcq#6: "It's So Lonely When You Don't Even Know Yourself" (Red Hot Chili Peppers)


Note that has been backed up by the above command. However, whatever gmx solvate created in is now gone:

$ ls
ls: cannot access No such file or directory

Thank you,

Associated revisions

Revision 4b1e5a18 (diff)
Added by Mark Abraham over 5 years ago

Fix use of hard-coded temporary filename

Using can run into a user file of the same name, which is
unfriendly. Instead, use the function we have for doing the job of
making a temporary filename.

Fixes #1747

Change-Id: Ia6266e5605dd14032743e11f5dc68a520c47ce06


#1 Updated by Mark Abraham over 5 years ago

  • Description updated (diff)

#2 Updated by Gerrit Code Review Bot over 5 years ago

Gerrit received a related patchset '1' for Issue #1747.
Uploader: Mark Abraham ()
Change-Id: Ia6266e5605dd14032743e11f5dc68a520c47ce06
Gerrit URL:

#3 Updated by Mark Abraham over 5 years ago

  • Status changed from New to Fix uploaded
  • Assignee set to Mark Abraham
  • Target version set to 5.0.6

Thanks for the report.

This and some other tools have used the name "" (since pre-3.3 GROMACS) as the intermediate file for the new This is not good, so changed it to do something nicer.

#4 Updated by Mark Abraham over 5 years ago

  • Tracker changed from Feature to Bug
  • Affected version - extra info set to all since 3.3 or earlier
  • Affected version set to 5.0.5

#5 Updated by Mark Abraham over 5 years ago

  • Status changed from Fix uploaded to Closed

Also available in: Atom PDF