How to unfix NPT ensemble?

Hello everyone,

I am using LAMMPS for simulating 25 chain of polymers along with 400 water molecules, 250 hydronium ions and 10 oxygen molecules. To prepare the system, I have to impose several series of ensembles and use restart file for each of these ensemble runs, each of these runs have specific run time and timestep. Herein, I have first ran NVT ensemble at 300 k ( and then used the restart file for the next step which is NPT ensemble at 1 atm and 600 k for 3000 ps. So, my problem now is that in the second step, ensemble does not unfix, even though, I have used unfix command after 3000 ps run in my input file. I need to unfix this ensemble at this stage to use its final result for the next stage, which is another NVT ensemble.
Also, the funny part is that when I use a shorter run time (100 ps), it gets unfixed!

P.S: I am using Graham cluster to run my files and after each 10 hr (about 1000 ps), I have to restart the files.

Could anyone please help with this issue?

Here is my input file in case is needed;

echo               both
units              real
dimension          3
boundary           p p p
atom_style         full

restart 50       restart

# Pair_Coefficient ..............................................................................................................................................


pair_style    	    lj/class2/coul/long 10 15
dielectric          1.0
bond_style          class2
angle_style         class2
dihedral_style      class2
improper_style      class2
#read_data          System.data
read_restart          System.data
#info coeffs out log

#...................................................................................................................................................................................

kspace_style        pppm 0.0001


neighbor           2  bin
neigh_modify       every 1 delay 0 check yes

#velocity        all create 300.0 497 dist gaussian


#minimize 1.0e-6 1.0e-6 5000 5000
write_data Nafion_3landa.data


timestep           1
thermo	           1000
thermo_style       custom step cpu temp pe ke epair ecoul  etotal density lx ly lz

# reset timestep
#reset_timestep 0

# saving trajectories
dump 1             all xyz 1000 System_2.xyz

#Exports ......................................................................................................................................

#nvt run
#fix 2 all          nvt temp 300.0 300.0 50.0
#run	               400000
#undump
#unfix 2

#..............................................................................................................................................
#raise temperature
#fix 3             all nvt temp 300.0 600 50
#write_restart 	   restart-1.equil
#run               1000000
#undump            1
#unfix 3
#..............................................................................................................................................

#run at high temperature for 3000ps
fix 4              all npt temp 600 600 50 iso 1 1 1000
write_restart 	   restart-1.equil
#fix nvt all nvt temp 600.0 600 50
run                3000000
undump             1
unfix 4

Cheers,

Mahsheed

Please format your input text with ``` so it is more readable, see the guidelines here: Please Read This First: Guidelines and Suggestions for posting LAMMPS questions.

What makes you think it is not getting unfixed?

Thank you for your reply @stamoor. I modified the text.

The system has been running for more than 6000 ps and it still has not unfixed. I tried to put it on run another time, the run has been going on for 3350 ps and still not unfixed. I mean the “fix npt 4” has not stopped after 3000 ps. Despite the fact that I used “unfix” command.
As I mentioned, I tried to check for a shorter run time of for example 100 ps, and it did get unfixed, but for a longer run time I face this issue. The weird part is that for previous NVT run, which was 1000 ps, it got unfixed, as well. I am suspicious about using restart for this specific ensemble several times (3 time) as the run time is rather longer and the cluster that I am using has the maximum run time of 10 hr. (about 1000 ps, which was the same as previous NVT run) Could this be the issue? if yes, what should I do?

You did not address the question of @stamoor. What do you mean by “has not unfixed” ?

Thank you for your response @simongravelle . I mean “fix 4 npt” is still on the run and has not stopped (“unfix 4” is not working). In fact this fix is working on my system for more than 3000 ps (which is my expected run time for this fix).

But not correctly. You need to add triple back quotes (```) and add them on a line by themselves. It looks like you did neither.

No. Unless your cluster is managed and set up very badly, the time for writing restarts is negligible.

What does make be a difference is that with fix npt your computational effort increases: you need to compute/tally the viral in every step and not just when you have thermodynamic output, you need to rescale all positions and adjust the box size, that also means you need to do more work when using a space style.

If you have a walltime limit and want a run command to stop before your time expires, you can set a timeout with the timer command.

I mean “fix 4 npt” is still on the run and has not stopped (“unfix 4” is not working).

How do you know it is still on the run and has not stopped? From the log file or ??

Dear @stamoor. Yes, both from log file and output file.

A part of my output file is like this, where the first number represents steps in fs:

 6018000    35353.962    595.42119   -6397.0689     27792.18   -38204.902    56590.018    21395.111   1.8094245     60.45287     60.45287     60.45287 
 6019000    35380.785    599.56295    -6344.872    27985.503   -38247.391     56788.44    21640.631    1.8282698    60.244442    60.244442    60.244442 
 6020000    35407.537    599.30493   -6235.8104    27973.459   -38060.436    56803.852    21737.649    1.8273244     60.25483     60.25483     60.25483 
 6021000    35434.927    593.53325   -5994.7649    27704.057   -38125.258    56808.683    21709.292    1.8369008    60.149937    60.149937    60.149937 
 6022000    35461.731    600.76722    -6253.103    28041.714   -38053.559      56486.6    21788.611    1.8219121    60.314436    60.314436    60.314436 
 6023000    35489.136    593.16104   -5937.6872    27686.684   -38102.763    56731.525    21748.997    1.8289935    60.236495    60.236495    60.236495 
 6024000    35516.202    603.16476   -6211.9841    28153.623    -38029.76    56705.918    21941.639    1.8146003    60.395339    60.395339    60.395339 
 6025000    35542.851    599.29997   -6454.4999    27973.228   -38197.711     56601.19    21518.728    1.8205539    60.329431    60.329431    60.329431 
 6026000    35569.725    597.40857   -6267.6523    27884.944   -38073.822    56839.583    21617.292    1.8384809    60.132701    60.132701    60.132701 
 6027000    35596.899    592.53245    -6073.643    27657.344   -38287.642    56745.498    21583.701    1.8486123    60.022646    60.022646    60.022646 
 6028000      35624.9     604.6865   -6237.7497    28224.652   -38169.626     56892.08    21986.903    1.8197766     60.33802     60.33802     60.33802 
 6029000    35652.726    600.26163   -6297.0026    28018.115    -38134.31    56772.741    21721.112    1.8009026    60.548075    60.548075    60.548075 
 6030000    35680.097    598.06962   -6121.8184      27915.8     -37983.5    56783.303    21793.981    1.8178554    60.359269    60.359269    60.359269 
 6031000     35707.26    596.07268   -6180.3702    27822.589   -38084.971    56725.988    21642.219    1.8307623    60.217089    60.217089    60.217089 
 6032000    35735.166    596.29165     -5696.26     27832.81   -38010.733    56982.386     22136.55    1.8346689    60.174319    60.174319    60.174319 
 6033000    35764.083    599.62502   -5998.6151      27988.4   -38099.665    56875.829    21989.785    1.8297637    60.228042    60.228042    60.228042 
 6034000    35791.027    594.88583   -6531.3156    27767.191   -38293.216     56594.76    21235.875    1.8487155    60.021529    60.021529    60.021529 
 6035000    35818.071    600.91597   -6430.9935    28048.657   -38328.727    56633.986    21617.664    1.8327005    60.195854    60.195854    60.195854 
 6036000     35845.49    595.17071   -6379.1694    27780.489   -38209.093    56681.995    21401.319    1.8272247    60.255925    60.255925    60.255925 
 6037000    35873.493    601.82156    -6157.913    28090.927   -38078.026    56922.397    21933.014    1.8258359    60.271199    60.271199    60.271199 
 6038000      35901.6    595.92793   -6228.2363    27815.833    -38254.29    56576.445    21587.596    1.8279208    60.248276    60.248276    60.248276 
 6039000    35929.964    600.37537   -6633.2362    28023.424   -38218.431    56577.394    21390.188    1.8261296    60.267968    60.267968    60.267968 
 6040000    35957.591    597.74577   -6348.4125    27900.683   -38213.689    56741.669    21552.271     1.815219    60.388477    60.388477    60.388477 
 6041000    35985.648    596.39014   -6055.8066    27837.407   -38004.943    56833.049      21781.6    1.8192022     60.34437     60.34437     60.34437 

As you can see, after 6000 ps it is still going on.

You mean you expect all the forces to be zero and the temperature to remain exactly the same since you removed fix npt? Basically nothing will move because there is no time integrator?

Because you are reading from a restart file, there could be other fixes still active that are defined in the restart. We’d need to see the full log output.

I think you are just messing up with the restart files.
In your input script, you use:

So I assume that System.data is a binary restart and not a plain-text data file. Also, you use the write_restart command before the simulations runs, which is useless if the goal is to restart the simulation from those files.

Luckily, your input script also contains this command:

that writes a binary restart file that is updated throughout the simulation (I believe you waste a lot of time by asking for I/O every 50 steps, but you are the computational guy). So the only logical assumption is that you have renamed the file restart to System.data, and restarted the simulation from there. If this is the case, then the simulation step is also inherited. As your simulation has surpassed step 6 000 000, only you know how many times you have restarted your simulation, which was the previous step, and the actual thermal history of your sample.
What is the first line and last line of the thermo output? Please enclose those lines with triple backquotes (or press the </> button) or I will hack the Graham cluster and delete all your files :wink:

1 Like

Dear @hothello thank you for your response. I know that the run is going on since I can see the changes in the properties of my system (e.g. density). However, I am not sure as you mentioned if i was correctly placed the write_restart command. Based on your notes, should I put this command after the run command?

Also, I am not sure how can I post the thermo output, as the website does not allow me to share this huge amount of data. But the following lines are the first and last line of thermo output, respectively for the last restart file:

Step CPU Temp PotEng KinEng E_pair E_coul TotEng Density Lx Ly Lz
4824250            0    606.35163   -5665.5814    28302.374   -37956.918    56919.463    22636.793    1.7795717    60.789035    60.789035    60.789035

6041000    35985.648    596.39014   -6055.8066    27837.407   -38004.943    56833.049      21781.6    1.8192022     60.34437     60.34437     60.34437

With the input script from your first post, LAMMPS reads in your restart file, written at step 4824250. Then you have put a command to run 3000000, which would terminate at step 7824250. Since your run has not yet reached that step, it is still going. What were you expecting would happen instead?

Dear @srtee, thank you for your response. The output that I posted is only for the last restart file. In fact, this is the result after 6 times running the restart file. The very first and last results of thermo output would be as below:

Step CPU Temp PotEng KinEng E_pair E_coul TotEng Density Lx Ly Lz
0            0    594.43054   -2445.8199     27745.94   -34374.809    53772.879     25300.12   0.50001018       92.812       92.812       92.812

6041000    35985.648    596.39014   -6055.8066    27837.407   -38004.943    56833.049      21781.6    1.8192022     60.34437     60.34437     60.34437

If you are using the exact script that you posted in the first post, then this is not surprising. The command run X asks LAMMPS to run for X steps, not “keep running until the number of steps, including whatever step number was read in from a previous file, hits X”. If you want that behaviour you should check the manual and look for the keyword upto.

Dear @srtee, thank you very much. I will check that.