Project

General

Profile

Bug #316

g_msd returns incorect value of self-diffusion coefficient for ngroup > 1

Added by Borys Szefczyk over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
analysis tools
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

Created an attachment (id=362)
Correct (top) and incorrect (bottom) MSD function of CL-

The bug appeared in calculation of self-diffusion coefficient of CL- and NA+
ions in molten sodium chloride. Program g_msd run with following arguments:

g_msd -s nacl_6x6x6_nvt.tpr -f nacl_6x6x6_nvt.xtc -n unit_6x6x6.ndx -b 400 -o
msd_nvt_NA.xvg

Gives D[NA+] = 9.1153e-5 cm^2 / s
(only group NA+ has been selected)

Similar calculation for CL-:

g_msd -s nacl_6x6x6_nvt.tpr -f nacl_6x6x6_nvt.xtc -n unit_6x6x6.ndx -b 400 -o
msd_nvt_CL.xvg

Gives D[CL-] = 6.7572e-5 cm^2 / s
(only group CL- has been selected)

When the -ngroup switch is used:

g_msd -s nacl_6x6x6_nvt.tpr -f nacl_6x6x6_nvt.xtc -n unit_6x6x6.ndx -b 400 -o
msd_nvt.xvg -ngroup 2

g_msd produces results:
D[CL-] = 6.7572e-5 cm^2/s
D[NA+] = 3.6442e-5 cm^2/s
if CL- is selected first, or:
D[NA+] = 9.1153e-5 cm^2/s
D[CL-] = 2.4045e-5 cm^2/s
if NA+ is selected first.

In other words, only the first self-diffusion coefficient is calculated
properly.

Attached is the graphs showing correct MSD functions of NA+ and CL- and
incorrect function when -ngroup is used.

Hardware:

uname -a:
Linux swift 2.6.27-gentoo-r8 #9 SMP Mon Mar 30 21:42:39 WEST 2009 x86_64 Intel(R) Core(TM)2 Duo CPU P7450 @ 2.13GHz GenuineIntel GNU/Linux

Software:

gromacs 4.0.3
gcc 4.1.2
glibc 2.8_p20080602
fftw 3.1.2
atlas 3.8.0
openmpi 1.2.6

1.pdf (37.6 KB) 1.pdf Correct (top) and incorrect (bottom) MSD function of CL- Borys Szefczyk, 04/22/2009 11:50 AM
msd.png (99.8 KB) msd.png Correct (top) and incorrect (bottom) MSD function of CL- Borys Szefczyk, 04/22/2009 11:53 AM
input_files.tar (3.32 MB) input_files.tar Input files necessary to reproduce the bug Borys Szefczyk, 05/19/2009 11:45 AM

History

#1 Updated by Borys Szefczyk over 10 years ago

Created an attachment (id=363)
Correct (top) and incorrect (bottom) MSD function of CL-

This is an update to the first attachment.

#2 Updated by David van der Spoel over 10 years ago

Can you please upload the input files necessary to reproduce this?

#3 Updated by Borys Szefczyk over 10 years ago

Created an attachment (id=372)
Input files necessary to reproduce the bug

Commands to reproduce the bug:

g_msd s conf.gro -f traj.xtc -n index.ndx -o msd_CL.xvg
gives D(CL
) = 6.7570e-5 cm^2/s

g_msd -s conf.gro -f traj.xtc -n index.ndx -o msd_NA.xvg
gives D(NA+) = 9.1052e-5 cm^2/s

g_msd s conf.gro -f traj.xtc -n index.ndx -o msd.xvg -ngroup 2
gives:
D(CL
) = 6.7570e-5 cm^2/s
D(NA+) = -15.0590e-5 cm^2/s

Note that these files differ from the originals (they have been converted
with trjconv, to reduce the size), so the values are somewhat different than
originally reported, nevertheless, they reproduce the same bug.

#4 Updated by Orsolya Gereben over 10 years ago

Narrowing the problem: I got the same bad results for CsCl in water solution if more than one group is used for the second and third group the values are wrong. I tried to change the value of trestart, and it become clear, that the msd values of only those time values of the second and third group are wrongly calculated, which were calculated more than one time. For example in a calculation where tbegin=600 tend=2000 using trestart=1400 (only t=0 is calculated twice) only the t=0 value of Cl- and water is wrong
example output files: using ngroup=3

  1. This file was created Thu May 28 11:23:11 2009
  2. by the following command:
  3. g_msd -f cscl_7p5_swm4-dp_rig_md.trr -s cscl_7p5_swm4-dp_rig_md.tpr -trestart 1400 -ngroup 3 -b 600 -dt 20 -o cscl_7p5_swm4-dp_rig_md_r1400_msd #
  4. g_msd is part of G R O M A C S: #
  5. Gyas ROwers Mature At Cryogenic Speed #
    title "Mean Square Displacement"
    xaxis label "Time (ps)"
    @ yaxis label "MSD (nm\S2\N)"
    @TYPE xy
  6. MSD gathered over 1400 ps with 2 restarts
  7. Diffusion constants fitted from time 140 to 1260 ps
  8. D[ Cs+] = 0.9682 (+/- 0.2168) (1e-5 cm^2/s)
  9. D[ CL-] = 0.9966 (+/- 0.0586) (1e-5 cm^2/s)
  10. D[ SM2] = 1.6362 (+/- 0.0353) (1e-5 cm^2/s)
    0 0 10.6588 12.727
    20 0.149103 0.129572 0.216269
    40 0.28486 0.229662 0.394591
    60.0001 0.412598 0.337685 0.597476
    80.0001 0.556104 0.509343 0.78706
    100 0.674206 0.619935 0.994176
    120 0.829292 0.735593 1.20156
    140 0.948805 0.885058 1.3858
    160 1.07421 0.985154 1.56438

using ngroup=1 calculating only for water

  1. This file was created Thu May 28 11:24:31 2009
  2. by the following command:
  3. g_msd -f cscl_7p5_swm4-dp_rig_md.trr -s cscl_7p5_swm4-dp_rig_md.tpr -trestart 1400 -ngroup 1 -b 600 -dt 20 -o cscl_7p5_swm4-dp_rig_md_r1400_3_msd
  4. g_msd is part of G R O M A C S:
  5. GROup of MAchos and Cynical Suckers

  6. title "Mean Square Displacement"
    xaxis label "Time (ps)"
    @ yaxis label "MSD (nm\S2\N)"
    @TYPE xy
  7. MSD gathered over 1400 ps with 2 restarts
  8. Diffusion constants fitted from time 140 to 1260 ps
  9. D[ SM2] = 1.6362 (+/- 0.0353) (1e-5 cm^2/s)
    0 0
    20 0.216269
    40 0.394591
    60.0001 0.597476
    80.0001 0.78706
    100 0.994176
    120 1.20156
    140 1.3858
    160 1.56438

#5 Updated by David van der Spoel over 9 years ago

Sorry for the long delay. I tried using the latest development version:

g_msd -f traj.xtc -s conf -n -o koko -ngroup 2

and get

D[ CL-] 6.7570 (/- 0.1808) 1e-5 cm^2/s
D[ NA
] 9.1052 (+/- 0.1263) 1e-5 cm^2/s

If I run g_msd two times on one group at a time I get identical results.
However if I add the -dt flag things go wrong.

echo 2 | g_msd -f traj.xtc -s conf -n -o koko -dt 20

Fitting from 0 to 20 ps

Not enough points for fitting (2).
Can not determine the diffusion constant.

I have now disabled the -dt flag for g_msd.

Also available in: Atom PDF