Wanting to get synchronized trajectories

54 views
Skip to first unread message

Abdullah Bin Faheem

unread,
Mar 26, 2020, 8:19:00 AM3/26/20
to cp2k
Hello everyone, 

I had a question regarding AIMD. Is it possible to get the same xyz coordinates from two parallel runs with the same input files and starting coordinates?
What I mean is that can Run 1 and Run 2 produce the same xyz coordinates? 
As when I do that using the same input files for both, the difference in xyz coordinates increases as time passes, which is something I do not want to happen.

I have attached the sample input files.

Thank you for your time.

Regards,
Abdullah Bin Faheem
input.rar

Noam Bernstein

unread,
Mar 26, 2020, 8:51:57 AM3/26/20
to cp...@googlegroups.com
If you’re using an algorithm with a random component, e.g. Langevin, you need to set the same &GLOBAL&SEED.

Floating point math operations are not associative, so you can also try &GLOBAL&BLACS_REPEATABLE, which tries to make the parallel reduction repeatable. However, this can only help if the architecture and number of MPI tasks is identical. But I’m not sure if that flag controls all of the possibly non deterministic operations.

Noam

Patrick Gono

unread,
Mar 26, 2020, 8:56:27 AM3/26/20
to cp...@googlegroups.com
Dear Abdullah,

Even if you use only methods (such as thermostats, barostats, etc.) that do not rely on random numbers, inherent numerical errors will accumulate over time and affect the simulated trajectory over a sufficiently long time period. If it is absolutely necessary to sample the exact same trajectory twice, there are several things you can try to do. You can tighten the convergence criteria for the SCF loop. You can reduce the time step of the simulation. You can reduce EPS_DEFAULT or the specific EPS_ variables governing the various aspects of numerical accuracy. However, as we're dealing with a chaotic system, even negligible errors and inconsistencies accumulate and propagate to dramatically change the resulting trajectory. You can make your calculations ten times more accurate and burn X times more computational resources, but this will probably buy you just a few more consistent steps in the parallel trajectories before you see them diverge. This is not a bug of CP2K, but a feature of the underlying physical and computational problem.

In any case, if you make sure you are properly converging your wave function at each simulation step, and that your time step is short enough to sample all vibrational modes in the system, then even microscopically diverging trajectories should contain the same macroscopic information. For example, the vibrational spectrum inferred from your dynamics, the radial distribution functions, the average potential energy, the computational cell volume, etc. should be (more or less) identical for both parallel runs.

Yours sincerely,
Patrick Gono

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/dcbc30db-dba6-43ac-9e6c-1bbfff98bb25%40googlegroups.com.

Abdullah Bin Faheem

unread,
Mar 26, 2020, 9:26:04 AM3/26/20
to cp2k
Dear Patrick

Thank you very much for your detailed explanation, it was very useful. 

Is this kind of diverging behavior is to be expected for AIMD only? Since when I run classical MD using the Fist module and the BMH potential, there is no variation in the two parallel runs even up to 10 ps.

Thank you for your help.

Best Regards,
Abdullah Bin Faheem

Fabian Ducry

unread,
Mar 26, 2020, 9:35:25 AM3/26/20
to cp2k
This is not a direct anwer, but may help anyway.

If you have to rerun an MD trajectory there is the MOTION%MD%REFTRAJ section. It lets you load a trajectory and redo the simulation.

Best,
Fabian

Noam Bernstein

unread,
Mar 26, 2020, 9:44:06 AM3/26/20
to cp...@googlegroups.com
As Patrick said, _any_ difference in calculation will result in growing variation in the trajectory, since it is chaotic. However, computer operation is deterministic (if using deterministic algorithms), and so even if the solution of the equations is approximate, there’s no inherent reason that it can’t be deterministic. if you start from the same numbers and do the same operations on them, you’ll end up with the same results.

At one point CP2K was using deterministic algorithms for ab initio MD, except for parallel reduction operations. The BLACS_REPEATABLE flag causes a blacs_set call to request topologies that lead to repeatable parallel operations. That was enough back then. Not sure if it still is now.

Noam

Abdullah Bin Faheem

unread,
Mar 26, 2020, 11:13:54 AM3/26/20
to cp2k
Dear Noam,

Thank you for your suggestion, however, while the difference is smaller, it becomes visible after 40 fs. 

Best regards,
Abdullah Bin Faheem
Reply all
Reply to author
Forward
0 new messages