Calculate MSDs during MD run

379 views
Skip to first unread message

Johannes Wagner

unread,
Jul 31, 2015, 7:02:19 AM7/31/15
to cp2k
Hello all,

I was wondering if it was possible to calculate the mean square displacement per kind during an MD run and I found REFTRAJ in the reference.
However, if I understand it correctly, I need to already have a trajectory for REFTRAJ, is that correct? So basically, do a normal MD, save the trajectory and restart the run, pointing to the Trajectory.

But can I somehow calculate the MSD per Kind in regular intervals with a fresh MD run simultaniously? So calculating the MSD every 10 steps or so with reference to the input structure and have an ouput file printed for that?

Thanks for any hints, best regards,
Johannes

Johannes Wagner

unread,
Aug 1, 2015, 1:18:07 PM8/1/15
to cp2k
To specify a bit. Lets say I have a normal trajectory that looks like this:

reftraj.xyz
      Cryst x
 i =        0, time =        0.000, E =       -16.1066791009
  O         4.4494725764        0.8609855793        6.0981987308
  O         3.8029095709        2.7229831166        4.5699381898
  O         4.0118989226        2.7023681308        1.2194938263
  O         6.0462348498        3.2953089592        5.9203028333
  O         3.2241009956        5.5031225318        4.3400008035
..
..
..
with 1000 steps inside.
Now I want to calculate the MSD with reference to the first configuration, how do I do that?

If I do this

&MOTION
        &MD
           STEPS 1000
          TIMESTEP 1
          ENSEMBLE REFTRAJ
          &REFTRAJ
           TRAJ_FILE_NAME reftraj.xyz
           FIRST_SNAPSHOT 1
           LAST_SNAPSHOT 1000
          &PRINT
                 &MSD_KIND
                 &END MSD_KIND
          &END PRINT
          &MSD T
           &MSD_PER_KIND
           &END MSD_PER_KIND   
         &END MSD
      &END REFTRAJ
 &END MD
&END MOTION

I only get this error

 *************************************************************
 *** ERROR in initialize_msd_reftraj (MODULE reftraj_util) ***
 *************************************************************

 *** End of reference positions file reached ***

however there are definitly 1000 steps in the file I link..

Anything else I need to consider? My question still stand if I can do this during the an ordinary MD run.. so not calculating the trajectory first and then letting the reftraj code run over it but have it as a normal output at the end of the run.

Thanks again and best regards,
Johannes

Samuel Andermatt

unread,
Aug 3, 2015, 4:12:30 AM8/3/15
to cp2k
In case you are familiar with programming/scripting. The positions at each step are written into an output file and you could write a script that calculates the MSD from that.

Marcella Iannuzzi

unread,
Aug 3, 2015, 5:23:12 AM8/3/15
to cp2k
Hi

The MSD calculation with REFTRAJ needs a
Reference coordinates file

Regards

Marcella

Johannes Wagner

unread,
Aug 3, 2015, 8:22:33 AM8/3/15
to cp2k
Hi Marcella,

I figured that, finding
REF0_FILENAME
under &MSD

however the error remains the same.
What format do both, the REF0 and the trajectory, need to have? both are XMOL in my case, one containing the entire trajectory, the other only the first step
like this

ref0.xyz

      Cryst x
 i =        0, time =        0.000, E =       -16.1066791009
  O         4.4494725764        0.8609855793        6.0981987308
  O         3.8029095709        2.7229831166        4.5699381898
  O         4.0118989226        2.7023681308        1.2194938263
  O         6.0462348498        3.2953089592        5.9203028333
  O         3.2241009956        5.5031225318        4.3400008035
..
..




Johannes Wagner

unread,
Aug 3, 2015, 10:08:09 AM8/3/15
to cp2k


Here are my input files:

runtime_cp2k is the main input
ref0.xy contains the reference coordinates
reftraj.xyz contains the trajectory from a previous run.

all I get is a segmentation fault and I am not sure where to look for the error..
ref0.xy
reftraj.xyz
runtime_cp2k.inp

Marcella Iannuzzi

unread,
Aug 10, 2015, 5:55:04 AM8/10/15
to cp2k
Hi Johannes

I tried your input and it runs fine, I did not get any segmentation fault.
As expected two output files are written, one per kind, with the MSD 
For kind 2:

      0       0.000        0.0000000000        0.0000000000        0.0000000000        0.0000000000

       1       1.000        0.0000202689        0.0000306356        0.0000178320        0.0000687364

       2       2.000        0.0000739085        0.0001240880        0.0000741001        0.0002720966

       3       3.000        0.0001532087        0.0002815130        0.0001712799        0.0006060016

       4       4.000        0.0002589779        0.0005096011        0.0003126593        0.0010812382


Kind regards
Marcella

Johannes Wagner

unread,
Aug 10, 2015, 8:18:12 AM8/10/15
to cp2k
Thank you Marcella,
it must have been an issue with my cp2k version.. I recompiled a new one and now it works flawlessly.. thank you very much!
kind regards,
Johannes

Renjith S Pillai

unread,
Aug 15, 2019, 3:38:11 AM8/15/19
to cp2k
Hi,

Could you please help me, whenever I use the same files as that you used for the MSD, I am getting the segmentation fault as copied below and my cp2k version is the latest one, cp2k 6.1, I don't know why the segmentation fault for the already tested input files.


[hn1-srmhpc06:161286:0:161286] Caught signal 11 (Segmentation fault: Sent by the kernel at address (nil))
==== backtrace ====
 0 0x000000000067c69c __reftraj_util_MOD_compute_msd_reftraj()  /home/rpillai/Libraries/cp2k-install/src/motion/reftraj_util.F:364
 1 0x0000000000777d0d __integrator_MOD_reftraj()  /home/rpillai/Libraries/cp2k-install/src/motion/integrator.F:1629
 2 0x00000000006811f8 __velocity_verlet_control_MOD_velocity_verlet()  /home/rpillai/Libraries/cp2k-install/src/motion/velocity_verlet_control.F:90
 3 0x000000000063b245 __md_run_MOD_qs_mol_dyn_low()  /home/rpillai/Libraries/cp2k-install/src/motion/md_run.F:473
 4 0x000000000063bcd5 __md_run_MOD_qs_mol_dyn()  /home/rpillai/Libraries/cp2k-install/src/motion/md_run.F:152
 5 0x00000000004ea237 __cp2k_runs_MOD_cp2k_run()  /home/rpillai/Libraries/cp2k-install/src/start/cp2k_runs.F:356
 6 0x00000000004ed4c2 __cp2k_runs_MOD_run_input()  /home/rpillai/Libraries/cp2k-install/src/start/cp2k_runs.F:1103
 7 0x00000000004e70db MAIN__()  /home/rpillai/Libraries/cp2k-install/src/start/cp2k.F:281
 8 0x000000000043a3bd main()  /home/rpillai/Libraries/cp2k-install/obj/local/popt/cp2k.F90:45
 9 0x0000000000022445 __libc_start_main()  ???:0
10 0x00000000004e695c _start()  ???:0
===================
Segmentation fault (core dumped)




 CP2K| version string:                                          CP2K version 6.1
 CP2K| source code revision number:                                    svn:18464
 CP2K| cp2kflags: libint fftw3 libxc parallel mpi3 scalapack xsmm libderiv_max_a
 CP2K|            m1=5 libint_max_am=6
 CP2K| is freely available from                            https://www.cp2k.org/
 CP2K| Program compiled at                          Wed Jul  3 15:39:08 IST 2019
 CP2K| Program compiled on                                          hn1-srmhpc06
 CP2K| Program compiled for                                                local
 CP2K| Data directory path             /home/rpillai/Libraries/cp2k-install/data
 CP2K| Input file name                                          runtime_cp2k.inp


Thanks in advance
renjith
Reply all
Reply to author
Forward
0 new messages