Controlling Velocities in NVE Trajectory Simulations with VASP

Question on input files/tags, interpreting output, etc.

Please check whether the answer to your question is given in the VASP online manual or has been discussed in this forum previously!

Moderators: Global Moderator, Moderator

Post Reply
Message
Author
nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Controlling Velocities in NVE Trajectory Simulations with VASP

#1 Post by nidhi_tiwari » Fri Dec 01, 2023 2:33 pm

Can we simulate NVE trajectories with velocities of our choice? The recommended method MDALGO = 1, ANDERSON_PROB = 0 gives me not much control over the initial velocities as they are randomly sampled from the TEBEG tag. The other option of MDALGO = 0, SMASS = -3 is taking the input velocities into consideration. But why is it not recommended for NVE simulation (https://www.vasp.at/wiki/index.php/SMASS)?

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#2 Post by nidhi_tiwari » Mon Dec 04, 2023 12:49 pm

The REPORT files generated from NVE simulations with MDALGO=1, ANDERSON_PROB=0, and MDALGO=0, SMASS=-3 exhibit variations. The later had the same RANDOM_SEED values throughout the file while former had many other informations (E_kin, T_inst, No. of steps, and changing RANDOM_SEED values at each step). How does RANDOM_SEED values in the REPORT file relate to TEBEG? Are these two parameters independent?

I want to simulate a particular reaction with same initial velocities/energies on different catalysts and compare the outcome. I used RANDOM_SEED tag with MDALGO=1, ANDERSON_PROB=0 tags to make the individual trajectories reproducible but still could not draw much inference on comparing the output of the two different systems.

What precisely does RANDOM_SEED tag in INCAR control and on what basis are the modified values generated in REPORT file at each time-step?
Last edited by nidhi_tiwari on Mon Dec 04, 2023 12:50 pm, edited 2 times in total.

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#3 Post by jonathan_lahnsteiner2 » Tue Dec 05, 2023 12:02 pm

Dear nidhi_tiwari,

When using the microcanonical ensemble in vasp there are 3 possibilities.
  • MDALGO=1 and ANDERSEN_PROB = 0.0
    MDALGO=2 and SMASS=-3
    MDALGO=0 and SMASS=-3
When using a POSCAR file containing initial velocities, all of the three approaches will give the same trajectories (up to numerical instabilities). Even when not using a RANDOM_SEED.

When starting the molecular dynamics run with random velocities and setting
a RANDOM_SEED in the INCAR file the first two approaches will give the same starting velocities. The third approach with MDALGO=0 will have different starting velocities because it will use the random seed differently.
But, all three approaches will generate the starting velocities by drawing random numbers from the Maxwell-Boltzmann distribution. And the series of random numbers is initialized by the RANDOM_SEED.

The output in the REPORT file of vasp will depend on what molecular dynamics algorithm you are using. Since MDALGO=0 belongs to an older part of vasp it will write no output except of the random seed to the REPORT file. MDALGO 1 and 2 will write more output to the REPORT file as temperature, kinetic energy, and so on. But also here the written output will not agree. With MDALGO=1 the number of collisions with the heat bath will be writen to the REPORT file because you are using an Andersen thermostat to realize your NVE simulation which is not written with the MDALGO=2 approach where a Nose-Hover algorithm is used,

I hope this clarifies your questions.

All the best Jonathan

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#4 Post by nidhi_tiwari » Fri Dec 22, 2023 5:43 pm

Dear Jonathan,

Thank you for your thorough response; I largely agree with your points. However I would like to express a specific aspect regarding the statement, "When using a POSCAR file containing initial velocities, all of the three approaches will give the same trajectories," I've observed that utilizing MDALGO = 1 with ANDERSON_PROB = 0.0 leads to distinct XDATCAR outputs, even upon rerunning the same trajectory, owing to the random assignment of initial velocities. By 'same trajectories', I expect same XDATCAR.

Best regards,
Nidhi

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#5 Post by nidhi_tiwari » Sun Jan 07, 2024 9:41 am

Going back to my original question of simulating trajectories with velocities of our choice, I tried the following combinations:
MDALGO = 2; SMASS = 0 (NVT with NH thermostat)
MDALGO = 2; SMASS = -3 (NVE with NH thermostat)
MDALGO = 0; SMASS = -3 (NVE standard MD)
In all these cases I did not give TEBEG & TEEND values rather have the velocities in the POSCAR file. The first two cases did not read the POSCAR velocities and the starting temperature in OSZICAR is 0K.
Only the third combination reads the initial velocities and gives the expected temperature in OSZICAR.
Hence, my query is if this is the only way we can simulate trajectories based on the initial velocities? Is there any shortcoming in using MDALGO = 0; SMASS = -3 ?

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#6 Post by nidhi_tiwari » Mon Feb 19, 2024 1:26 pm

Still awaiting an answer to my question. Any insights or discussion would be greatly appreciated.

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#7 Post by jonathan_lahnsteiner2 » Mon Feb 19, 2024 7:38 pm

Dear Nidhi Tiwari,

First of all sorry for the late reply. I checked now the statements of your last posts.
To your first comment:
I've observed that utilizing MDALGO = 1 with ANDERSON_PROB = 0.0 leads to distinct XDATCAR outputs, even upon rerunning the same trajectory, owing to the random assignment of initial velocities. By 'same trajectories', I expect same XDATCAR.
I am unable to replicate this statement. Upon initializing an NVE simulation with the Andersen thermostat multiple times, I consistently generate identical trajectories, provided that I commence from the same POSCAR file containing predetermined velocities. I validated these trajectories using the 'vimdiff' command to confirm their similarity. However, when commencing from POSCAR files lacking velocities, the trajectories will vary unless a RANDOM_SEED is specified in your INCAR file.
To your second post:
Going back to my original question of simulating trajectories with velocities of our choice, I tried the following combinations:
MDALGO = 2; SMASS = 0 (NVT with NH thermostat)
MDALGO = 2; SMASS = -3 (NVE with NH thermostat)
MDALGO = 0; SMASS = -3 (NVE standard MD)
In all these cases I did not give TEBEG & TEEND values rather have the velocities in the POSCAR file. The first two cases did not read the POSCAR velocities and the starting temperature in OSZICAR is 0K.
Only the third combination reads the initial velocities and gives the expected temperature in OSZICAR.
Case 1: starting from a POSCAR file having velocities and setting MDALGO = 2; SMASS = 0 and not setting a temperature. When doing so vasp will read the initial velocities
but the target temperature of the thermostat is 0K. The target temperature will be 0K because it is the default value of TEBEG. Because you are running an NVT simulation, vasp will decrease the system temperature within a single MD step to 0K. But it starts at the temperature supplied in the POSCAR file.
Case 2: starting from a POSCAR with initial velocities and setting MDALGO = 2; SMASS = -3 and not setting a temperature. In this case, vasp will read the velocities from the POSCAR file and a NVE simulation at the temperature defined by the input velocities will be done. In this example no random initialization of velocities is performed.
Case 3: starting from a POSCAR file having velocities and setting MDALGO = 0; SMASS = -3 and not setting a temperature. Does the same as Case 2:. You will even get the same trajectories which I verified by comparison with vimdiff.

So I am not able to reproduce the behavior you are reporting. If you want me to further investigate please upload the input files you were using. When doing so please prepare 3 folders containing the various INCAR files you were using, the corresponding POSCAR, KPOINTS and POTCAR files.

I hope this is of help. Otherwise please upload your files according to the vasp wiki guidelines.


All the best Jonathan

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#8 Post by nidhi_tiwari » Tue Feb 20, 2024 2:43 pm

Dear Jonathan,

Thank you for your attention. I am attaching the files for two cases (NVE simulation with and without Anderson Thermostat). Please have a look at them.

Regards,
Nidhi
You do not have the required permissions to view the files attached to this post.

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#9 Post by nidhi_tiwari » Thu Feb 22, 2024 8:47 am

Dear Jonathan,

Can you share the input files you used while running the simulation for the following case:
Upon initializing an NVE simulation with the Andersen thermostat multiple times, I consistently generate identical trajectories, provided that I commence from the same POSCAR file containing predetermined velocities. I validated these trajectories using the 'vimdiff' command to confirm their similarity.

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#10 Post by jonathan_lahnsteiner2 » Thu Feb 22, 2024 10:33 am

Dear Nidhi Tiwari,

I checked your input files.
First, what I recognized was the tag ANDERSON_PROB in your INCAR which should be ANDERSEN_PROB. So there was a little typo. But this has nothing to do with your problem since the default value of ANDERSEN_PROB is zero anyway.

The problem that you are experiencing has to do with the format of your POSCAR file. You have a POSCAR file which has a block of velocities after the positions. This POSCAR format is only allowed for the MDALGO=0. As you have recognized this was the only one that gave you the expected results. When using MDALGO not equal 0 you have to supply additional information in the POSCAR file as stored in the CONTCAR file. If the POSCAR file is not in this format MDALGO not equal 0 will not understand that you supply velocities and initialize these randomly.
I checked your simulations in the NVE_Anderson folder noTEBEG and withTEBEG supplying a POSCAR file in the proper format. By doing so both simluations give the same temperature for the first MD step. From this, we can conclude that the velocities were read properly. I took the POSCAR file from your NVE_StandardMD folder and put it in the proper format. You will find this file appended to this post. When comparing the Andersen algorithm and the standard MD with the appended POSCAR they also give the same outcome. For comparison I did a vimdiff on the XDATCAR files for 10 MD steps.
So when you want to supply velocities in your POSCAR file always do this in the format recommended in the vasp wiki on the page for the CONTCAR file. By doing so you will have the capability to exploit all the vasp MD algorithms without problems.

I hope this clarifies your issue otherwise please contact me again.

All the best Jonathan
You do not have the required permissions to view the files attached to this post.

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#11 Post by nidhi_tiwari » Fri Feb 23, 2024 2:32 pm

Okay. Thanks a lot for the information. I will retry the recommended method with correct format.

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#12 Post by jonathan_lahnsteiner2 » Wed Feb 28, 2024 4:00 pm

Dear Nidhi Tiwari,

I was rerunning your jobs now. When doing so all 3 algorithms that you tried in the folders give the same output as would be expected. I did tests for 40MD steps.
The initial temperature and energy in the OSZICAR file are spot on the same for all simulations. So there is no problem with the format of your POSCAR file as suggested by me previously. Also, the three approaches behave the same for all the remaining MD steps. Please check the files I appended.

But I can see this does not agree with the output files that you sent me. With what version of vasp are you running these jobs? Could you please try to rerun the jobs for a couple of MD steps and check if the error is reproducible on your side?

All the best Jonathan
You do not have the required permissions to view the files attached to this post.

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#13 Post by nidhi_tiwari » Fri Mar 15, 2024 8:15 am

Dear Jonathan,

I appreciate the effort you've put into rerunning the jobs. I had found your suggestion of adding the predictor-corrector coordinates in the POSCAR to be correct. By doing so, velocities were read in absence of the TEBEG tag. I have been using VASP 5.4.1 for my simulations.

On rerunning the jobs using the files you have appended, I obtained the same outputs as I did earlier (differences in OSZICAR persisted).

I noticed that you've utilized VASP 6.5 for your calculations and it gave the same output in all cases. Does this indicate a potential inconsistency between VASP versions 5.4.1 and 6.5 in handling certain parameters?

jonathan_lahnsteiner2
Global Moderator
Global Moderator
Posts: 149
Joined: Fri Jul 01, 2022 2:17 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#14 Post by jonathan_lahnsteiner2 » Wed Mar 20, 2024 12:31 pm

Dear Nidhi Tiwari,

I have reviewed your calculations using VASP 5.4.4. I can confirm that there are differences in the results when using MDALGO=1 compared to MDALGO=0 in VASP 5.4.4. You can verify these differences in the attached files. Although the disparities in the results are minor, they may not significantly impact your findings. However, the extent of the impact depends on the specific quantities you are interested in. Ensemble averages of structural properties might remain unaffected by the observed behavior.

If feasible, I would recommend upgrading to VASP6. We are no longer able to provide support or code fixes for VASP5.

All the best
Jonathan
You do not have the required permissions to view the files attached to this post.

nidhi_tiwari
Newbie
Newbie
Posts: 17
Joined: Sat Nov 25, 2023 12:29 pm

Re: Controlling Velocities in NVE Trajectory Simulations with VASP

#15 Post by nidhi_tiwari » Thu Mar 21, 2024 4:50 pm

Okay! Thank you very much for your help. Although for the disparities are minor in the OSZICARs for Vasp 5.4.1 and 5.4.4, the T value is not 0 for the case with no TEBEG as obtained by me. Thus, the predictor-corrector coordinates have a role for the VASP 5.4.1 version. We would try to get the upgraded version as soon as possible.
Last edited by nidhi_tiwari on Thu Mar 21, 2024 5:22 pm, edited 1 time in total.

Post Reply