Re: [AMBER] time step changes during long simulation run

From: Jason Swails <jason.swails.gmail.com>
Date: Tue, 4 Oct 2016 09:21:55 -0400

On Tue, Oct 4, 2016 at 8:48 AM, Hirdesh Kumar <hirdesh.iitd.gmail.com>
wrote:

> Hi,
> I am doing a long simulation of my protein-ligand complex. In the out file,
> the time step was written as:
> TIME(PS) = 335980.000 (note XXX.000 format)..
>
>
> NSTEP =139790000 *TIME(PS) = 335980.000* TEMP(K) = 298.18 PRESS
> = 15.6
> Etot = -115980.9003 EKtot = 27977.8633 EPtot =
> -143958.7636
> BOND = 1085.4143 ANGLE = 2911.4185 DIHED =
> 4565.4169
> 1-4 NB = 1346.0456 1-4 EEL = 14330.8565 VDWAALS =
> 16001.0010
> EELEC = -184198.9163 EHBOND = 0.0000 RESTRAINT =
> 0.0000
> EKCMT = 12017.9146 VIRIAL = 11864.6655 VOLUME =
> 455008.3585
> Density =
> 1.0337
> ------------------------------------------------------------
> ------------------
>
> wrapping first mol.: -27.96280 -39.54537 68.49461
>
> NSTEP =139795000 *TIME(PS) = 335990.000* TEMP(K) = 299.93 PRESS =
> -246.6
> Etot = -116468.7242 EKtot = 28142.6172 EPtot =
> -144611.3414
> BOND = 1094.3586 ANGLE = 2907.2089 DIHED =
> 4540.0461
> 1-4 NB = 1310.6156 1-4 EEL = 14286.1251 VDWAALS =
> 16100.2964
> EELEC = -184849.9921 EHBOND = 0.0000 RESTRAINT =
> 0.0000
> EKCMT = 12061.4866 VIRIAL = 14481.3696 VOLUME =
> 454452.8877
> Density =
> 1.0350
> ------------------------------------------------------------
> ------------------
>
> wrapping first mol.: -27.97826 -39.56723 68.53246
> wrapping first mol.: -27.97826 -39.56723 68.53246
>
> NSTEP =139800000 *TIME(PS) = 335999.999 * TEMP(K) = 297.37 PRESS
> = 2.1
> Etot = -116224.6694 EKtot = 27902.1836 EPtot =
> -144126.8530
> BOND = 1077.4677 ANGLE = 2884.7374 DIHED =
> 4519.3357
> 1-4 NB = 1305.2631 1-4 EEL = 14371.2153 VDWAALS =
> 15909.1364
> EELEC = -184194.0086 EHBOND = 0.0000 RESTRAINT =
> 0.0000
> EKCMT = 11897.3296 VIRIAL = 11876.4293 VOLUME =
> 455201.7252
> Density =
> 1.0333
> ------------------------------------------------------------
> ------------------
>
> wrapping first mol.: -27.98357 -39.57475 68.54548
>
>
>
>
> As you can see the output was saved at every 10ps. And after 335990.000
> ps, the expected next line should be:
>
> TIME(PS) = 330000.000 PS. But, it was written as TIME(PS) = 335999.999..
>
> This point onward, the output is always in ***.999 format, which is new to
> me. I checked the trajectories and the system looks fine.
>
> Is it the normal behaviour or there is something wrong ?
>

​This is normal. It is basic round-off error. The primary time unit is
picoseconds, but your time-step is on the order of femtoseconds -- 0.001 or
0.002 ps. However, both 0.001 and 0.002 are repeating decimals in binary
(which is how computers store numbers), which means that those two numbers
are *impossible* to represent exactly by a simple floating point variable.​
 So to the computer, the time step is *very close* to 0.001 or 0.002
(whichever you chose), but not exactly the same. If you add that
difference up 330,000,000 times (or 165,000,000 times for a 2 fs time
step), you get something close to 0.001.

​At that point, the difference appears in the representation of the number
in the output file.

HTH,​
Jason

P.S., you can demonstrate this with your own program. Here is a C program
that illustrates exactly what's happening:

#include <stdio.h>

int main() {
    const double dt = 0.002;
    double t = 0;
    long long int i;

    for (i = 0; i < 165000000; i++) {
        t += dt;
    }
    printf("t = %.4f\n", t);

    return 0;
}

When I compile this program ("gcc test.c") and run the resulting a.out file
("./a.out"), I see the following output:

$ gcc test.c
$ ./a.out
t = 329999.9996

-- 
Jason M. Swails
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Tue Oct 04 2016 - 06:30:02 PDT
Custom Search