Controlling Velocities in NVE Trajectory Simulations with VASP
Moderators: Global Moderator, Moderator
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Controlling Velocities in NVE Trajectory Simulations with VASP
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)?
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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?
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.
-
- Global Moderator
- Posts: 215
- Joined: Fri Jul 01, 2022 2:17 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
Dear nidhi_tiwari,
When using the microcanonical ensemble in vasp there are 3 possibilities.
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
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 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
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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
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
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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 ?
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 ?
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
Still awaiting an answer to my question. Any insights or discussion would be greatly appreciated.
-
- Global Moderator
- Posts: 215
- Joined: Fri Jul 01, 2022 2:17 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
Dear Nidhi Tiwari,
First of all sorry for the late reply. I checked now the statements of your last posts.
To your first comment:
To your second post:
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
First of all sorry for the late reply. I checked now the statements of your last posts.
To your first comment:
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.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.
To your second post:
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 velocitiesGoing 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.
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
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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
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.
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
Dear Jonathan,
Can you share the input files you used while running the simulation for the following case:
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.
-
- Global Moderator
- Posts: 215
- Joined: Fri Jul 01, 2022 2:17 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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
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.
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
Okay. Thanks a lot for the information. I will retry the recommended method with correct format.
-
- Global Moderator
- Posts: 215
- Joined: Fri Jul 01, 2022 2:17 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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
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.
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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?
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?
-
- Global Moderator
- Posts: 215
- Joined: Fri Jul 01, 2022 2:17 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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
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.
-
- Newbie
- Posts: 19
- Joined: Sat Nov 25, 2023 12:29 pm
Re: Controlling Velocities in NVE Trajectory Simulations with VASP
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.