[lammps-users] Proper usage of npt fix for md simulations of metals

Dear all,

I’m struggling to understand how to use the npt fix properly in the context of MD simulations applied to metals.

I’ve set up a simplified model to help me get a feeling of how this fix is operating, however this is still unclear to me, even after reading the manual and browsing through the user mailing list.

The simplified test I am trying to compute is to bring an initial single crystal box to a specified temperature (say 800 K for the sake of illustration). In addition, I want to constrain the sample at zero pressure.

  • First strategy I’ve tried:

velocity all create 1600.0 12765 dist gaussian
fix perform_npt all npt temp 800.0 800.0 0.1 iso 0.0 0.0 1.0

This seems to work fine, i.e. the temperature reaches 800 K and the pressure oscillates around 0 bar (I don’t know if 0.1 and 1.0 for Tdamp and Pdamp are valid values, but I guess I can play with that later on).

However, I am not too sure this is the best way to bring the system to a specified temperature, since I specify a very high temperature of 1600 K at the start and let the system go down to 800 K, and I am therefore worried that this could affect the overall solution (this is going above the melting point which I want to avoid).

Ideally I would want to heat up my sample in a more gentle way.

  • Therefore, I’ve tried to come up with a second strategy:

I commented out the first line, and tried to bring the sample from 1 K to 800 K as follows (I did not start at 0K otherwise I was getting nan values, which I assumed was due to the Nose-Hoover formulation?):

#velocity all create 1600.0 12765 dist gaussian
fix perform_npt all npt temp 1.0 800.0 0.1 iso 0.0 0.0 1.0

With this setup I am now getting the following thermodynamic outputs (I’ve copied and pasted it in case you want to plot the actual graphs, 8th column is the pressure, 9th is the temperature):

Step Atoms CPU TotEng KinEng PotEng Press perform_ Temp perform_ Volume
0 4000 0 -13440 0 -13440 -0.42633524 -0.42633524 0 0 66430.39
10 4000 0.196527 -13440 3.8886463e-23 -13440 -0.27185803 -0.27185803 7.5228499e-23 7.5228499e-23 66430.377
20 4000 0.3084209 -13440 1.5864453e-22 -13440 0.079724554 0.079724554 3.069086e-22 3.069086e-22 66430.348
30 4000 0.39288902 -13440 2.8148565e-22 -13440 0.37418663 0.37418663 5.4455308e-22 5.4455308e-22 66430.323
40 4000 0.52219605 -13440 3.2954603e-22 -13440 0.39842937 0.39842937 6.3752915e-22 6.3752915e-22 66430.321
50 4000 0.63432002 -13440 3.0177253e-22 -13440 0.13355619 0.13355619 5.8379942e-22 5.8379942e-22 66430.343
60 4000 0.73881984 -13440 3.2900308e-22 -13440 -0.23128081 -0.23128081 6.3647878e-22 6.3647878e-22 66430.374
70 4000 0.86052585 -13440 5.2335535e-22 -13440 -0.43328358 -0.43328358 1.0124664e-21 1.0124664e-21 66430.391
80 4000 0.97084689 -13440 8.4064786e-22 -13440 -0.32317934 -0.32317934 1.6262903e-21 1.6262903e-21 66430.382
90 4000 1.0767879 -13440 1.1410173e-21 -13440 0.026686892 0.026686892 2.2073754e-21 2.2073754e-21 66430.352
100 4000 1.244493 -13440 1.4013297e-21 -13440 0.36958892 0.36958892 2.7109673e-21 2.7109673e-21 66430.323
110 4000 1.337441 -13440 1.9201315e-21 -13440 0.45544576 0.45544576 3.7146245e-21 3.7146245e-21 66430.316
120 4000 1.439692 -13440 3.2672527e-21 -13440 0.20847553 0.20847553 6.3207219e-21 6.3207219e-21 66430.337
130 4000 1.5703259 -13440 5.6140311e-21 -13440 -0.2113473 -0.2113473 1.0860724e-20 1.0860724e-20 66430.372
140 4000 1.682292 -13440 8.1980034e-21 -13440 -0.5085618 -0.5085618 1.5859593e-20 1.5859593e-20 66430.397
150 4000 1.804424 -13440 9.9700044e-21 -13440 -0.45171584 -0.45171584 1.928765e-20 1.928765e-20 66430.392
160 4000 1.89711 -13440 1.152042e-20 -13440 -0.042088399 -0.042088399 2.2287034e-20 2.2287034e-20 66430.358
170 4000 2.0095689 -13440 1.732757e-20 -13440 0.46241227 0.46241227 3.3521358e-20 3.3521358e-20 66430.315
180 4000 2.1032009 -13440 3.4418333e-20 -13440 0.69489143 0.69489143 6.6584598e-20 6.6584598e-20 66430.296
190 4000 2.2609808 -13440 6.6606441e-20 -13440 0.42175805 0.42175805 1.2885468e-19 1.2885468e-19 66430.319
200 4000 2.3646159 -13440 1.0982898e-19 -13440 -0.26002937 -0.26002937 2.1247161e-19 2.1247161e-19 66430.376
210 4000 2.4845529 -13440 1.5925764e-19 -13440 -0.90876182 -0.90876182 3.080947e-19 3.080947e-19 66430.431
220 4000 2.606528 -13440 2.3299936e-19 -13440 -0.97901619 -0.97901619 4.5075306e-19 4.5075306e-19 66430.437
230 4000 2.708967 -13440 3.9765878e-19 -13440 -0.24388665 -0.24388665 7.6929787e-19 7.6929787e-19 66430.375
240 4000 2.8306921 -13440 7.6220369e-19 -13440 0.89104439 0.89104439 1.4745347e-18 1.4745347e-18 66430.279
250 4000 2.9255469 -13440 1.4372888e-18 -13440 1.553625 1.553625 2.7805326e-18 2.7805326e-18 66430.224
260 4000 3.038177 -13440 2.5508864e-18 -13440 1.0807228 1.0807228 4.9348628e-18 4.9348628e-18 66430.263
270 4000 3.1800189 -13440 4.5148665e-18 -13440 -0.33999951 -0.33999951 8.7343153e-18 8.7343153e-18 66430.383
280 4000 3.302943 -13440 8.7171887e-18 -13440 -1.7000282 -1.7000282 1.6863993e-17 1.6863993e-17 66430.497
290 4000 3.3881578 -13440 1.8652662e-17 -13440 -1.9120879 -1.9120879 3.608484e-17 3.608484e-17 66430.515
300 4000 3.529144 -13440 4.1620405e-17 -13440 -0.67155801 -0.67155801 8.0517496e-17 8.0517496e-17 66430.411
310 4000 3.642487 -13440 9.2649943e-17 -13440 1.2369004 1.2369004 1.792376e-16 1.792376e-16 66430.25
320 4000 3.7439489 -13440 2.0707788e-16 -13440 2.4326405 2.4326405 4.006062e-16 4.006062e-16 66430.15
330 4000 3.8666039 -13440 4.7875389e-16 -13440 1.9096514 1.9096514 9.2618185e-16 9.2618185e-16 66430.194
340 4000 3.9787209 -13440 1.1636764e-15 -13440 -0.17545122 -0.17545122 2.2512108e-15 2.2512108e-15 66430.369
350 4000 4.082665 -13440 2.9472728e-15 -13440 -2.4663258 -2.4663258 5.701699e-15 5.701699e-15 66430.562
360 4000 4.2313459 -13440 7.6445743e-15 -13440 -3.2269874 -3.2269874 1.4788947e-14 1.4788947e-14 66430.626
370 4000 4.3329959 -13440 2.0113346e-14 -13440 -1.565143 -1.565143 3.8910632e-14 3.8910632e-14 66430.486
380 4000 4.436559 -13440 5.3650326e-14 -13440 1.7277929 1.7277929 1.0379019e-13 1.0379019e-13 66430.209
390 4000 4.566853 -13440 1.4543616e-13 -13440 4.3978171 4.3978171 2.8135612e-13 2.8135612e-13 66429.984
400 4000 4.689636 -13440 4.0108592e-13 -13440 4.1212161 4.1212161 7.7592791e-13 7.7592791e-13 66430.008
410 4000 4.810292 -13440 1.1243354e-12 -13440 0.35561274 0.35561274 2.1751031e-12 2.1751031e-12 66430.324
420 4000 4.9045579 -13440 3.1991111e-12 -13440 -4.6947105 -4.6947105 6.1888974e-12 6.1888974e-12 66430.749
430 4000 5.0159559 -13440 9.2297571e-12 -13440 -7.1412285 -7.1412285 1.7855591e-11 1.7855591e-11 66430.955
440 4000 5.1180398 -13440 2.6985473e-11 -13440 -4.2729579 -4.2729579 5.2205228e-11 5.2205228e-11 66430.714
450 4000 5.2686141 -13440 7.9921912e-11 -13440 2.7946989 2.7946989 1.5461436e-10 1.5461436e-10 66430.119
460 4000 5.362642 -13440 2.396615e-10 -13440 9.151157 9.151157 4.6364143e-10 4.6364143e-10 66429.585
470 4000 5.4836359 -13440 7.272999e-10 -13440 9.4166211 9.4166211 1.407011e-09 1.407011e-09 66429.562
480 4000 5.604754 -13440 2.232617e-09 -13440 2.1264756 2.1264756 4.3191491e-09 4.3191491e-09 66430.176
490 4000 5.707936 -13440 6.930011e-09 -13440 -8.3335988 -8.3335988 1.3406576e-08 1.3406576e-08 66431.055
500 4000 5.840029 -13440 2.1743581e-08 -13440 -14.187559 -14.187559 4.2064433e-08 4.2064433e-08 66431.548
510 4000 5.9424551 -13440 6.8940905e-08 -13440 -9.8254085 -9.8254085 1.3337086e-07 1.3337086e-07 66431.181
520 4000 6.04564 -13440 2.2082481e-07 -13440 3.3700946 3.3700944 4.2720056e-07 4.2720056e-07 66430.071
530 4000 6.197732 -13440 7.1437062e-07 -13440 16.717939 16.717939 1.3819984e-06 1.3819984e-06 66428.948
540 4000 6.3117709 -13440 2.3334064e-06 -13440 19.513109 19.513107 4.5141329e-06 4.5141329e-06 66428.713
550 4000 6.3971069 -13440 7.6938557e-06 -13440 7.0234392 7.0234318 1.4884285e-05 1.4884285e-05 66429.764
560 4000 6.5266891 -13440 2.5603022e-05 -13440 -14.296324 -14.296349 4.9530783e-05 4.9530783e-05 66431.557
570 4000 6.638552 -13440 8.5970175e-05 -13440 -29.171292 -29.171376 0.00016631513 0.00016631513 66432.809
580 4000 6.7406099 -13440 0.00029122886 -13440 -23.68663 -23.686916 0.00056340197 0.00056340197 66432.347
590 4000 6.8612659 -13439.999 0.00099511066 -13440 2.8156304 2.8146463 0.0019251091 0.0019251091 66430.119
600 4000 6.9940898 -13439.996 0.0034290712 -13440 33.645511 33.642099 0.0066337708 0.0066337708 66427.529
610 4000 7.088372 -13439.988 0.011914262 -13440 44.273985 44.262064 0.023048947 0.023048947 66426.646
620 4000 7.2476299 -13439.957 0.041731398 -13439.999 20.981079 20.939092 0.080732219 0.080732219 66428.645
630 4000 7.341222 -13439.849 0.14732534 -13439.996 -25.032233 -25.181257 0.28501086 0.28501086 66432.66
640 4000 7.441628 -13439.462 0.52404681 -13439.986 -61.019418 -61.552166 1.0138041 1.0138041 66436.201
650 4000 7.5722919 -13438.073 1.8766012 -13439.95 -54.282796 -56.198246 3.6304123 3.6304123 66437.489
660 4000 7.685425 -13433.076 6.7465167 -13439.823 2.3525832 -4.5380537 13.051594 13.051594 66439.427
670 4000 7.8071229 -13415.253 24.11569 -13439.369 82.38118 58.031813 46.653437 46.653437 66456.695
680 4000 7.901145 -13354.904 82.842841 -13437.747 142.78164 63.713835 160.26509 160.26509 66533.402
690 4000 8.014147 -13188.55 243.60032 -13432.15 86.999264 -96.82354 471.26134 471.26134 66764.323
700 4000 8.126544 -12978.324 438.78364 -13417.108 -348.68755 -428.23895 848.85671 848.85671 67073.947
710 4000 8.2751639 -13071.961 323.15984 -13395.121 75.541115 213.11966 625.17462 625.17462 66870.938
720 4000 8.367712 -13173.708 198.37943 -13372.087 -1.3183211 23.432584 383.77846 383.77846 66723.704
730 4000 8.4886169 -13131.072 215.83414 -13346.906 2.6432878 -85.557112 417.54578 417.54578 66807.315
740 4000 8.60958 -12966.072 345.36279 -13311.435 -22.297171 -167.57342 668.12773 668.12773 67129.441
750 4000 8.7128429 -12866.321 395.94096 -13262.262 -38.088332 -32.844611 765.97463 765.97463 67485.13
760 4000 8.83617 -12929.14 281.32151 -13210.461 166.21141 214.64375 544.23554 544.23554 67682.105
770 4000 8.924535 -12934.512 228.20361 -13162.715 176.91431 136.23935 441.47536 441.47536 67972.53
780 4000 9.0373549 -12817.658 294.45253 -13112.111 67.757001 -61.66243 569.63839 569.63839 68467.625
790 4000 9.1671801 -12653.352 397.33211 -13050.684 -189.22238 -284.47615 768.66591 768.66591 69125.679
800 4000 9.3050199 -12620.99 363.66639 -12984.657 -238.69412 -212.62165 703.5373 703.5373 69632.55
810 4000 9.3904769 -12650.543 274.90803 -12925.451 -142.51292 -142.99427 531.82823 531.82823 69995.689
820 4000 9.5180929 -12592.898 278.63271 -12871.531 -9.026951 -92.908508 539.03387 539.03387 70426.955
830 4000 9.630583 -12443.64 369.81051 -12813.45 58.738185 -61.196057 715.42351 715.42351 70996.991
840 4000 9.7323899 -12338.141 410.07894 -12748.22 90.068403 63.061616 793.32552 793.32552 71533.851
850 4000 9.8542759 -12350.709 333.48958 -12684.199 209.67471 227.84464 645.15821 645.15821 71891.212
860 4000 9.9570329 -12337.283 289.62612 -12626.909 194.64836 151.70381 560.30138 560.30138 72268.414
870 4000 10.065659 -12227.003 344.56015 -12571.563 65.45162 -42.456328 666.57497 666.57497 72805.001
880 4000 10.205965 -12088.361 424.19585 -12512.557 -169.5372 -242.48399 820.63563 820.63563 73472.807
890 4000 10.318615 -12060.264 394.57272 -12454.837 -268.47776 -251.13908 763.32769 763.32769 74048.863
900 4000 10.40967 -12082.399 325.82957 -12408.229 -222.93528 -223.90933 630.33939 630.33939 74537.31
910 4000 10.558237 -12034.307 340.30496 -12374.612 -95.648924 -159.65663 658.34303 658.34303 75116.131
920 4000 10.673217 -11925.197 424.42171 -12349.619 57.709483 -12.798302 821.07258 821.07258 75861.878
930 4000 10.753831 -11891.643 438.9507 -12330.594 255.99525 280.07766 849.1799 849.1799 76587.077
940 4000 10.882551 -11955.374 365.64918 -12321.023 107.13342 149.2678 707.37314 707.37314 77186.191
950 4000 10.991761 -11977.79 347.37915 -12325.169 -533.11903 -544.71682 672.02852 672.02852 77836.007
960 4000 11.085666 -11928.177 409.34894 -12337.525 -852.17869 -895.90551 791.91327 791.91327 78535.278
970 4000 11.233045 -11896.21 449.74305 -12345.953 -283.67146 -273.98706 870.05842 870.05842 79084.145
980 4000 11.332449 -11948.26 399.77778 -12348.038 779.23615 822.69243 773.39722 773.39722 79336.857
990 4000 11.4343 -11987.358 371.74301 -12359.101 1082.3494 1088.2406 719.16207 719.16207 79594.099
1000 4000 11.56671 -11966.081 414.18428 -12380.265 194.37011 168.33847 801.26758 801.26758 80042.735

Nothing happens until after 600 timesteps, at which point the temperature starts to rise. I was expecting a linear increase from 1K to 800K instead?
Obviously, this means that there is some fundamental understanding of the npt fix that I am missing, hence my email.

I have included my complete input file below to give you further details on my current settings.

Thanks very much for your assistance.

Best regards
Thomas

**** My input file

units metal

boundary p p p

atom_style atomic

read_restart relaxed_model.restart

pair_style eam/alloy
pair_coeff * * Al99.eam.alloy Al

reset_timestep 0

velocity all create 1600.0 12765 dist gaussian

fix perform_npt all npt temp 800.0 800.0 0.1 iso 0.0 0.0 1.0

variable my_temp equal temp
variable my_press equal press
variable my_pe equal pe
variable my_vol equal vol
variable my_step equal step

fix output_gnuplot all print 1 “{my_step} {my_pe} {my_temp} {my_press} ${my_vol}” append Output/global_data.dat screen no

thermo_style custom step atoms cpu etotal ke pe press c_perform_npt_press temp c_perform_npt_temp vol
thermo 10

dump thermo_dump_atomeye all cfg 100 Output/dump.*.thermo.cfg id type xs ys zs
dump_modify thermo_dump_atomeye element Al

timestep 0.001
run 1000

write_restart thermalized_model.restart

undump thermo_dump_atomeye
unfix perform_npt
unfix output_gnuplot

The first way you did it was fine. That's the normal way to do it.
If you don't use the velocity command, then the initial T is 0, which
is not good. The intiial T is not the first value in the fix npt command,
that is simply the target T initially.

Also if you start from a perfect crystal and use 1600 as the initial T,
and run NVE, the T will rapidly drop to about 800. Again this
is normal repartitioning of energy. You could do that for a while,
then turn on NPT (and off NVE) and that is as gentle as it gets.

Steve