bug-fix for slope() function in variable

This commit is contained in:
Steven J. Plimpton 2018-08-03 10:08:02 -06:00
parent 1b0a8fdc9b
commit 5789ef9128
5 changed files with 401 additions and 342 deletions

View File

@ -47,7 +47,7 @@ compute the diffusion coefficient. You can see that both measures
give roughly the same answer and rapidly become roughly constant for
the 100K step simulation.
Dcoeff = 0.36
Dcoeff = 0.33
(2) in.vacf.2d
@ -58,4 +58,4 @@ that point in time, converted into the diffusion coefficient. You can
see the VACF approach gives a more noise, fluctuating value for the
diffusion coefficient, compared to the MSD approach.
Dcoeff = 0.25 to 0.45
Dcoeff = ~0.25

View File

@ -1,245 +0,0 @@
LAMMPS (13 Oct 2016)
# sample LAMMPS input script for diffusion of 2d LJ liquid
# mean-squared displacement via compute msd
# settings
variable x equal 40
variable y equal 40
variable rho equal 0.6
variable t equal 1.0
variable rc equal 2.5
# problem setup
units lj
dimension 2
atom_style atomic
neigh_modify delay 0 every 1
lattice sq2 ${rho}
lattice sq2 0.6
Lattice spacing in x,y,z = 1.82574 1.82574 1.82574
region simbox block 0 $x 0 $y -0.1 0.1
region simbox block 0 40 0 $y -0.1 0.1
region simbox block 0 40 0 40 -0.1 0.1
create_box 1 simbox
Created orthogonal box = (0 0 -0.182574) to (73.0297 73.0297 0.182574)
4 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3200 atoms
pair_style lj/cut ${rc}
pair_style lj/cut 2.5
pair_coeff * * 1 1
mass * 1.0
velocity all create $t 97287
velocity all create 1 97287
fix 1 all nve
fix 2 all langevin $t $t 0.1 498094
fix 2 all langevin 1 $t 0.1 498094
fix 2 all langevin 1 1 0.1 498094
fix 3 all enforce2d
# equilibration run
thermo 1000
run 5000
Neighbor list info ...
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4 -> bins = 53 53 1
Memory usage per processor = 2.478 Mbytes
Step Temp E_pair E_mol TotEng Press
0 1 -1.56492 0 -0.5652325 -1.5346995
1000 0.97537833 -1.5723957 0 -0.5973222 0.92877783
2000 0.99008371 -1.5748206 0 -0.58504633 1.0809416
3000 1.0111412 -1.5848987 0 -0.57407352 1.0174297
4000 1.0055417 -1.5857581 0 -0.58053054 0.95647691
5000 0.97069905 -1.5851114 0 -0.61471567 0.90108287
Loop time of 0.554412 on 8 procs for 5000 steps with 3200 atoms
Performance: 3896017.421 tau/day, 9018.559 timesteps/s
98.9% CPU use with 8 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.23992 | 0.24608 | 0.25161 | 0.7 | 44.39
Neigh | 0.063106 | 0.064417 | 0.066279 | 0.4 | 11.62
Comm | 0.072465 | 0.085066 | 0.094837 | 2.3 | 15.34
Output | 0.00013208 | 0.00013691 | 0.00014591 | 0.0 | 0.02
Modify | 0.11441 | 0.11621 | 0.11769 | 0.3 | 20.96
Other | | 0.04251 | | | 7.67
Nlocal: 400 ave 406 max 394 min
Histogram: 1 1 0 1 0 2 1 0 1 1
Nghost: 202.5 ave 212 max 191 min
Histogram: 1 0 0 0 3 1 0 2 0 1
Neighs: 2800.88 ave 2903 max 2690 min
Histogram: 1 1 0 0 1 2 1 0 1 1
Total # of neighbors = 22407
Ave neighs/atom = 7.00219
Neighbor list builds = 599
Dangerous builds = 0
unfix 2
# data gathering run
reset_timestep 0
# factor of 4 in 2 variables is for 2d
compute msd all msd com yes
variable twopoint equal c_msd[4]/4/(step*dt+1.0e-6)
fix 9 all vector 10 c_msd[4]
variable fitslope equal slope(f_9)/4/(10*dt)
thermo_style custom step temp c_msd[4] v_twopoint v_fitslope
# only need to run for 10K steps to make a good 100-frame movie
#dump 1 all custom 1 tmp.dump id type vx vy vz
#dump 2 all image 100 image.*.jpg type type zoom 1.6 adiam 1.2
thermo 1000
run 100000
Memory usage per processor = 2.853 Mbytes
Step Temp c_msd[4] v_twopoint v_fitslope
0 0.97069905 0 0 5e+20
1000 0.98138076 4.0484996 0.20242494 0.18046446
2000 0.97606079 9.2121392 0.23030346 0.2091528
3000 0.97924866 14.815034 0.24691721 0.22619184
4000 0.98568451 20.516817 0.25646019 0.23715506
5000 0.97551815 27.33922 0.27339219 0.24709999
6000 0.98482252 34.37734 0.28647782 0.25735178
7000 0.9672559 41.696689 0.29783348 0.26654059
8000 0.9836541 48.340277 0.30212673 0.27440308
9000 0.99087147 56.042692 0.31134828 0.28113047
10000 0.99663166 63.69663 0.31848314 0.28767921
11000 0.97776688 71.144109 0.32338231 0.29344527
12000 0.98246011 78.301774 0.32625739 0.29849471
13000 0.98788732 85.061923 0.32716124 0.3026655
14000 0.96872483 91.1658 0.32559214 0.30601023
15000 0.98955796 97.278388 0.32426129 0.3084275
16000 0.99855196 104.23997 0.3257499 0.31049883
17000 0.98600861 110.66055 0.3254722 0.31220348
18000 0.98696963 116.90111 0.32472531 0.31352676
19000 0.9881192 124.21305 0.32687644 0.31480062
20000 0.98527319 131.09874 0.32774685 0.31596198
21000 0.99015191 137.89263 0.32831579 0.31705324
22000 0.97972418 146.68982 0.33338595 0.31833889
23000 0.98911012 155.1264 0.33723129 0.31979515
24000 0.98810498 162.88634 0.33934653 0.32131187
25000 0.96961962 170.37907 0.34075814 0.32276215
26000 0.99118408 179.26511 0.34474059 0.32427111
27000 0.98515159 185.90764 0.3442734 0.32574529
28000 0.98951677 192.12183 0.34307469 0.32700292
29000 0.9832026 196.99457 0.33964581 0.32799023
30000 0.98449493 203.48475 0.33914124 0.3287171
31000 0.96585993 210.06193 0.33880956 0.32935775
32000 0.98758117 218.94174 0.34209646 0.33001591
33000 0.98875584 225.96489 0.34237104 0.33072947
34000 0.98007229 233.5792 0.34349882 0.3314385
35000 0.98415295 241.98148 0.34568783 0.33216634
36000 0.98101154 250.30876 0.34765106 0.33295272
37000 0.97606878 258.2127 0.34893608 0.33377673
38000 0.97220293 266.40464 0.35053242 0.33459273
39000 0.979783 272.8578 0.34981769 0.33539728
40000 0.98375673 279.87598 0.34984497 0.33609699
41000 0.97506523 288.07676 0.35131312 0.33677708
42000 0.97106749 296.11647 0.3525196 0.33751312
43000 0.97717259 304.46747 0.35403194 0.33823441
44000 0.98541435 312.57228 0.35519578 0.3389771
45000 0.97678287 321.82674 0.35758527 0.33973306
46000 0.98169719 329.78197 0.35845866 0.34051748
47000 0.99471466 337.11283 0.35863066 0.34127239
48000 0.98332437 346.0754 0.3604952 0.34202442
49000 0.98126947 356.11859 0.36338631 0.34282132
50000 0.98809751 365.65248 0.36565248 0.34368171
51000 0.95919516 373.91833 0.36658659 0.34454516
52000 0.98097913 381.26492 0.36660089 0.34538506
53000 0.97774072 388.81031 0.36680218 0.34618232
54000 0.99096915 395.56767 0.36626636 0.3469296
55000 0.97652739 401.72735 0.36520668 0.34760374
56000 0.99185306 407.28834 0.3636503 0.34819906
57000 0.96289342 414.75298 0.3638184 0.34871992
58000 0.97871716 424.69443 0.36611588 0.34927986
59000 0.98637393 433.14205 0.36706953 0.34986296
60000 0.98009845 438.14533 0.36512111 0.35040349
61000 0.99416712 446.08007 0.3656394 0.35088379
62000 0.97612483 450.90846 0.36363585 0.35132647
63000 0.97786531 455.36749 0.36140277 0.35167458
64000 0.99080668 458.04873 0.35785057 0.3519105
65000 0.97952497 461.31241 0.3548557 0.3520506
66000 0.98095955 463.91727 0.35145248 0.35207764
67000 0.98370788 468.93 0.34994776 0.35204043
68000 0.96931818 471.07765 0.34638063 0.35192685
69000 0.98512552 474.59146 0.34390685 0.35174053
70000 0.98065743 478.66071 0.3419005 0.35149002
71000 0.98971283 482.57357 0.33984054 0.35119434
72000 0.99890324 485.32018 0.3370279 0.35084345
73000 0.98649924 490.19497 0.33574998 0.35043722
74000 0.98723422 496.04991 0.33516886 0.35003351
75000 1.0025633 501.6313 0.33442087 0.34962094
76000 0.97859959 505.97813 0.33288035 0.34921013
77000 0.97973006 510.55334 0.33152814 0.3487692
78000 0.9903944 515.06966 0.33017286 0.34830833
79000 0.96847518 518.76483 0.32833217 0.3478214
80000 0.99171112 524.18127 0.32761329 0.34733349
81000 0.97202573 529.09959 0.32660468 0.3468315
82000 0.99368438 535.80271 0.32670897 0.34633058
83000 0.97932483 543.08233 0.32715803 0.34586259
84000 0.99078651 547.57861 0.32593965 0.34540839
85000 0.98973457 552.24581 0.32485048 0.34493584
86000 0.9835873 557.3493 0.32404029 0.34446152
87000 0.97180564 564.93434 0.32467491 0.34400358
88000 0.99743353 571.39837 0.32465817 0.3435667
89000 0.98993437 577.81703 0.32461631 0.3431411
90000 0.9926071 583.39378 0.32410765 0.342724
91000 0.98800458 591.08741 0.3247733 0.34232767
92000 0.98501879 596.10133 0.32396811 0.34193949
93000 0.98810082 604.02652 0.32474544 0.3415681
94000 0.97563748 609.43676 0.32416849 0.341209
95000 0.97283448 615.15754 0.32376713 0.34084828
96000 0.9883071 622.30912 0.32411933 0.34049871
97000 0.97717678 628.84457 0.32414669 0.34016355
98000 0.97190208 634.37377 0.32366009 0.3398341
99000 0.98687379 640.66666 0.32356902 0.33950845
100000 0.97559757 646.96406 0.32348203 0.33919036
Loop time of 9.58779 on 8 procs for 100000 steps with 3200 atoms
Performance: 4505729.040 tau/day, 10429.928 timesteps/s
99.4% CPU use with 8 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 4.8572 | 4.9363 | 4.9822 | 1.7 | 51.49
Neigh | 1.3583 | 1.376 | 1.3991 | 1.2 | 14.35
Comm | 1.5192 | 1.7079 | 1.8264 | 7.2 | 17.81
Output | 0.0085125 | 0.0086059 | 0.0089455 | 0.1 | 0.09
Modify | 0.77663 | 0.7903 | 0.81378 | 1.3 | 8.24
Other | | 0.7686 | | | 8.02
Nlocal: 400 ave 413 max 391 min
Histogram: 2 1 0 2 0 0 1 1 0 1
Nghost: 204.75 ave 213 max 197 min
Histogram: 1 1 0 1 0 3 0 1 0 1
Neighs: 2800.62 ave 2959 max 2661 min
Histogram: 1 1 1 2 0 0 0 1 1 1
Total # of neighbors = 22405
Ave neighs/atom = 7.00156
Neighbor list builds = 12728
Dangerous builds = 0
Total wall time: 0:00:10

View File

@ -0,0 +1,251 @@
LAMMPS (2 Aug 2018)
# sample LAMMPS input script for diffusion of 2d LJ liquid
# mean-squared displacement via compute msd
# settings
variable x equal 40
variable y equal 40
variable rho equal 0.6
variable t equal 1.0
variable rc equal 2.5
# problem setup
units lj
dimension 2
atom_style atomic
neigh_modify delay 0 every 1
lattice sq2 ${rho}
lattice sq2 0.6
Lattice spacing in x,y,z = 1.82574 1.82574 1.82574
region simbox block 0 $x 0 $y -0.1 0.1
region simbox block 0 40 0 $y -0.1 0.1
region simbox block 0 40 0 40 -0.1 0.1
create_box 1 simbox
Created orthogonal box = (0 0 -0.182574) to (73.0297 73.0297 0.182574)
4 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3200 atoms
Time spent = 0.000706911 secs
pair_style lj/cut ${rc}
pair_style lj/cut 2.5
pair_coeff * * 1 1
mass * 1.0
velocity all create $t 97287
velocity all create 1 97287
fix 1 all nve
fix 2 all langevin $t $t 0.1 498094
fix 2 all langevin 1 $t 0.1 498094
fix 2 all langevin 1 1 0.1 498094
fix 3 all enforce2d
# equilibration run
thermo 1000
run 5000
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 53 53 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/2d/newton
bin: standard
Per MPI rank memory allocation (min/avg/max) = 3.052 | 3.052 | 3.052 Mbytes
Step Temp E_pair E_mol TotEng Press
0 1 -1.56492 0 -0.5652325 -1.5346995
1000 0.97537833 -1.5723957 0 -0.5973222 0.92877783
2000 0.99008371 -1.5748206 0 -0.58504633 1.0809416
3000 1.0111412 -1.5848987 0 -0.57407352 1.0174297
4000 1.0055417 -1.5857581 0 -0.58053054 0.95647691
5000 0.97069905 -1.5851114 0 -0.61471567 0.90108287
Loop time of 0.667446 on 8 procs for 5000 steps with 3200 atoms
Performance: 3236214.756 tau/day, 7491.238 timesteps/s
99.9% CPU use with 8 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.22913 | 0.24877 | 0.28382 | 3.6 | 37.27
Neigh | 0.064419 | 0.071256 | 0.080013 | 1.7 | 10.68
Comm | 0.103 | 0.14054 | 0.17204 | 5.5 | 21.06
Output | 0.00010705 | 0.00013995 | 0.00021911 | 0.0 | 0.02
Modify | 0.13457 | 0.14973 | 0.16887 | 2.6 | 22.43
Other | | 0.05701 | | | 8.54
Nlocal: 400 ave 406 max 394 min
Histogram: 1 1 0 1 0 2 1 0 1 1
Nghost: 202.5 ave 212 max 191 min
Histogram: 1 0 0 0 3 1 0 2 0 1
Neighs: 2800.88 ave 2903 max 2690 min
Histogram: 1 1 0 0 1 2 1 0 1 1
Total # of neighbors = 22407
Ave neighs/atom = 7.00219
Neighbor list builds = 599
Dangerous builds = 0
unfix 2
# data gathering run
reset_timestep 0
# factor of 4 in 2 variables is for 2d
compute msd all msd com yes
variable twopoint equal c_msd[4]/4/(step*dt+1.0e-6)
fix 9 all vector 10 c_msd[4]
variable fitslope equal slope(f_9)/4/(10*dt)
thermo_style custom step temp c_msd[4] v_twopoint v_fitslope
# only need to run for 10K steps to make a good 100-frame movie
#dump 1 all custom 1 tmp.dump id type vx vy vz
#dump 2 all image 100 image.*.jpg type type zoom 1.6 adiam 1.2
thermo 1000
run 100000
Per MPI rank memory allocation (min/avg/max) = 3.427 | 3.427 | 3.427 Mbytes
Step Temp c_msd[4] v_twopoint v_fitslope
0 0.97069905 0 0 5e+20
1000 0.98138076 4.0484996 0.20242494 0.20685564
2000 0.97606079 9.2121392 0.23030346 0.23687918
3000 0.97924866 14.815034 0.24691721 0.25405247
4000 0.98568451 20.516817 0.25646019 0.26353644
5000 0.97551815 27.33922 0.27339219 0.27544492
6000 0.98482252 34.37734 0.28647782 0.28966619
7000 0.9672559 41.696689 0.29783348 0.30165524
8000 0.9836541 48.340277 0.30212673 0.31085371
9000 0.99087147 56.042692 0.31134828 0.31811489
10000 0.99663166 63.69663 0.31848314 0.32589374
11000 0.97776688 71.144109 0.32338231 0.33219745
12000 0.98246011 78.301774 0.32625739 0.33723
13000 0.98788732 85.061923 0.32716124 0.34053027
14000 0.96872483 91.1658 0.32559214 0.34231162
15000 0.98955796 97.278388 0.32426129 0.34229511
16000 0.99855196 104.23997 0.3257499 0.34217252
17000 0.98600861 110.66055 0.3254722 0.34172446
18000 0.98696963 116.90111 0.32472531 0.3408227
19000 0.9881192 124.21305 0.32687644 0.34036538
20000 0.98527319 131.09874 0.32774685 0.34003478
21000 0.99015191 137.89263 0.32831579 0.33987868
22000 0.97972418 146.68982 0.33338595 0.34060035
23000 0.98911012 155.1264 0.33723129 0.34201036
24000 0.98810498 162.88634 0.33934653 0.34371488
25000 0.96961962 170.37907 0.34075814 0.34531409
26000 0.99118408 179.26511 0.34474059 0.34717195
27000 0.98515159 185.90764 0.3442734 0.34898035
28000 0.98951677 192.12183 0.34307469 0.35021808
29000 0.9832026 196.99457 0.33964581 0.35075459
30000 0.98449493 203.48475 0.33914124 0.35066186
31000 0.96585993 210.06193 0.33880956 0.35046715
32000 0.98758117 218.94174 0.34209646 0.35046623
33000 0.98875584 225.96489 0.34237104 0.35073944
34000 0.98007229 233.5792 0.34349882 0.35109188
35000 0.98415295 241.98148 0.34568783 0.35157879
36000 0.98101154 250.30876 0.34765106 0.3523013
37000 0.97606878 258.2127 0.34893608 0.35318097
38000 0.97220293 266.40464 0.35053242 0.3540743
39000 0.979783 272.8578 0.34981769 0.35496561
40000 0.98375673 279.87598 0.34984497 0.35558182
41000 0.97506523 288.07676 0.35131312 0.35618259
42000 0.97106749 296.11647 0.3525196 0.35698571
43000 0.97717259 304.46747 0.35403194 0.3577736
44000 0.98541435 312.57228 0.35519578 0.35865003
45000 0.97678287 321.82674 0.35758527 0.35958623
46000 0.98169719 329.78197 0.35845866 0.36062236
47000 0.99471466 337.11283 0.35863066 0.36158322
48000 0.98332437 346.0754 0.3604952 0.36255042
49000 0.98126947 356.11859 0.36338631 0.3636628
50000 0.98809751 365.65248 0.36565248 0.36496809
51000 0.95919516 373.91833 0.36658659 0.36628073
52000 0.98097913 381.26492 0.36660089 0.36752237
53000 0.97774072 388.81031 0.36680218 0.36863962
54000 0.99096915 395.56767 0.36626636 0.36961521
55000 0.97652739 401.72735 0.36520668 0.37038579
56000 0.99185306 407.28834 0.3636503 0.37094092
57000 0.96289342 414.75298 0.3638184 0.37130039
58000 0.97871716 424.69443 0.36611588 0.37180428
59000 0.98637393 433.14205 0.36706953 0.37239862
60000 0.98009845 438.14533 0.36512111 0.37288487
61000 0.99416712 446.08007 0.3656394 0.37321496
62000 0.97612483 450.90846 0.36363585 0.37345792
63000 0.97786531 455.36749 0.36140277 0.37344803
64000 0.99080668 458.04873 0.35785057 0.37313914
65000 0.97952497 461.31241 0.3548557 0.3725875
66000 0.98095955 463.91727 0.35145248 0.37174735
67000 0.98370788 468.93 0.34994776 0.37076942
68000 0.96931818 471.07765 0.34638063 0.36961868
69000 0.98512552 474.59146 0.34390685 0.36830908
70000 0.98065743 478.66071 0.3419005 0.36686789
71000 0.98971283 482.57357 0.33984054 0.36535224
72000 0.99890324 485.32018 0.3370279 0.36373174
73000 0.98649924 490.19497 0.33574998 0.36200692
74000 0.98723422 496.04991 0.33516886 0.36034919
75000 1.0025633 501.6313 0.33442087 0.35872052
76000 0.97859959 505.97813 0.33288035 0.35714939
77000 0.97973006 510.55334 0.33152814 0.35553808
78000 0.9903944 515.06966 0.33017286 0.35391584
79000 0.96847518 518.76483 0.32833217 0.35226287
80000 0.99171112 524.18127 0.32761329 0.35065267
81000 0.97202573 529.09959 0.32660468 0.34904364
82000 0.99368438 535.80271 0.32670897 0.34747913
83000 0.97932483 543.08233 0.32715803 0.34605097
84000 0.99078651 547.57861 0.32593965 0.34469765
85000 0.98973457 552.24581 0.32485048 0.34332115
86000 0.9835873 557.3493 0.32404029 0.34197018
87000 0.97180564 564.93434 0.32467491 0.34069702
88000 0.99743353 571.39837 0.32465817 0.33951258
89000 0.98993437 577.81703 0.32461631 0.33838511
90000 0.9926071 583.39378 0.32410765 0.33730429
91000 0.98800458 591.08741 0.3247733 0.33630505
92000 0.98501879 596.10133 0.32396811 0.33534725
93000 0.98810082 604.02652 0.32474544 0.33445545
94000 0.97563748 609.43676 0.32416849 0.33361404
95000 0.97283448 615.15754 0.32376713 0.33278044
96000 0.9883071 622.30912 0.32411933 0.33199212
97000 0.97717678 628.84457 0.32414669 0.33125729
98000 0.97190208 634.37377 0.32366009 0.33054877
99000 0.98687379 640.66666 0.32356902 0.32986014
100000 0.97559757 646.96406 0.32348203 0.32920186
Loop time of 7.61838 on 8 procs for 100000 steps with 3200 atoms
Performance: 5670494.518 tau/day, 13126.145 timesteps/s
100.0% CPU use with 8 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 3.5458 | 3.6709 | 3.8234 | 4.3 | 48.19
Neigh | 1.1363 | 1.1513 | 1.1753 | 1.0 | 15.11
Comm | 1.5901 | 1.7017 | 1.8664 | 6.9 | 22.34
Output | 0.0041966 | 0.0043583 | 0.0050626 | 0.4 | 0.06
Modify | 0.63816 | 0.65537 | 0.68918 | 2.0 | 8.60
Other | | 0.4348 | | | 5.71
Nlocal: 400 ave 413 max 391 min
Histogram: 2 1 0 2 0 0 1 1 0 1
Nghost: 204.75 ave 213 max 197 min
Histogram: 1 1 0 1 0 3 0 1 0 1
Neighs: 2800.62 ave 2959 max 2661 min
Histogram: 1 1 1 2 0 0 0 1 1 1
Total # of neighbors = 22405
Ave neighs/atom = 7.00156
Neighbor list builds = 12728
Dangerous builds = 0
Total wall time: 0:00:08

View File

@ -1,4 +1,4 @@
LAMMPS (13 Oct 2016)
LAMMPS (2 Aug 2018)
# sample LAMMPS input script for diffusion of 2d LJ liquid
# mean-squared displacement via compute msd
@ -29,6 +29,7 @@ Created orthogonal box = (0 0 -0.182574) to (73.0297 73.0297 0.182574)
4 by 2 by 1 MPI processor grid
create_atoms 1 box
Created 3200 atoms
Time spent = 0.000712872 secs
pair_style lj/cut ${rc}
pair_style lj/cut 2.5
@ -49,13 +50,18 @@ fix 3 all enforce2d
thermo 1000
run 5000
Neighbor list info ...
1 neighbor list requests
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4 -> bins = 53 53 1
Memory usage per processor = 2.478 Mbytes
binsize = 1.4, bins = 53 53 1
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/2d/newton
bin: standard
Per MPI rank memory allocation (min/avg/max) = 3.052 | 3.052 | 3.052 Mbytes
Step Temp E_pair E_mol TotEng Press
0 1 -1.56492 0 -0.5652325 -1.5346995
1000 0.97537833 -1.5723957 0 -0.5973222 0.92877783
@ -63,20 +69,20 @@ Step Temp E_pair E_mol TotEng Press
3000 1.0111412 -1.5848987 0 -0.57407352 1.0174297
4000 1.0055417 -1.5857581 0 -0.58053054 0.95647691
5000 0.97069905 -1.5851114 0 -0.61471567 0.90108287
Loop time of 0.557588 on 8 procs for 5000 steps with 3200 atoms
Loop time of 0.648098 on 8 procs for 5000 steps with 3200 atoms
Performance: 3873826.669 tau/day, 8967.191 timesteps/s
99.1% CPU use with 8 MPI tasks x no OpenMP threads
Performance: 3332829.949 tau/day, 7714.884 timesteps/s
99.9% CPU use with 8 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.23784 | 0.24683 | 0.25594 | 1.0 | 44.27
Neigh | 0.062975 | 0.06439 | 0.0662 | 0.4 | 11.55
Comm | 0.083826 | 0.092564 | 0.1035 | 2.1 | 16.60
Output | 0.00011778 | 0.00012615 | 0.00014257 | 0.1 | 0.02
Modify | 0.11466 | 0.11648 | 0.1187 | 0.4 | 20.89
Other | | 0.0372 | | | 6.67
Pair | 0.22614 | 0.24602 | 0.27481 | 2.8 | 37.96
Neigh | 0.066875 | 0.07135 | 0.077825 | 1.2 | 11.01
Comm | 0.098293 | 0.12744 | 0.1569 | 5.6 | 19.66
Output | 0.0001049 | 0.00012228 | 0.00014496 | 0.0 | 0.02
Modify | 0.13725 | 0.14919 | 0.16903 | 2.4 | 23.02
Other | | 0.05398 | | | 8.33
Nlocal: 400 ave 406 max 394 min
Histogram: 1 1 0 1 0 2 1 0 1 1
@ -114,7 +120,7 @@ thermo_style custom step temp c_vacf[4] v_vacf
thermo 1000
run 100000
Memory usage per processor = 2.853 Mbytes
Per MPI rank memory allocation (min/avg/max) = 3.427 | 3.427 | 3.427 Mbytes
Step Temp c_vacf[4] v_vacf
0 0.97069905 1.9407914 0
1000 0.98138076 0.029239763 0.22157396
@ -217,20 +223,20 @@ Step Temp c_vacf[4] v_vacf
98000 0.97190208 0.015065013 0.20906937
99000 0.98687379 -0.036869401 0.22993959
100000 0.97559757 0.045464091 0.23369283
Loop time of 10.8346 on 8 procs for 100000 steps with 3200 atoms
Loop time of 8.16691 on 8 procs for 100000 steps with 3200 atoms
Performance: 3987213.825 tau/day, 9229.662 timesteps/s
99.5% CPU use with 8 MPI tasks x no OpenMP threads
Performance: 5289636.190 tau/day, 12244.528 timesteps/s
100.0% CPU use with 8 MPI tasks x no OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 4.8486 | 4.9469 | 5.0248 | 2.8 | 45.66
Neigh | 1.3613 | 1.374 | 1.3916 | 0.8 | 12.68
Comm | 1.8181 | 1.9534 | 2.0665 | 5.7 | 18.03
Output | 0.016565 | 0.016701 | 0.017039 | 0.1 | 0.15
Modify | 1.8395 | 1.9053 | 1.9704 | 2.8 | 17.59
Other | | 0.6383 | | | 5.89
Pair | 3.5668 | 3.6612 | 3.7867 | 4.0 | 44.83
Neigh | 1.1409 | 1.1555 | 1.1804 | 1.4 | 14.15
Comm | 1.581 | 1.711 | 1.8239 | 7.1 | 20.95
Output | 0.016626 | 0.016831 | 0.017569 | 0.2 | 0.21
Modify | 1.225 | 1.2594 | 1.3008 | 2.0 | 15.42
Other | | 0.363 | | | 4.45
Nlocal: 400 ave 413 max 391 min
Histogram: 2 1 0 2 0 0 1 1 0 1
@ -243,4 +249,4 @@ Total # of neighbors = 22405
Ave neighs/atom = 7.00156
Neighbor list builds = 12728
Dangerous builds = 0
Total wall time: 0:00:11
Total wall time: 0:00:08

View File

@ -1576,7 +1576,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
newtree->nextra = 0;
treestack[ntreestack++] = newtree;
} else print_var_error(FLERR,"Mismatched compute in variable formula",ivar);
} else print_var_error(FLERR,
"Mismatched compute in variable formula",ivar);
// ----------------
// fix
@ -1584,7 +1585,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
} else if (strncmp(word,"f_",2) == 0 || strncmp(word,"F_",2) == 0) {
if (domain->box_exist == 0)
print_var_error(FLERR,"Variable evaluation before simulation box is defined",ivar);
print_var_error(FLERR,"Variable evaluation before "
"simulation box is defined",ivar);
// uppercase used to force access of
// global vector vs global scalar, and global array vs global vector
@ -1667,11 +1669,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (index1 > fix->size_array_rows &&
fix->size_array_rows_variable == 0)
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range",ivar);
print_var_error(FLERR,"Variable formula fix array is "
"accessed out-of-range",ivar);
if (index2 > fix->size_array_cols)
print_var_error(FLERR,"Variable formula fix array is accessed out-of-range",ivar);
print_var_error(FLERR,"Variable formula fix array is "
"accessed out-of-range",ivar);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at a compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at a "
"compatible time",ivar);
value1 = fix->compute_array(index1-1,index2-1);
if (tree) {
@ -1688,13 +1693,17 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
} else if (nbracket == 0 && fix->vector_flag) {
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at "
"compatible time",ivar);
if (tree == NULL)
print_var_error(FLERR,"Fix global vector in ""equal-style variable formula",ivar);
print_var_error(FLERR,"Fix global vector in "
"equal-style variable formula",ivar);
if (treetype == ATOM)
print_var_error(FLERR,"Fix global vector in ""atom-style variable formula",ivar);
print_var_error(FLERR,"Fix global vector in "
"atom-style variable formula",ivar);
if (fix->size_vector == 0)
print_var_error(FLERR,"Variable formula fix vector is zero length",ivar);
print_var_error(FLERR,"Variable formula "
"fix vector is zero length",ivar);
int nvec = fix->size_vector;
double *vec;
@ -1726,7 +1735,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
print_var_error(FLERR,"Fix global vector in "
"atom-style variable formula",ivar);
if (fix->size_array_rows == 0)
print_var_error(FLERR,"Variable formula fix array is zero length",ivar);
print_var_error(FLERR,"Variable formula fix array is "
"zero length",ivar);
int nvec = fix->size_array_rows;
double *vec;
@ -1785,10 +1795,12 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
fix->size_peratom_cols == 0) {
if (tree == NULL)
print_var_error(FLERR,"Per-atom fix in equal-style variable formula",ivar);
print_var_error(FLERR,"Per-atom fix in "
"equal-style variable formula",ivar);
if (update->whichflag > 0 &&
update->ntimestep % fix->peratom_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at "
"compatible time",ivar);
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
@ -1805,13 +1817,15 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
fix->size_peratom_cols > 0) {
if (tree == NULL)
print_var_error(FLERR,"Per-atom fix in equal-style variable formula",ivar);
print_var_error(FLERR,"Per-atom fix in "
"equal-style variable formula",ivar);
if (index1 > fix->size_peratom_cols)
print_var_error(FLERR,"Variable formula fix array "
"is accessed out-of-range",ivar);
if (update->whichflag > 0 &&
update->ntimestep % fix->peratom_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at "
"compatible time",ivar);
Tree *newtree = new Tree();
newtree->type = ATOMARRAY;
@ -1878,7 +1892,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
char *var = retrieve(word+2);
if (var == NULL)
print_var_error(FLERR,"Invalid variable evaluation in variable formula",ivar);
print_var_error(FLERR,"Invalid variable evaluation in "
"variable formula",ivar);
if (tree) {
Tree *newtree = new Tree();
newtree->type = VALUE;
@ -1977,7 +1992,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
double *vec;
int nvec = compute_vector(ivar,&vec);
if (index <= 0 || index > nvec)
print_var_error(FLERR,"Invalid index into vector-style variable",ivar);
print_var_error(FLERR,"Invalid index into "
"vector-style variable",ivar);
int m = index; // convert from tagint to int
if (tree) {
@ -1989,7 +2005,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
treestack[ntreestack++] = newtree;
} else argstack[nargstack++] = vec[m-1];
} else print_var_error(FLERR,"Mismatched variable in variable formula",ivar);
} else print_var_error(FLERR,"Mismatched variable in "
"variable formula",ivar);
// ----------------
// math/group/special function or atom value/vector or
@ -2194,7 +2211,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (value2 == 0.0)
argstack[nargstack++] = 1.0;
else if ((value1 == 0.0) && (value2 < 0.0))
print_var_error(FLERR,"Invalid power expression in variable formula",ivar);
print_var_error(FLERR,"Invalid power expression in "
"variable formula",ivar);
else argstack[nargstack++] = pow(value1,value2);
} else if (opprevious == UNARY) {
argstack[nargstack++] = -value2;
@ -3368,7 +3386,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (tree) newtree->type = LN;
else {
if (value1 <= 0.0)
print_var_error(FLERR,"Log of zero/negative value in variable formula",ivar);
print_var_error(FLERR,"Log of zero/negative value in "
"variable formula",ivar);
argstack[nargstack++] = log(value1);
}
} else if (strcmp(word,"log") == 0) {
@ -3377,7 +3396,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (tree) newtree->type = LOG;
else {
if (value1 <= 0.0)
print_var_error(FLERR,"Log of zero/negative value in variable formula",ivar);
print_var_error(FLERR,"Log of zero/negative value in "
"variable formula",ivar);
argstack[nargstack++] = log10(value1);
}
} else if (strcmp(word,"abs") == 0) {
@ -3482,7 +3502,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (narg != 2)
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
if (update->whichflag == 0)
print_var_error(FLERR,"Cannot use ramp in variable formula between runs",ivar);
print_var_error(FLERR,"Cannot use ramp in "
"variable formula between runs",ivar);
if (tree) newtree->type = RAMP;
else {
double delta = update->ntimestep - update->beginstep;
@ -3617,7 +3638,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (narg != 2)
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
if (update->whichflag == 0)
print_var_error(FLERR,"Cannot use vdisplace in variable formula between runs",ivar);
print_var_error(FLERR,"Cannot use vdisplace in "
"variable formula between runs",ivar);
if (tree) newtree->type = VDISPLACE;
else {
double delta = update->ntimestep - update->beginstep;
@ -3629,7 +3651,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (narg != 3)
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
if (update->whichflag == 0)
print_var_error(FLERR,"Cannot use swiggle in variable formula between runs",ivar);
print_var_error(FLERR,"Cannot use swiggle in "
"variable formula between runs",ivar);
if (tree) newtree->type = CWIGGLE;
else {
if (values[0] == 0.0)
@ -3644,7 +3667,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree,
if (narg != 3)
print_var_error(FLERR,"Invalid math function in variable formula",ivar);
if (update->whichflag == 0)
print_var_error(FLERR,"Cannot use cwiggle in variable formula between runs",ivar);
print_var_error(FLERR,"Cannot use cwiggle in "
"variable formula between runs",ivar);
if (tree) newtree->type = CWIGGLE;
else {
if (values[0] == 0.0)
@ -3709,7 +3733,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
if (strcmp(word,"count") == 0) {
if (narg == 1) value = group->count(igroup);
else if (narg == 2) value = group->count(igroup,region_function(args[1],ivar));
else if (narg == 2)
value = group->count(igroup,region_function(args[1],ivar));
else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else if (strcmp(word,"mass") == 0) {
@ -3719,7 +3744,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"charge") == 0) {
if (narg == 1) value = group->charge(igroup);
else if (narg == 2) value = group->charge(igroup,region_function(args[1],ivar));
else if (narg == 2)
value = group->charge(igroup,region_function(args[1],ivar));
else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else if (strcmp(word,"xcm") == 0) {
@ -3732,7 +3758,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
int iregion = region_function(args[2],ivar);
double masstotal = group->mass(igroup,iregion);
group->xcm(igroup,masstotal,xcm,iregion);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
if (strcmp(args[1],"x") == 0) value = xcm[0];
else if (strcmp(args[1],"y") == 0) value = xcm[1];
else if (strcmp(args[1],"z") == 0) value = xcm[2];
@ -3748,7 +3775,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
int iregion = region_function(args[2],ivar);
double masstotal = group->mass(igroup,iregion);
group->vcm(igroup,masstotal,vcm,iregion);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
if (strcmp(args[1],"x") == 0) value = vcm[0];
else if (strcmp(args[1],"y") == 0) value = vcm[1];
else if (strcmp(args[1],"z") == 0) value = vcm[2];
@ -3767,7 +3795,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"bound") == 0) {
double minmax[6];
if (narg == 2) group->bounds(igroup,minmax);
else if (narg == 3) group->bounds(igroup,minmax,region_function(args[2],ivar));
else if (narg == 3)
group->bounds(igroup,minmax,region_function(args[2],ivar));
else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
if (strcmp(args[1],"xmin") == 0) value = minmax[0];
else if (strcmp(args[1],"xmax") == 0) value = minmax[1];
@ -3789,7 +3818,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
double masstotal = group->mass(igroup,iregion);
group->xcm(igroup,masstotal,xcm,iregion);
value = group->gyration(igroup,masstotal,xcm,iregion);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
} else if (strcmp(word,"ke") == 0) {
if (narg == 1) value = group->ke(igroup);
@ -3808,7 +3838,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
double masstotal = group->mass(igroup,iregion);
group->xcm(igroup,masstotal,xcm,iregion);
group->angmom(igroup,xcm,lmom,iregion);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
if (strcmp(args[1],"x") == 0) value = lmom[0];
else if (strcmp(args[1],"y") == 0) value = lmom[1];
else if (strcmp(args[1],"z") == 0) value = lmom[2];
@ -3826,7 +3857,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
double masstotal = group->mass(igroup,iregion);
group->xcm(igroup,masstotal,xcm,iregion);
group->torque(igroup,xcm,tq,iregion);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
if (strcmp(args[1],"x") == 0) value = tq[0];
else if (strcmp(args[1],"y") == 0) value = tq[1];
else if (strcmp(args[1],"z") == 0) value = tq[2];
@ -3844,7 +3876,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
double masstotal = group->mass(igroup,iregion);
group->xcm(igroup,masstotal,xcm,iregion);
group->inertia(igroup,xcm,inertia,iregion);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
if (strcmp(args[1],"xx") == 0) value = inertia[0][0];
else if (strcmp(args[1],"yy") == 0) value = inertia[1][1];
else if (strcmp(args[1],"zz") == 0) value = inertia[2][2];
@ -3869,7 +3902,8 @@ int Variable::group_function(char *word, char *contents, Tree **tree,
group->angmom(igroup,xcm,angmom,iregion);
group->inertia(igroup,xcm,inertia,iregion);
group->omega(angmom,inertia,omega);
} else print_var_error(FLERR,"Invalid group function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid group function in "
"variable formula",ivar);
if (strcmp(args[1],"x") == 0) value = omega[0];
else if (strcmp(args[1],"y") == 0) value = omega[1];
else if (strcmp(args[1],"z") == 0) value = omega[2];
@ -3924,7 +3958,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
Tree **treestack, int &ntreestack,
double *argstack, int &nargstack, int ivar)
{
double value,xvalue,sx,sy,sxx,sxy;
bigint sx,sxx;
double value,xvalue,sy,sxy;
// word not a match to any special function
@ -4020,11 +4055,13 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else index = 0;
int ifix = modify->find_fix(&args[0][2]);
if (ifix < 0) print_var_error(FLERR,"Invalid fix ID in variable formula",ivar);
if (ifix < 0)
print_var_error(FLERR,"Invalid fix ID in variable formula",ivar);
fix = modify->fix[ifix];
if (index == 0 && fix->vector_flag) {
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at "
"compatible time",ivar);
nvec = fix->size_vector;
nstride = 1;
} else if (index && fix->array_flag) {
@ -4032,7 +4069,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
print_var_error(FLERR,"Variable formula fix array "
"is accessed out-of-range",ivar);
if (update->whichflag > 0 && update->ntimestep % fix->global_freq)
print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar);
print_var_error(FLERR,"Fix in variable not computed at "
"compatible time",ivar);
nvec = fix->size_array_rows;
nstride = fix->size_array_cols;
} else print_var_error(FLERR,"Mismatched fix in variable formula",ivar);
@ -4048,10 +4086,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else index = 0;
if (index)
print_var_error(FLERR,"Invalid special function in variable formula",ivar);
print_var_error(FLERR,"Invalid special function in "
"variable formula",ivar);
ivar = find(&args[0][2]);
if (ivar < 0)
print_var_error(FLERR,"Invalid special function in variable formula",ivar);
print_var_error(FLERR,"Invalid special function in "
"variable formula",ivar);
if (style[ivar] != VECTOR)
print_var_error(FLERR,"Mis-matched special function variable "
"in variable formula",ivar);
@ -4062,12 +4102,16 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
nvec = compute_vector(ivar,&vec);
nstride = 1;
} else print_var_error(FLERR,"Invalid special function in variable formula",ivar);
} else print_var_error(FLERR,"Invalid special function in "
"variable formula",ivar);
value = 0.0;
if (method == SLOPE) sx = sy = sxx = sxy = 0.0;
if (method == XMIN) value = BIG;
if (method == XMAX) value = -BIG;
if (method == SLOPE) {
sx = sxx = 0;
sy = sxy = 0.0;
}
else if (method == XMIN) value = BIG;
else if (method == XMAX) value = -BIG;
if (compute) {
double *vec;
@ -4084,12 +4128,10 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
else if (method == AVE) value += vec[j];
else if (method == TRAP) value += vec[j];
else if (method == SLOPE) {
if (nvec > 1) xvalue = (double) i / (nvec-1);
else xvalue = 0.0;
sx += xvalue;
sx += i;
sy += vec[j];
sxx += xvalue*xvalue;
sxy += xvalue*vec[j];
sxx += i*i;
sxy += i*vec[j];
}
j += nstride;
}
@ -4107,12 +4149,10 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
else if (method == AVE) value += one;
else if (method == TRAP) value += one;
else if (method == SLOPE) {
if (nvec > 1) xvalue = (double) i / (nvec-1);
else xvalue = 0.0;
sx += xvalue;
sx += i;
sy += one;
sxx += xvalue*xvalue;
sxy += xvalue*one;
sxx += i*i;
sxy += i*one;
}
}
if (method == TRAP) {
@ -4134,12 +4174,10 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
else if (method == AVE) value += one;
else if (method == TRAP) value += one;
else if (method == SLOPE) {
if (nvec > 1) xvalue = (double) i / (nvec-1);
else xvalue = 0.0;
sx += xvalue;
sx += i;
sy += one;
sxx += xvalue*xvalue;
sxy += xvalue*one;
sxx += i*i;
sxy += i*one;
}
}
if (method == TRAP) value -= 0.5*vec[0] + 0.5*vec[nvec-1];
@ -4148,9 +4186,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
if (method == AVE) value /= nvec;
if (method == SLOPE) {
double numerator = sxy - sx*sy;
double denominator = sxx - sx*sx;
if (denominator != 0.0) value = numerator/denominator / nvec;
double numerator = nvec*sxy - sx*sy;
double denominator = nvec*sxx - sx*sx;
if (denominator != 0.0) value = numerator/denominator;
else value = BIG;
}
@ -4169,7 +4207,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"gmask") == 0) {
if (tree == NULL)
print_var_error(FLERR,"Gmask function in equal-style variable formula",ivar);
print_var_error(FLERR,"Gmask function in equal-style "
"variable formula",ivar);
if (narg != 1)
print_var_error(FLERR,"Invalid special function in variable formula",ivar);
@ -4186,7 +4225,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"rmask") == 0) {
if (tree == NULL)
print_var_error(FLERR,"Rmask function in equal-style variable formula",ivar);
print_var_error(FLERR,"Rmask function in equal-style "
"variable formula",ivar);
if (narg != 1)
print_var_error(FLERR,"Invalid special function in variable formula",ivar);
@ -4202,7 +4242,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"grmask") == 0) {
if (tree == NULL)
print_var_error(FLERR,"Grmask function in equal-style variable formula",ivar);
print_var_error(FLERR,"Grmask function in equal-style "
"variable formula",ivar);
if (narg != 2)
print_var_error(FLERR,"Invalid special function in variable formula",ivar);
@ -4228,7 +4269,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
int ivar = find(args[0]);
if (ivar < 0)
print_var_error(FLERR,"Variable ID in variable formula does not exist",ivar);
print_var_error(FLERR,"Variable ID in "
"variable formula does not exist",ivar);
// SCALARFILE has single current value, read next one
// save value in tree or on argstack
@ -4253,7 +4295,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else if (style[ivar] == ATOMFILE) {
if (tree == NULL)
print_var_error(FLERR,"Atomfile variable in equal-style variable formula",ivar);
print_var_error(FLERR,"Atomfile variable in "
"equal-style variable formula",ivar);
double *result;
memory->create(result,atom->nlocal,"variable:result");
@ -4271,11 +4314,13 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
newtree->nextra = 0;
treestack[ntreestack++] = newtree;
} else print_var_error(FLERR,"Invalid variable style in special function next",ivar);
} else print_var_error(FLERR,"Invalid variable style in "
"special function next",ivar);
} else if (strcmp(word,"is_active") == 0) {
if (narg != 2)
print_var_error(FLERR,"Invalid is_active() function in variable formula",ivar);
print_var_error(FLERR,"Invalid is_active() function in "
"variable formula",ivar);
Info info(lmp);
value = (info.is_active(args[0],args[1])) ? 1.0 : 0.0;
@ -4293,7 +4338,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"is_available") == 0) {
if (narg != 2)
print_var_error(FLERR,"Invalid is_available() function in variable formula",ivar);
print_var_error(FLERR,"Invalid is_available() function in "
"variable formula",ivar);
Info info(lmp);
value = (info.is_available(args[0],args[1])) ? 1.0 : 0.0;
@ -4311,7 +4357,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
} else if (strcmp(word,"is_defined") == 0) {
if (narg != 2)
print_var_error(FLERR,"Invalid is_defined() function in variable formula",ivar);
print_var_error(FLERR,"Invalid is_defined() function in "
"variable formula",ivar);
Info info(lmp);
value = (info.is_defined(args[0],args[1])) ? 1.0 : 0.0;