Problem with Elastic Constant Script

Hello All,

I am using the elastic constant scripts to test force field of crystal NaBH4, and always got problem about energy minimization: Stopping criterion = linesearch alpha is zero. The resulting elastic constant numbers are unreasonably high, and change hugely with the variable {up}.

As indicated by the script, I only changed the init.mod and potential.mod with my force field parameters, and kept in.elastic and displace.mod intact. And I have a data file for NaBH4 crystal structure.

Here is the beginning part of my data file:

#created by msxx2lammps.py
24 atoms
16 bonds
48 angles
16 impropers

3 atom types
1 bond types
2 angle types
1 improper types

0 6.0509 xlo xhi
0 6.0509 ylo yhi
0 6.0509 zlo zhi
0 0 0 xy xz yz

Masses

1 10.811000 # B
2 1.007940 # H
3 22.989769 # Na

Bond Coeffs

id K r0

1 XX XX # B-H

Angle Coeffs

id K theta0

1 cosine/squared XX XX # H-B-H
2 class2 XX XX XX XX

BondBond Coeffs

1 skip
2 class2 XX XX XX

BondAngle Coeffs

1 skip
2 class2 XX XX XX XX

Atoms

id mol-id type q x y z

1 1 3 1.000000 0.000000 0.000000 0.000000
2 2 3 1.000000 0.000000 3.025450 3.025450

My potential.mod file:

NOTE: This script can be modified for different pair styles

See in.elastic for more info.

Choose potential

pair_style buck/coul/cut 10.0
pair_coeff 1 3 XX XX XX # B-Na
pair_coeff 2 3 XX XX XX # H-Na
pair_coeff 1 2 XX XX XX # B-H
pair_coeff 1 1 XX XX XX # B-B
pair_coeff 2 2 XX XX XX # H-H
pair_coeff 3 3 XX XX XX # Na-Na

bond_style harmonic
bond_coeff XX XX XX XX # B-H

angle_style hybrid cosine/squared class2
angle_coeff 1 cosine/squared XX XX # H-B-H
angle_coeff 2 class2 XX XX XX XX
angle_coeff 2 class2 bb XX XX XX
angle_coeff 2 class2 ba XX XX XX XX

improper_style class2
improper_coeff XX XX XX # Ei
improper_coeff * aa XX XX XX XX XX XX#Eaa

Setup neighbor style

neighbor 1.0 nsq
neigh_modify once no every 1 delay 0 check yes

Setup minimization style

min_style cg
min_modify dmax ${dmax} line quadratic
dump 1 all xyz 1 all.Traj.xyz

Setup output

thermo 1
thermo_style custom step temp pe press pxx pyy pzz pxy pxz pyz lx ly lz vol
thermo_modify norm no

Here is part of my output file:

LAMMPS (11 Jun 2012)
Scanning data file …
4 = max bonds/atom
12 = max angles/atom
4 = max impropers/atom
Reading data file …
triclinic box = (0 0 0) to (6.0509 6.0509 6.0509) with tilt (0 0 0)
2 by 2 by 2 MPI processor grid
24 atoms
16 bonds
48 angles
16 impropers
Finding 1-2 1-3 1-4 neighbors …
4 = max # of 1-2 neighbors
3 = max # of 1-3 neighbors
3 = max # of 1-4 neighbors
4 = max # of special neighbors
Replicating atoms …
triclinic box = (0 0 0) to (36.3054 36.3054 36.3054) with tilt (0 0 0)
2 by 2 by 2 MPI processor grid
5184 atoms
3456 bonds
10368 angles
3456 impropers
Finding 1-2 1-3 1-4 neighbors …
4 = max # of 1-2 neighbors
3 = max # of 1-3 neighbors
3 = max # of 1-4 neighbors
4 = max # of special neighbors
Setting up minimization …
Memory usage per processor = 8.35428 Mbytes
Step Temp PotEng Press Pxx Pyy Pzz Pxy Pxz Pyz Lx Ly Lz Volume
0 0 -364557.73 -120175.41 -120178.35 -120178.35 -120169.54 -1.7608711 3.5177277 -3.5258032 36.3054 36.3054 36.3054 47853.497
1 0 -364582.88 -120071.98 -120074.92 -120074.92 -120066.11 -1.7613994 3.518783 -3.5268609 36.301769 36.301769 36.30177 47839.142
2 0 -364608 -119968.45 -119971.39 -119971.39 -119962.59 -1.7619279 3.5198387 -3.5279191 36.298139 36.298139 36.298139 47824.791
3 0 -364633.1 -119864.83 -119867.76 -119867.76 -119858.97 -1.7624565 3.5208948 -3.5289777 36.294508 36.294508 36.294509 47810.443
4 0 -364658.16 -119761.11 -119764.04 -119764.04 -119755.25 -1.7629855 3.5219514 -3.5300367 36.290878 36.290878 36.290879 47796.097
5 0 -364683.21 -119657.3 -119660.23 -119660.23 -119651.44 -1.7635146 3.5230084 -3.5310961 36.287247 36.287247 36.287249 47781.754
6 0 -364708.22 -119553.39 -119556.32 -119556.32 -119547.54 -1.7640439 3.5240658 -3.532156 36.283617 36.283617 36.283618 47767.414
7 0 -364733.21 -119449.38 -119452.31 -119452.31 -119443.53 -1.7645734 3.5251236 -3.5332163 36.279986 36.279986 36.279988 47753.077
8 0 -364758.17 -119345.28 -119348.21 -119348.21 -119339.43 -1.7651032 3.5261819 -3.534277 36.276356 36.276356 36.276358 47738.743
9 0 -364783.1 -119241.08 -119244.01 -119244.01 -119235.24 -1.7656331 3.5272406 -3.5353381 36.272725 36.272725 36.272728 47724.412
10 0 -364808.01 -119136.79 -119139.71 -119139.71 -119130.94 -1.7661633 3.5282997 -3.5363997 36.269095 36.269095 36.269097 47710.083

45 0 -365401.74 -116586.86 -116589.75 -116589.75 -116581.08 -1.7790401 3.5540228 -3.5621826 36.181361 36.181361 36.18137 47364.7
46 0 -365401.74 -116586.86 -116589.75 -116589.75 -116581.08 -1.7790401 3.5540228 -3.5621826 36.181361 36.181361 36.18137 47364.7
47 0 -365401.74 -116586.86 -116589.75 -116589.75 -116581.08 -1.7790401 3.5540228 -3.5621826 36.181361 36.181361 36.18137 47364.7
48 0 -365401.74 -116586.86 -116589.75 -116589.75 -116581.08 -1.7790401 3.5540228 -3.5621826 36.181361 36.181361 36.18137 47364.7
49 0 -365401.74 -116586.86 -116589.75 -116589.75 -116581.08 -1.7790401 3.5540228 -3.5621826 36.181361 36.181361 36.18137 47364.7
50 0 -365401.74 -116586.86 -116589.75 -116589.75 -116581.08 -1.7790401 3.5540228 -3.5621826 36.181361 36.181361 36.18137 47364.7
Loop time of 5.70808 on 8 procs for 50 steps with 5184 atoms

Minimization stats:
Stopping criterion = linesearch alpha is zero
Energy initial, next-to-last, final =
-364557.732124 -365401.742662 -365401.742662
Force two-norm initial, final = 145267 139968
Force max component initial, final = 83871.8 80812.3
Final line search alpha, max atom move = 5.76226e-19 4.65661e-14
Iterations, force evaluations = 50 351

Pair time () = 4.57708 (80.1861) Bond time () = 0.14231 (2.49313)
Neigh time () = 0 (0) Comm time () = 0.414695 (7.26505)
Outpt time () = 0.458084 (8.02518) Other time () = 0.115907 (2.03058)

Nlocal: 648 ave 648 max 648 min
Histogram: 8 0 0 0 0 0 0 0 0 0
Nghost: 5945 ave 5945 max 5945 min
Histogram: 8 0 0 0 0 0 0 0 0 0
Neighs: 192348 ave 192951 max 191745 min
Histogram: 1 2 1 0 0 0 0 1 2 1

Total # of neighbors = 1538784
Ave neighs/atom = 296.833
Ave special neighs/atom = 3.33333
Neighbor list builds = 0
Dangerous builds = 0
System init for write_restart …
Reading restart file …
triclinic box = (0.0620197 0.0620197 0.0620152) to (36.2434 36.2434 36.2434) with tilt (0 0 0)
2 by 2 by 2 MPI processor grid
5184 atoms
3456 bonds
10368 angles
3456 impropers
Finding 1-2 1-3 1-4 neighbors …
4 = max # of 1-2 neighbors
3 = max # of 1-3 neighbors
3 = max # of 1-4 neighbors
4 = max # of special neighbors
Changing box …
triclinic box = (0.0620197 0.0620197 0.0620152) to (36.2289 36.2434 36.2434) with tilt (0 0 0)
Setting up minimization …
Memory usage per processor = 9.26149 Mbytes
Step Temp PotEng Press Pxx Pyy Pzz Pxy Pxz Pyz Lx Ly Lz Volume
50 0 -316928.99 -92888.561 -78970.343 -99852.01 -99843.33 -1.7981747 3.5424088 -0.61077155 36.166888 36.181361 36.18137 47345.754
51 0 -316928.99 -92888.561 -78970.343 -99852.01 -99843.33 -1.7981747 3.5424088 -0.61077155 36.166888 36.181361 36.18137 47345.754
Loop time of 0.691855 on 8 procs for 1 steps with 5184 atoms

Minimization stats:
Stopping criterion = linesearch alpha is zero
Energy initial, next-to-last, final =
-316928.98531 -316928.98531 -316928.98531
Force two-norm initial, final = 406.541 406.541
Force max component initial, final = 16.0143 16.0143
Final line search alpha, max atom move = 7.26944e-14 1.16415e-12
Iterations, force evaluations = 1 41

Pair time () = 0.550613 (79.585) Bond time () = 0.0167682 (2.42366)
Neigh time () = 0 (0) Comm time () = 0.112031 (16.1929)
Outpt time () = 0 (0) Other time () = 0.0124428 (1.79847)

Nlocal: 648 ave 726 max 582 min
Histogram: 2 0 0 0 4 0 0 0 0 2
Nghost: 5945 ave 6011 max 5867 min
Histogram: 2 0 0 0 0 4 0 0 0 2
Neighs: 198828 ave 223296 max 178117 min
Histogram: 2 0 0 0 4 0 0 0 0 2

Total # of neighbors = 1590624
Ave neighs/atom = 306.833
Ave special neighs/atom = 3.33333
Neighbor list builds = 0
Dangerous builds = 0
Reading restart file …
triclinic box = (0.0620197 0.0620197 0.0620152) to (36.2434 36.2434 36.2434) with tilt (0 0 0)
2 by 2 by 2 MPI processor grid
5184 atoms
3456 bonds
10368 angles
3456 impropers
Finding 1-2 1-3 1-4 neighbors …
4 = max # of 1-2 neighbors
3 = max # of 1-3 neighbors
3 = max # of 1-4 neighbors
4 = max # of special neighbors
Changing box …
triclinic box = (0.0620197 0.0620197 0.0620152) to (36.2579 36.2434 36.2434) with tilt (0 0 0)
Setting up minimization …
Memory usage per processor = 9.95253 Mbytes
Step Temp PotEng Press Pxx Pyy Pzz Pxy Pxz Pyz Lx Ly Lz Volume
50 0 -365369.04 -116884.27 -117237.59 -116711.94 -116703.27 -1.7597702 3.565684 -6.7136085 36.195833 36.181361 36.18137 47383.646
51 0 -365369.04 -116884.27 -117237.59 -116711.94 -116703.27 -1.7597702 3.565684 -6.7136085 36.195833 36.181361 36.18137 47383.646
52 0 -365369.04 -116884.27 -117237.59 -116711.94 -116703.27 -1.7597702 3.565684 -6.7136085 36.195833 36.181361 36.18137 47383.646
Loop time of 1.36695 on 8 procs for 2 steps with 5184 atoms

Minimization stats:
Stopping criterion = linesearch alpha is zero
Energy initial, next-to-last, final =
-365369.040519 -365369.040519 -365369.040519
Force two-norm initial, final = 304.988 304.988
Force max component initial, final = 5.96586 5.96586
Final line search alpha, max atom move = 9.75679e-14 5.82077e-13
Iterations, force evaluations = 2 78

Pair time () = 1.03125 (75.442) Bond time () = 0.0316614 (2.31621)
Neigh time () = 0 (0) Comm time () = 0.279322 (20.434)
Outpt time () = 0.00942358 (0.68939) Other time () = 0.0152877 (1.11839)

Nlocal: 648 ave 775 max 557 min
Histogram: 1 0 3 0 0 3 0 0 0 1
Nghost: 5945 ave 6036 max 5818 min
Histogram: 1 0 0 0 3 0 0 3 0 1
Neighs: 198612 ave 237727 max 170622 min
Histogram: 1 0 3 0 0 3 0 0 0 1

Thank you very much!

Ping

Hello All,

I am using the elastic constant scripts to test force field of crystal
NaBH4, and always got problem about energy minimization: Stopping criterion
= linesearch alpha is zero. The resulting elastic constant numbers are
unreasonably high, and change hugely with the variable {up}.

with only 24 atoms, you most definitely will have finite size effects.
you are running classical MD, which is "fast". so use the replicate
command to have something more reasonable and try again.

axel.

Does your pair style have energies that go
smoothly to 0.0 at the cutoff? If not, then the minimizer
will always have problems converging, whether you are running
the ELASTIC scripts or not. See the minimize doc page
for warnings about this.

Steve