Merged comments modification in EXTRA-COMPUTE/compute_born_matrix from A. Thompson and G. Clavier.
This commit is contained in:
@ -12,16 +12,15 @@ Syntax
|
||||
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* born/matrix = style name of this compute command
|
||||
* one or more keyword/value pairs may be appended
|
||||
* zero or more keyword/value pairs may be appended
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
keyword = *numdiff*
|
||||
*numdiff* values = delta virial-ID
|
||||
delta = magnitude of strain fields (dimensionless)
|
||||
delta = magnitude of strain (dimensionless)
|
||||
virial-ID = ID of pressure compute for virial (string)
|
||||
|
||||
*pair* or *bond* or *angle* or *dihedral* values = none
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
@ -36,7 +35,7 @@ Description
|
||||
|
||||
Define a compute that calculates
|
||||
:math:`\frac{\partial{}^2U}{\partial\varepsilon_{i}\partial\varepsilon_{j}}` the
|
||||
second derivatives of the potential energy :math:`U` with regard to strain
|
||||
second derivatives of the potential energy :math:`U` w.r.t. strain
|
||||
tensor :math:`\varepsilon` elements. These values are related to:
|
||||
|
||||
.. math::
|
||||
@ -62,9 +61,9 @@ tensor, :math:`\delta` is the Kronecker delta and the usual notation apply for
|
||||
the number of particle, the temperature and volume respectively :math:`N`,
|
||||
:math:`T` and :math:`V`. :math:`k_{B}` is the Boltzmann constant.
|
||||
|
||||
The Born term is a symmetric 6x6 matrix by construction and as such can be
|
||||
expressed as 21 independent terms. The terms are ordered corresponding to the
|
||||
following matrix element:
|
||||
The Born term is a symmetric 6x6 matrix, as is the matrix of second derivatives
|
||||
of potential energy w.r.t strain,
|
||||
whose 21 independent elements are output in this order:
|
||||
|
||||
.. math::
|
||||
|
||||
@ -77,9 +76,10 @@ following matrix element:
|
||||
\vdots & \vdots & \vdots & \vdots & C_{21} & C_{6}
|
||||
\end{matrix}
|
||||
|
||||
in this matrix the indices of :math:`C_{k}` value are the corresponding index
|
||||
:math:`k` in the compute output. Each term comes from the sum of every
|
||||
interactions derivatives in the system as explained in :ref:`(VanWorkum)
|
||||
in this matrix the indices of :math:`C_{k}` value are the corresponding element
|
||||
:math:`k` in the global vector output by this compute. Each term comes from the sum
|
||||
of the derivatives of every contribution to the potential energy
|
||||
in the system as explained in :ref:`(VanWorkum)
|
||||
<VanWorkum>` or :ref:`(Voyiatzis) <Voyiatzis>`.
|
||||
|
||||
The output can be accessed using usual Lammps routines:
|
||||
@ -111,15 +111,15 @@ Two different computation methods are implemented in this compute and are
|
||||
mutually exclusive.
|
||||
|
||||
The first one is a direct computation from the analytical formula from the
|
||||
different terms of the potential used for the simulations (see :ref: `(Vorkum)
|
||||
<_VanWorkum>`). However, the implementation of such derivations must be done
|
||||
different terms of the potential used for the simulations (see :ref:`(VanWorkum)
|
||||
<VanWorkum>`). However, the implementation of such derivations must be done
|
||||
for every potential form. This has not been done yet and can be very
|
||||
complicated for sophisticated potentials. At the moment a warning message is
|
||||
complicated for complex potentials. At the moment a warning message is
|
||||
displayed for every term that is not supporting the compute at the moment.
|
||||
This method is the default for now.
|
||||
|
||||
The second method uses finite differences of energy to numerically approximate
|
||||
the second derivatives (see :ref: `(Zhen) <_Zhen>`). This is useful when using
|
||||
the second derivatives (see :ref:`(Zhen) <Zhen>`). This is useful when using
|
||||
interaction styles for which the analytical second derivatives have not been
|
||||
implemented. In this cases, the compute applies linear strain fields of
|
||||
magnitude *delta* to all the atoms relative to a point at the center of the
|
||||
@ -161,9 +161,11 @@ requiring that it use the virial keyword e.g.
|
||||
|
||||
**Output info:**
|
||||
|
||||
This compute calculates a global array with the number of rows=21.
|
||||
This compute calculates a global vector with 21 values that are
|
||||
the second derivatives of the potential energy w.r.t. strain.
|
||||
The values are in energy units.
|
||||
The values are ordered as explained above. These values can be used
|
||||
by any command that uses a global values from a compute as input. See
|
||||
by any command that uses global values from a compute as input. See
|
||||
the :doc:`Howto output <Howto_output>` doc page for an overview of
|
||||
LAMMPS output options.
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# Time-averaged data for fix CB
|
||||
# TimeStep c_born[1] c_born[2] c_born[3] c_born[4] c_born[5] c_born[6] c_born[7] c_born[8] c_born[9] c_born[10] c_born[11] c_born[12] c_born[13] c_born[14] c_born[15] c_born[16] c_born[17] c_born[18] c_born[19] c_born[20] c_born[21]
|
||||
100000 9548.45 9583.86 9603.94 5344.22 5340.32 5332.84 5332.84 5340.32 6.76151 5.615 -4.57733 5344.22 2.92646 2.31369 -1.40512 -0.756072 2.34424 -1.68733 -1.68733 2.31369 6.76151
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
# Time-averaged data for fix CB
|
||||
# TimeStep c_born[1] c_born[2] c_born[3] c_born[4] c_born[5] c_born[6] c_born[7] c_born[8] c_born[9] c_born[10] c_born[11] c_born[12] c_born[13] c_born[14] c_born[15] c_born[16] c_born[17] c_born[18] c_born[19] c_born[20] c_born[21]
|
||||
100000 9504.48 9542.2 9561.01 5333.83 5329.43 5322.42 5322.45 5329.46 6.62317 5.91783 -4.83884 5333.63 2.95757 2.42725 -0.949434 -0.946756 1.95764 -1.6134 -1.48155 2.30577 6.76235
|
||||
File diff suppressed because it is too large
Load Diff
@ -3,10 +3,11 @@ scripts creating argon fcc crystal and computing the Born term using the two
|
||||
methods described in the documentation.
|
||||
|
||||
In the __Analytical__ directory the terms are computed using the analytical
|
||||
derivation of the lj/cut pair style.
|
||||
derivation of the Born term for the lj/cut pair style.
|
||||
|
||||
In the __Numdiff__ directory, the born term is evaluated through small
|
||||
In the __Numdiff__ directory, the Born term is evaluated through small
|
||||
numerical differences of the stress tensor. This method can be used with any
|
||||
interaction potential.
|
||||
|
||||
Both script show examples on how to compute the full Cij tensor in LAMMPS.
|
||||
Both script show examples on how to compute the full Cij elastic stiffness
|
||||
tensor in LAMMPS.
|
||||
1
examples/ELASTIC_T/DEFORMATION/Silicon/Si.sw
Symbolic link
1
examples/ELASTIC_T/DEFORMATION/Silicon/Si.sw
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../potentials/Si.sw
|
||||
@ -2,7 +2,7 @@
|
||||
# See in.elastic for more info.
|
||||
|
||||
# we must undefine any fix ave/* fix before using reset_timestep
|
||||
if "$(is_defined(fix,avp)" then "unfix avp"
|
||||
if "$(is_defined(fix,avp))" then "unfix avp"
|
||||
reset_timestep 0
|
||||
|
||||
# Choose potential
|
||||
@ -1,18 +0,0 @@
|
||||
# DATE: 2007-06-11 CONTRIBUTOR: Aidan Thompson, athomps@sandia.gov CITATION: Stillinger and Weber, Phys Rev B, 31, 5262, (1985)
|
||||
# Stillinger-Weber parameters for various elements and mixtures
|
||||
# multiple entries can be added to this file, LAMMPS reads the ones it needs
|
||||
# these entries are in LAMMPS "metal" units:
|
||||
# epsilon = eV; sigma = Angstroms
|
||||
# other quantities are unitless
|
||||
|
||||
# format of a single entry (one or more lines):
|
||||
# element 1, element 2, element 3,
|
||||
# epsilon, sigma, a, lambda, gamma, costheta0, A, B, p, q, tol
|
||||
|
||||
# Here are the original parameters in metal units, for Silicon from:
|
||||
#
|
||||
# Stillinger and Weber, Phys. Rev. B, v. 31, p. 5262, (1985)
|
||||
#
|
||||
|
||||
Si Si Si 2.1683 2.0951 1.80 21.0 1.20 -0.333333333333
|
||||
7.049556277 0.6022245584 4.0 0.0 0.0
|
||||
@ -94,7 +94,7 @@ msst: MSST shock dynamics
|
||||
nb3b: use of nonbonded 3-body harmonic pair style
|
||||
neb: nudged elastic band (NEB) calculation for barrier finding
|
||||
nemd: non-equilibrium MD of 2d sheared system
|
||||
numdiff: numerical difference computation of forces and virial
|
||||
numdiff: numerical difference computation of forces, virial, and Born matrix
|
||||
obstacle: flow around two voids in a 2d channel
|
||||
peptide: dynamics of a small solvated peptide chain (5-mer)
|
||||
peri: Peridynamic model of cylinder impacted by indenter
|
||||
@ -152,12 +152,19 @@ either by itself or in tandem with another code or library. See the
|
||||
COUPLE/README file to get started.
|
||||
|
||||
The ELASTIC directory has an example script for computing elastic
|
||||
constants at zero temperature, using an Si example. See the
|
||||
stiffness tensor (elastic constants)
|
||||
at zero temperature, using an Si example. See the
|
||||
ELASTIC/in.elastic file for more info.
|
||||
|
||||
The ELASTIC_T directory has an example script for computing elastic
|
||||
constants at finite temperature, using an Si example. See the
|
||||
ELASTIC_T/in.elastic file for more info.
|
||||
The ELASTIC_T directory has example scripts for the computing elastic
|
||||
stiffness tensor at finite temperature. Two different methods are
|
||||
demonstrated. DEFORMATION estimates the change in the average
|
||||
stress tensor between multiple simulations
|
||||
in which small finite deformations are made to the simulation cell.
|
||||
BORN_MATRIX runs a single simulation in which the Born matrix and stress
|
||||
fluctuations are averaged. The second method
|
||||
is newer in LAMMPS and is generally more efficient and
|
||||
more reliable.
|
||||
|
||||
The HEAT directory has example scripts for heat exchange algorithms
|
||||
(e.g. used for establishing a thermal gradient), using two different
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
# Numerical difference calculation
|
||||
# of Born matrix
|
||||
|
||||
# Note that because of cubic symmetry and central forces, we have:
|
||||
# C11, pure axial == positive mean value: 1,2,3
|
||||
# C44==C23, pure shear == positive mean value, exactly match in pairs: (4,12),(5,8),(6,7)
|
||||
# C14==C56, shear/axial(normal) == zero mean, exactly match in pairs: (9,21),(14,20),(18,19)
|
||||
# C15, shear/axial(in-plane) == zero mean: 10,11,13,15,16,17
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 50 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable nlat index 5 # size of box
|
||||
variable delta index 1.0e-6 # strain size
|
||||
variable temp index 0.3 # temperature
|
||||
variable rho index 0.8442 # reduced density
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc ${rho}
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
|
||||
velocity all create ${temp} 87287 loop geom
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
fix 1 all nvt temp ${temp} ${temp} 0.1
|
||||
|
||||
run 100
|
||||
|
||||
compute born all born/matrix
|
||||
thermo ${nthermo}
|
||||
thermo_style custom step temp pe press c_born[*]
|
||||
thermo_modify line multi
|
||||
|
||||
run ${nsteps}
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
# Numerical difference calculation
|
||||
# of Born matrix
|
||||
|
||||
# Note that because of cubic symmetry and central forces, we have:
|
||||
# C11, pure axial == positive mean value: 1,2,3
|
||||
# C44==C23, pure shear == positive mean value, (exactly) match in pairs: (4,12),(5,8),(6,7)
|
||||
# C14==C56, shear/axial(normal) == zero mean, (exactly) match in pairs: (9,21),(14,20),(18,19)
|
||||
# C15, shear/axial(in-plane) == zero mean: 10,11,13,15,16,17
|
||||
# the "(exactly)" above is because these symmetries seem to be sensitive to details
|
||||
# of how the finite shear deformations are applied
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 200 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable nlat index 5 # size of box
|
||||
variable delta index 1.0e-8 # strain size
|
||||
variable temp index 0.3 # temperature
|
||||
variable rho index 0.8442 # reduced density
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc ${rho}
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
|
||||
velocity all create ${temp} 87287 loop geom
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
fix 1 all nvt temp ${temp} ${temp} 0.1
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
compute bornnum all born/matrix numdiff ${delta} myvirial
|
||||
compute born all born/matrix
|
||||
variable bornrel vector 1.0-c_bornnum/c_born
|
||||
fix bornrel all ave/time 1 1 ${nthermo} v_bornrel start 100 mode vector ave running
|
||||
|
||||
thermo ${nthermo}
|
||||
thermo_style custom step temp pe press c_born[10] c_bornnum[10] &
|
||||
v_bornrel[1] v_bornrel[2] v_bornrel[3] v_bornrel[4] v_bornrel[5] v_bornrel[6] v_bornrel[7] v_bornrel[8] v_bornrel[9] v_bornrel[10] v_bornrel[11] v_bornrel[12] v_bornrel[13] v_bornrel[14] v_bornrel[15] v_bornrel[16] v_bornrel[17] v_bornrel[18] v_bornrel[19] v_bornrel[20] v_bornrel[21]
|
||||
thermo_modify line multi
|
||||
|
||||
run ${nsteps}
|
||||
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
# Numerical difference calculation
|
||||
# of Born matrix
|
||||
|
||||
# Note that because of cubic symmetry and central forces, we have:
|
||||
# C11, pure axial == positive mean value: 1,2,3
|
||||
# C44==C23, pure shear == positive mean value, (exactly) match in pairs: (4,12),(5,8),(6,7)
|
||||
# C14==C56, shear/axial(normal) == zero mean, (exactly) match in pairs: (9,21),(14,20),(18,19)
|
||||
# C15, shear/axial(in-plane) == zero mean: 10,11,13,15,16,17
|
||||
# the "(exactly)" above is because these symmetries seem to be sensitive to details
|
||||
# of how the finite shear deformations are applied
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 50 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable nlat index 5 # size of box
|
||||
variable delta index 1.0e-6 # strain size
|
||||
variable temp index 0.3 # temperature
|
||||
variable rho index 0.8442 # reduced density
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc ${rho}
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
|
||||
velocity all create ${temp} 87287 loop geom
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
fix 1 all nvt temp ${temp} ${temp} 0.1
|
||||
|
||||
run 100
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
compute born all born/matrix numdiff ${delta} myvirial
|
||||
thermo ${nthermo}
|
||||
thermo_style custom step temp pe press c_myvirial[*] c_born[*]
|
||||
thermo_modify line multi
|
||||
|
||||
run ${nsteps}
|
||||
|
||||
|
||||
@ -1,102 +0,0 @@
|
||||
LAMMPS (7 Jan 2022)
|
||||
# Numerical difference calculation
|
||||
# of Born matrix
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 50 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable delta index 1.0e-6 # strain size
|
||||
variable temp index 0.3 # temperature
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 0.8442
|
||||
Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 3 0 ${nlat}
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (5.0387886 5.0387886 5.0387886)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (5.0387886 5.0387886 5.0387886)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 1.0
|
||||
|
||||
velocity all create ${temp} 87287 loop geom
|
||||
velocity all create 0.3 87287 loop geom
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
compute born all born/matrix
|
||||
thermo ${nthermo}
|
||||
thermo 10
|
||||
thermo_style custom step temp pe press c_born[*]
|
||||
|
||||
run ${nsteps}
|
||||
run 50
|
||||
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 2.5
|
||||
ghost atom cutoff = 2.5
|
||||
binsize = 1.25, bins = 5 5 5
|
||||
2 neighbor lists, perpetual/occasional/extra = 1 1 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
(2) compute born/matrix, occasional, copy from (1)
|
||||
attributes: half, newton on
|
||||
pair build: copy
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 2.574 | 2.574 | 2.574 Mbytes
|
||||
Step Temp PotEng Press c_born[1] c_born[2] c_born[3] c_born[4] c_born[5] c_born[6] c_born[7] c_born[8] c_born[9] c_born[10] c_born[11] c_born[12] c_born[13] c_born[14] c_born[15] c_born[16] c_born[17] c_born[18] c_born[19] c_born[20] c_born[21]
|
||||
0 0.3 -6.7733681 -5.9844023 411.5161 411.5161 411.5161 595.57522 595.57522 595.57522 595.57522 595.57522 -2.7200464e-15 -6.1062266e-15 7.7715612e-16 595.57522 -1.1518564e-14 -3.3306691e-15 -5.3013149e-15 -1.0630385e-14 -6.800116e-15 -2.6367797e-15 -3.4139358e-15 -3.7747583e-15 -2.7200464e-15
|
||||
10 0.25283594 -6.703292 -5.5569889 891.93989 928.15437 944.55768 872.69866 852.24088 816.0675 816.0675 852.24088 10.111334 3.6921122 -6.3839362 872.69866 -4.6709643 4.4335317 -9.7018557 -4.5201548 3.7624526 11.200776 11.200776 4.4335317 10.111334
|
||||
20 0.13298345 -6.5218396 -4.5683635 1958.2215 2130.5784 2172.9636 1516.3032 1426.6019 1323.0834 1323.0834 1426.6019 39.867158 11.406477 -25.845853 1516.3032 3.3483658 27.179119 -36.809191 10.147948 7.0018777 41.995438 41.995438 27.179119 39.867158
|
||||
30 0.089302796 -6.4604227 -4.1807379 2401.2346 2625.1676 2638.9312 1724.973 1625.4639 1602.8817 1602.8817 1625.4639 55.594925 -101.03316 -41.689385 1724.973 35.280816 26.589804 -40.046683 63.973353 -78.086653 41.559746 41.559746 26.589804 55.594925
|
||||
40 0.12149354 -6.5076059 -4.4000835 2234.612 2345.8821 2337.9552 1513.845 1486.9674 1564.2263 1564.2263 1486.9674 56.775913 -199.0226 -45.302207 1513.845 27.333643 -9.5839331 -16.768077 120.5015 -141.06684 17.802047 17.802047 -9.5839331 56.775913
|
||||
50 0.13053032 -6.5204024 -4.5064456 2097.1985 2270.3252 2180.7348 1458.5923 1396.6336 1507.4402 1507.4402 1396.6336 37.603097 -213.85355 22.82129 1458.5923 47.47204 -20.546302 54.328025 195.36071 -169.33495 -24.624815 -24.624815 -20.546302 37.603097
|
||||
Loop time of 0.00790344 on 1 procs for 50 steps with 108 atoms
|
||||
|
||||
Performance: 2732988.192 tau/day, 6326.362 timesteps/s
|
||||
98.9% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.0014593 | 0.0014593 | 0.0014593 | 0.0 | 18.46
|
||||
Neigh | 0.0047863 | 0.0047863 | 0.0047863 | 0.0 | 60.56
|
||||
Comm | 0.00057975 | 0.00057975 | 0.00057975 | 0.0 | 7.34
|
||||
Output | 0.00096954 | 0.00096954 | 0.00096954 | 0.0 | 12.27
|
||||
Modify | 5.3432e-05 | 5.3432e-05 | 5.3432e-05 | 0.0 | 0.68
|
||||
Other | | 5.508e-05 | | | 0.70
|
||||
|
||||
Nlocal: 108 ave 108 max 108 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 700 ave 700 max 700 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 2909 ave 2909 max 2909 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 2909
|
||||
Ave neighs/atom = 26.935185
|
||||
Neighbor list builds = 50
|
||||
Dangerous builds not checked
|
||||
|
||||
Total wall time: 0:00:00
|
||||
@ -1,102 +0,0 @@
|
||||
LAMMPS (7 Jan 2022)
|
||||
# Numerical difference calculation
|
||||
# of Born matrix
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 50 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable delta index 1.0e-6 # strain size
|
||||
variable temp index 0.3 # temperature
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 0.8442
|
||||
Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 3 0 ${nlat}
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (5.0387886 5.0387886 5.0387886)
|
||||
1 by 2 by 2 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (5.0387886 5.0387886 5.0387886)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 1.0
|
||||
|
||||
velocity all create ${temp} 87287 loop geom
|
||||
velocity all create 0.3 87287 loop geom
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
compute born all born/matrix
|
||||
thermo ${nthermo}
|
||||
thermo 10
|
||||
thermo_style custom step temp pe press c_born[*]
|
||||
|
||||
run ${nsteps}
|
||||
run 50
|
||||
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 2.5
|
||||
ghost atom cutoff = 2.5
|
||||
binsize = 1.25, bins = 5 5 5
|
||||
2 neighbor lists, perpetual/occasional/extra = 1 1 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
(2) compute born/matrix, occasional, copy from (1)
|
||||
attributes: half, newton on
|
||||
pair build: copy
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 2.561 | 2.561 | 2.561 Mbytes
|
||||
Step Temp PotEng Press c_born[1] c_born[2] c_born[3] c_born[4] c_born[5] c_born[6] c_born[7] c_born[8] c_born[9] c_born[10] c_born[11] c_born[12] c_born[13] c_born[14] c_born[15] c_born[16] c_born[17] c_born[18] c_born[19] c_born[20] c_born[21]
|
||||
0 0.3 -6.7733681 -5.9844023 411.5161 411.5161 411.5161 595.57522 595.57522 595.57522 595.57522 595.57522 -2.9143354e-15 -1.9984014e-15 1.8873791e-15 595.57522 -9.7560848e-15 -3.3029135e-15 -9.6311847e-15 -1.2281842e-14 -5.3568261e-15 -2.5257574e-15 -3.2196468e-15 -3.5804693e-15 -2.553513e-15
|
||||
10 0.25283594 -6.703292 -5.5569889 891.93989 928.15437 944.55768 872.69866 852.24088 816.0675 816.0675 852.24088 10.111334 3.6921122 -6.3839362 872.69866 -4.6709643 4.4335317 -9.7018557 -4.5201548 3.7624526 11.200776 11.200776 4.4335317 10.111334
|
||||
20 0.13298345 -6.5218396 -4.5683635 1958.2215 2130.5784 2172.9636 1516.3032 1426.6019 1323.0834 1323.0834 1426.6019 39.867158 11.406477 -25.845853 1516.3032 3.3483658 27.179119 -36.809191 10.147948 7.0018777 41.995438 41.995438 27.179119 39.867158
|
||||
30 0.089302796 -6.4604227 -4.1807379 2401.2346 2625.1676 2638.9312 1724.973 1625.4639 1602.8817 1602.8817 1625.4639 55.594925 -101.03316 -41.689385 1724.973 35.280816 26.589804 -40.046683 63.973353 -78.086653 41.559746 41.559746 26.589804 55.594925
|
||||
40 0.12149354 -6.5076059 -4.4000835 2234.612 2345.8821 2337.9552 1513.845 1486.9674 1564.2263 1564.2263 1486.9674 56.775913 -199.0226 -45.302207 1513.845 27.333643 -9.5839331 -16.768077 120.5015 -141.06684 17.802047 17.802047 -9.5839331 56.775913
|
||||
50 0.13053032 -6.5204024 -4.5064456 2097.1985 2270.3252 2180.7348 1458.5923 1396.6336 1507.4402 1507.4402 1396.6336 37.603097 -213.85355 22.82129 1458.5923 47.47204 -20.546302 54.328025 195.36071 -169.33495 -24.624815 -24.624815 -20.546302 37.603097
|
||||
Loop time of 0.00293746 on 4 procs for 50 steps with 108 atoms
|
||||
|
||||
Performance: 7353280.980 tau/day, 17021.484 timesteps/s
|
||||
99.2% CPU use with 4 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.00037884 | 0.00040147 | 0.00041828 | 0.0 | 13.67
|
||||
Neigh | 0.0010222 | 0.0011142 | 0.0011623 | 0.2 | 37.93
|
||||
Comm | 0.00098867 | 0.0010309 | 0.0011341 | 0.2 | 35.09
|
||||
Output | 0.00030288 | 0.00031473 | 0.00034979 | 0.0 | 10.71
|
||||
Modify | 2.0147e-05 | 2.218e-05 | 2.3691e-05 | 0.0 | 0.76
|
||||
Other | | 5.406e-05 | | | 1.84
|
||||
|
||||
Nlocal: 27 ave 31 max 25 min
|
||||
Histogram: 2 0 0 1 0 0 0 0 0 1
|
||||
Nghost: 429.75 ave 450 max 409 min
|
||||
Histogram: 1 0 0 0 0 2 0 0 0 1
|
||||
Neighs: 727.25 ave 845 max 651 min
|
||||
Histogram: 1 0 1 1 0 0 0 0 0 1
|
||||
|
||||
Total # of neighbors = 2909
|
||||
Ave neighs/atom = 26.935185
|
||||
Neighbor list builds = 50
|
||||
Dangerous builds not checked
|
||||
|
||||
Total wall time: 0:00:00
|
||||
@ -1,8 +1,11 @@
|
||||
# LAMMPS FIX NUMDIFF EXAMPLE
|
||||
# LAMMPS NUMDIFF EXAMPLES FOR FORCES, VIRIAL, and BORN MATRIX
|
||||
|
||||
## Numerical Difference Fix
|
||||
## Numerical Difference Fixes and Computes
|
||||
|
||||
This directory contains the ingredients to run an NVE simulation using the numerical difference fix and calculate error in forces.
|
||||
This directory contains the input script for an NVE simulation with
|
||||
fix numdiff, fix numdiff/virial, and compute born/matrix numdiff.
|
||||
In each cases, results are compared to exact analytic expressions
|
||||
and the small relative differences are reported.
|
||||
|
||||
Example:
|
||||
```
|
||||
@ -10,4 +13,4 @@ NP=4 #number of processors
|
||||
mpirun -np $NP lmp_mpi -in.numdiff
|
||||
```
|
||||
|
||||
## Required LAMMPS packages: MOLECULE package
|
||||
## Required LAMMPS packages: EXTRA-FIX, EXTRA-COMPUTE
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Numerical difference calculation
|
||||
# of error in forces and virial stress
|
||||
# of error in forces, virial stress, and Born matrix
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
@ -8,8 +8,10 @@ variable nthermo index 10 # thermo output interval
|
||||
variable ndump index 500 # dump output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable fdelta index 1.0e-4 # displacement size
|
||||
variable vdelta index 1.0e-6 # strain size
|
||||
variable vdelta index 1.0e-6 # strain size for numdiff/virial
|
||||
variable bdelta index 1.0e-8 # strain size for numdiff Born matrix
|
||||
variable temp index 10.0 # temperature
|
||||
variable nugget equal 1.0e-6 # regularization for relerr
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
@ -23,8 +25,8 @@ mass 1 39.903
|
||||
|
||||
velocity all create ${temp} 2357 mom yes dist gaussian
|
||||
|
||||
pair_style lj/cubic
|
||||
pair_coeff * * 0.0102701 3.42
|
||||
pair_style lj/cut 5.0
|
||||
pair_coeff 1 1 0.0102701 3.42
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
@ -42,7 +44,7 @@ variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2
|
||||
compute faverrsq all reduce ave v_ferrsq
|
||||
variable fsq atom fx^2+fy^2+fz^2
|
||||
compute favsq all reduce ave v_fsq
|
||||
variable frelerr equal sqrt(c_faverrsq/c_favsq)
|
||||
variable frelerr equal sqrt(c_faverrsq/(c_favsq+${nugget}))
|
||||
dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz
|
||||
|
||||
# define numerical virial stress tensor calculation
|
||||
@ -67,8 +69,59 @@ variable vsq equal "c_myvirial[1]^2 + &
|
||||
c_myvirial[4]^2 + &
|
||||
c_myvirial[5]^2 + &
|
||||
c_myvirial[6]^2"
|
||||
variable vrelerr equal sqrt(v_verrsq/v_vsq)
|
||||
variable vrelerr equal sqrt(v_verrsq/(v_vsq+${nugget}))
|
||||
|
||||
thermo_style custom step temp pe etotal press v_frelerr v_vrelerr
|
||||
# define numerical Born matrix calculation
|
||||
|
||||
compute bornnum all born/matrix numdiff ${bdelta} myvirial
|
||||
compute born all born/matrix
|
||||
variable berr vector c_bornnum-c_born
|
||||
variable berrsq equal "v_berr[1]^2 + &
|
||||
v_berr[2]^2 + &
|
||||
v_berr[3]^2 + &
|
||||
v_berr[4]^2 + &
|
||||
v_berr[5]^2 + &
|
||||
v_berr[6]^2 + &
|
||||
v_berr[7]^2 + &
|
||||
v_berr[8]^2 + &
|
||||
v_berr[9]^2 + &
|
||||
v_berr[10]^2 + &
|
||||
v_berr[11]^2 + &
|
||||
v_berr[12]^2 + &
|
||||
v_berr[13]^2 + &
|
||||
v_berr[14]^2 + &
|
||||
v_berr[15]^2 + &
|
||||
v_berr[16]^2 + &
|
||||
v_berr[17]^2 + &
|
||||
v_berr[18]^2 + &
|
||||
v_berr[19]^2 + &
|
||||
v_berr[20]^2 + &
|
||||
v_berr[21]^2"
|
||||
|
||||
variable bsq equal "c_born[1]^2 + &
|
||||
c_born[2]^2 + &
|
||||
c_born[3]^2 + &
|
||||
c_born[4]^2 + &
|
||||
c_born[5]^2 + &
|
||||
c_born[6]^2 + &
|
||||
c_born[7]^2 + &
|
||||
c_born[8]^2 + &
|
||||
c_born[9]^2 + &
|
||||
c_born[10]^2 + &
|
||||
c_born[11]^2 + &
|
||||
c_born[12]^2 + &
|
||||
c_born[13]^2 + &
|
||||
c_born[14]^2 + &
|
||||
c_born[15]^2 + &
|
||||
c_born[16]^2 + &
|
||||
c_born[17]^2 + &
|
||||
c_born[18]^2 + &
|
||||
c_born[19]^2 + &
|
||||
c_born[20]^2 + &
|
||||
c_born[21]^2"
|
||||
|
||||
variable brelerr equal sqrt(v_berrsq/(v_bsq+${nugget}))
|
||||
|
||||
thermo_style custom step temp pe etotal press v_frelerr v_vrelerr v_brelerr
|
||||
thermo ${nthermo}
|
||||
run ${nsteps}
|
||||
|
||||
197
examples/numdiff/log.19Feb2022.log.numdiff.g++.1
Normal file
197
examples/numdiff/log.19Feb2022.log.numdiff.g++.1
Normal file
@ -0,0 +1,197 @@
|
||||
LAMMPS (7 Jan 2022)
|
||||
# Numerical difference calculation
|
||||
# of error in forces, virial stress, and Born matrix
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 500 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable ndump index 500 # dump output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable fdelta index 1.0e-4 # displacement size
|
||||
variable vdelta index 1.0e-6 # strain size for numdiff/virial
|
||||
variable bdelta index 1.0e-8 # strain size for numdiff Born matrix
|
||||
variable temp index 10.0 # temperature
|
||||
variable nugget equal 1.0e-6 # regularization for relerr
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
atom_modify map yes
|
||||
lattice fcc 5.358000
|
||||
Lattice spacing in x,y,z = 5.358 5.358 5.358
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 3 0 ${nlat}
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 39.903
|
||||
|
||||
velocity all create ${temp} 2357 mom yes dist gaussian
|
||||
velocity all create 10.0 2357 mom yes dist gaussian
|
||||
|
||||
pair_style lj/cut 5.0
|
||||
pair_coeff 1 1 0.0102701 3.42
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
timestep 0.001
|
||||
fix nve all nve
|
||||
|
||||
# define numerical force calculation
|
||||
|
||||
fix numforce all numdiff ${nthermo} ${fdelta}
|
||||
fix numforce all numdiff 10 ${fdelta}
|
||||
fix numforce all numdiff 10 1.0e-4
|
||||
variable ferrx atom f_numforce[1]-fx
|
||||
variable ferry atom f_numforce[2]-fy
|
||||
variable ferrz atom f_numforce[3]-fz
|
||||
variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2
|
||||
compute faverrsq all reduce ave v_ferrsq
|
||||
variable fsq atom fx^2+fy^2+fz^2
|
||||
compute favsq all reduce ave v_fsq
|
||||
variable frelerr equal sqrt(c_faverrsq/(c_favsq+${nugget}))
|
||||
variable frelerr equal sqrt(c_faverrsq/(c_favsq+1e-06))
|
||||
dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz
|
||||
dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz
|
||||
|
||||
# define numerical virial stress tensor calculation
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
fix numvirial all numdiff/virial ${nthermo} ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 1.0e-6
|
||||
variable errxx equal f_numvirial[1]-c_myvirial[1]
|
||||
variable erryy equal f_numvirial[2]-c_myvirial[2]
|
||||
variable errzz equal f_numvirial[3]-c_myvirial[3]
|
||||
variable erryz equal f_numvirial[4]-c_myvirial[6]
|
||||
variable errxz equal f_numvirial[5]-c_myvirial[5]
|
||||
variable errxy equal f_numvirial[6]-c_myvirial[4]
|
||||
variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2"
|
||||
variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2"
|
||||
variable vrelerr equal sqrt(v_verrsq/(v_vsq+${nugget}))
|
||||
variable vrelerr equal sqrt(v_verrsq/(v_vsq+1e-06))
|
||||
|
||||
# define numerical Born matrix calculation
|
||||
|
||||
compute bornnum all born/matrix numdiff ${bdelta} myvirial
|
||||
compute bornnum all born/matrix numdiff 1.0e-8 myvirial
|
||||
compute born all born/matrix
|
||||
variable berr vector c_bornnum-c_born
|
||||
variable berrsq equal "v_berr[1]^2 + v_berr[2]^2 + v_berr[3]^2 + v_berr[4]^2 + v_berr[5]^2 + v_berr[6]^2 + v_berr[7]^2 + v_berr[8]^2 + v_berr[9]^2 + v_berr[10]^2 + v_berr[11]^2 + v_berr[12]^2 + v_berr[13]^2 + v_berr[14]^2 + v_berr[15]^2 + v_berr[16]^2 + v_berr[17]^2 + v_berr[18]^2 + v_berr[19]^2 + v_berr[20]^2 + v_berr[21]^2"
|
||||
|
||||
variable bsq equal "c_born[1]^2 + c_born[2]^2 + c_born[3]^2 + c_born[4]^2 + c_born[5]^2 + c_born[6]^2 + c_born[7]^2 + c_born[8]^2 + c_born[9]^2 + c_born[10]^2 + c_born[11]^2 + c_born[12]^2 + c_born[13]^2 + c_born[14]^2 + c_born[15]^2 + c_born[16]^2 + c_born[17]^2 + c_born[18]^2 + c_born[19]^2 + c_born[20]^2 + c_born[21]^2"
|
||||
|
||||
variable brelerr equal sqrt(v_berrsq/(v_bsq+${nugget}))
|
||||
variable brelerr equal sqrt(v_berrsq/(v_bsq+1e-06))
|
||||
|
||||
thermo_style custom step temp pe etotal press v_frelerr v_vrelerr v_brelerr
|
||||
thermo ${nthermo}
|
||||
thermo 10
|
||||
run ${nsteps}
|
||||
run 500
|
||||
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5
|
||||
ghost atom cutoff = 5
|
||||
binsize = 2.5, bins = 7 7 7
|
||||
2 neighbor lists, perpetual/occasional/extra = 1 1 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
(2) compute born/matrix, occasional, copy from (1)
|
||||
attributes: half, newton on
|
||||
pair build: copy
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 6.823 | 6.823 | 6.823 Mbytes
|
||||
Step Temp PotEng TotEng Press v_frelerr v_vrelerr v_brelerr
|
||||
0 10 -6.6101864 -6.471878 947.70558 5.7012262e-09 1.4849734e-08 9.072204e-09
|
||||
10 9.9357441 -6.6092976 -6.471878 949.3486 1.3828998e-08 1.9248385e-09 3.0140952e-09
|
||||
20 9.7444561 -6.6066519 -6.4718779 954.23637 1.385204e-08 1.7476399e-09 2.8104946e-09
|
||||
30 9.4311148 -6.6023181 -6.4718779 962.23331 1.4147226e-08 1.7647816e-09 3.038408e-09
|
||||
40 9.0043293 -6.5964152 -6.4718778 973.10762 1.4128155e-08 1.6390138e-09 3.1677083e-09
|
||||
50 8.4762135 -6.5891108 -6.4718777 986.53572 1.4168048e-08 2.3910821e-09 3.2880496e-09
|
||||
60 7.8621735 -6.5806179 -6.4718775 1002.1092 1.411958e-08 2.0683414e-09 2.650625e-09
|
||||
70 7.1805874 -6.5711908 -6.4718773 1019.3448 1.4139911e-08 1.6084571e-09 2.7690475e-09
|
||||
80 6.4523557 -6.5611186 -6.4718771 1037.6974 1.4105096e-08 1.9929271e-09 3.7464396e-09
|
||||
90 5.7003071 -6.5507169 -6.4718769 1056.5767 1.4084183e-08 1.750579e-09 4.1502319e-09
|
||||
100 4.9484503 -6.5403179 -6.4718767 1075.3674 1.4063796e-08 1.0250271e-09 3.0940885e-09
|
||||
110 4.221081 -6.5302576 -6.4718765 1093.4526 1.400901e-08 1.389277e-09 3.3111451e-09
|
||||
120 3.5417733 -6.520862 -6.4718763 1110.2388 1.4038158e-08 8.6231891e-10 2.6872042e-09
|
||||
130 2.9323072 -6.5124324 -6.4718762 1125.183 1.4048645e-08 7.0840985e-10 2.5616823e-09
|
||||
140 2.411607 -6.5052306 -6.471876 1137.8182 1.3968429e-08 1.8508015e-09 3.984183e-09
|
||||
150 1.9947801 -6.4994654 -6.4718759 1147.7764 1.395965e-08 1.9484728e-09 3.8459442e-09
|
||||
160 1.6923481 -6.4952825 -6.4718759 1154.8063 1.3948606e-08 1.5275137e-09 3.4566825e-09
|
||||
170 1.5097515 -6.492757 -6.4718759 1158.7853 1.3845523e-08 1.5455e-09 2.4291888e-09
|
||||
180 1.4471795 -6.4918916 -6.4718759 1159.7221 1.3788451e-08 1.578099e-09 2.2452653e-09
|
||||
190 1.4997431 -6.4926187 -6.471876 1157.7529 1.374841e-08 2.142073e-09 2.3614867e-09
|
||||
200 1.6579637 -6.4948072 -6.4718761 1153.1286 1.3674788e-08 2.111894e-09 3.4774073e-09
|
||||
210 1.908522 -6.4982727 -6.4718763 1146.1965 1.3639408e-08 1.2386489e-09 2.1550029e-09
|
||||
220 2.23518 -6.5027908 -6.4718764 1137.3775 1.3524209e-08 1.7016573e-09 3.3806952e-09
|
||||
230 2.6197892 -6.5081105 -6.4718766 1127.1415 1.3344007e-08 1.5843477e-09 2.9517742e-09
|
||||
240 3.043298 -6.5139681 -6.4718768 1115.9815 1.3245227e-08 1.5502368e-09 3.7751316e-09
|
||||
250 3.4866901 -6.5201007 -6.4718769 1104.3906 1.3080142e-08 1.369987e-09 3.1015926e-09
|
||||
260 3.9318061 -6.5262572 -6.4718771 1092.84 1.2885339e-08 1.0743728e-09 3.2781775e-09
|
||||
270 4.3620216 -6.5322076 -6.4718772 1081.7617 1.2705966e-08 1.3618619e-09 3.2074528e-09
|
||||
280 4.7627723 -6.5377504 -6.4718773 1071.5341 1.2480463e-08 1.4346869e-09 2.6014531e-09
|
||||
290 5.1219322 -6.542718 -6.4718774 1062.4716 1.2434727e-08 2.1935942e-09 2.8738025e-09
|
||||
300 5.4300557 -6.5469796 -6.4718774 1054.8177 1.2321314e-08 8.2365886e-10 3.0321861e-09
|
||||
310 5.6804997 -6.5504435 -6.4718774 1048.7409 1.2300884e-08 1.4855741e-09 3.0631008e-09
|
||||
320 5.8694423 -6.5530567 -6.4718774 1044.3341 1.2483087e-08 1.8711589e-09 3.9505726e-09
|
||||
330 5.9958115 -6.5548045 -6.4718774 1041.6165 1.2627617e-08 1.9256986e-09 2.0214697e-09
|
||||
340 6.0611353 -6.555708 -6.4718774 1040.5369 1.2935701e-08 1.6609255e-09 3.0860271e-09
|
||||
350 6.0693222 -6.5558211 -6.4718773 1040.9803 1.3218179e-08 1.985355e-09 2.8012116e-09
|
||||
360 6.0263776 -6.5552271 -6.4718773 1042.7755 1.3471701e-08 1.5125203e-09 2.8686484e-09
|
||||
370 5.9400629 -6.5540332 -6.4718772 1045.7049 1.3676495e-08 1.7364093e-09 2.578312e-09
|
||||
380 5.8195019 -6.5523657 -6.4718771 1049.515 1.3859995e-08 1.6834835e-09 2.9599336e-09
|
||||
390 5.6747442 -6.5503635 -6.471877 1053.9288 1.3987553e-08 1.7893896e-09 2.5163687e-09
|
||||
400 5.5162948 -6.5481719 -6.4718769 1058.6583 1.4091878e-08 1.4468098e-09 2.1565248e-09
|
||||
410 5.3546269 -6.5459358 -6.4718768 1063.4182 1.4188438e-08 1.7231047e-09 2.8650537e-09
|
||||
420 5.1996958 -6.5437929 -6.4718768 1067.9384 1.4205207e-08 1.3551982e-09 4.5778887e-09
|
||||
430 5.0604771 -6.5418673 -6.4718767 1071.9767 1.4267199e-08 1.361845e-09 3.0381078e-09
|
||||
440 4.9445529 -6.5402639 -6.4718766 1075.3292 1.4253464e-08 1.3945282e-09 2.820632e-09
|
||||
450 4.8577717 -6.5390637 -6.4718766 1077.8394 1.4240998e-08 1.8767323e-09 3.4379833e-09
|
||||
460 4.8040023 -6.53832 -6.4718766 1079.4048 1.4242259e-08 1.4785379e-09 4.399133e-09
|
||||
470 4.7849977 -6.5380571 -6.4718766 1079.9795 1.4227939e-08 1.8623848e-09 3.0102588e-09
|
||||
480 4.8003794 -6.5382699 -6.4718766 1079.5756 1.4215836e-08 1.2821795e-09 3.0643976e-09
|
||||
490 4.8477405 -6.538925 -6.4718767 1078.2596 1.4186541e-08 2.47604e-09 3.3809071e-09
|
||||
500 4.9228588 -6.539964 -6.4718767 1076.1469 1.4099819e-08 1.6653302e-09 3.4324143e-09
|
||||
Loop time of 0.476785 on 1 procs for 500 steps with 108 atoms
|
||||
|
||||
Performance: 90.607 ns/day, 0.265 hours/ns, 1048.692 timesteps/s
|
||||
99.6% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.0043699 | 0.0043699 | 0.0043699 | 0.0 | 0.92
|
||||
Neigh | 0.026529 | 0.026529 | 0.026529 | 0.0 | 5.56
|
||||
Comm | 0.0026272 | 0.0026272 | 0.0026272 | 0.0 | 0.55
|
||||
Output | 0.014971 | 0.014971 | 0.014971 | 0.0 | 3.14
|
||||
Modify | 0.42777 | 0.42777 | 0.42777 | 0.0 | 89.72
|
||||
Other | | 0.0005208 | | | 0.11
|
||||
|
||||
Nlocal: 108 ave 108 max 108 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 256 ave 256 max 256 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 648 ave 648 max 648 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 648
|
||||
Ave neighs/atom = 6
|
||||
Neighbor list builds = 500
|
||||
Dangerous builds not checked
|
||||
Total wall time: 0:00:00
|
||||
197
examples/numdiff/log.19Feb2022.log.numdiff.g++.4
Normal file
197
examples/numdiff/log.19Feb2022.log.numdiff.g++.4
Normal file
@ -0,0 +1,197 @@
|
||||
LAMMPS (7 Jan 2022)
|
||||
# Numerical difference calculation
|
||||
# of error in forces, virial stress, and Born matrix
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 500 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable ndump index 500 # dump output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable fdelta index 1.0e-4 # displacement size
|
||||
variable vdelta index 1.0e-6 # strain size for numdiff/virial
|
||||
variable bdelta index 1.0e-8 # strain size for numdiff Born matrix
|
||||
variable temp index 10.0 # temperature
|
||||
variable nugget equal 1.0e-6 # regularization for relerr
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
atom_modify map yes
|
||||
lattice fcc 5.358000
|
||||
Lattice spacing in x,y,z = 5.358 5.358 5.358
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 3 0 ${nlat}
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
1 by 2 by 2 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 39.903
|
||||
|
||||
velocity all create ${temp} 2357 mom yes dist gaussian
|
||||
velocity all create 10.0 2357 mom yes dist gaussian
|
||||
|
||||
pair_style lj/cut 5.0
|
||||
pair_coeff 1 1 0.0102701 3.42
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
timestep 0.001
|
||||
fix nve all nve
|
||||
|
||||
# define numerical force calculation
|
||||
|
||||
fix numforce all numdiff ${nthermo} ${fdelta}
|
||||
fix numforce all numdiff 10 ${fdelta}
|
||||
fix numforce all numdiff 10 1.0e-4
|
||||
variable ferrx atom f_numforce[1]-fx
|
||||
variable ferry atom f_numforce[2]-fy
|
||||
variable ferrz atom f_numforce[3]-fz
|
||||
variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2
|
||||
compute faverrsq all reduce ave v_ferrsq
|
||||
variable fsq atom fx^2+fy^2+fz^2
|
||||
compute favsq all reduce ave v_fsq
|
||||
variable frelerr equal sqrt(c_faverrsq/(c_favsq+${nugget}))
|
||||
variable frelerr equal sqrt(c_faverrsq/(c_favsq+1e-06))
|
||||
dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz
|
||||
dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz
|
||||
|
||||
# define numerical virial stress tensor calculation
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
fix numvirial all numdiff/virial ${nthermo} ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 1.0e-6
|
||||
variable errxx equal f_numvirial[1]-c_myvirial[1]
|
||||
variable erryy equal f_numvirial[2]-c_myvirial[2]
|
||||
variable errzz equal f_numvirial[3]-c_myvirial[3]
|
||||
variable erryz equal f_numvirial[4]-c_myvirial[6]
|
||||
variable errxz equal f_numvirial[5]-c_myvirial[5]
|
||||
variable errxy equal f_numvirial[6]-c_myvirial[4]
|
||||
variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2"
|
||||
variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2"
|
||||
variable vrelerr equal sqrt(v_verrsq/(v_vsq+${nugget}))
|
||||
variable vrelerr equal sqrt(v_verrsq/(v_vsq+1e-06))
|
||||
|
||||
# define numerical Born matrix calculation
|
||||
|
||||
compute bornnum all born/matrix numdiff ${bdelta} myvirial
|
||||
compute bornnum all born/matrix numdiff 1.0e-8 myvirial
|
||||
compute born all born/matrix
|
||||
variable berr vector c_bornnum-c_born
|
||||
variable berrsq equal "v_berr[1]^2 + v_berr[2]^2 + v_berr[3]^2 + v_berr[4]^2 + v_berr[5]^2 + v_berr[6]^2 + v_berr[7]^2 + v_berr[8]^2 + v_berr[9]^2 + v_berr[10]^2 + v_berr[11]^2 + v_berr[12]^2 + v_berr[13]^2 + v_berr[14]^2 + v_berr[15]^2 + v_berr[16]^2 + v_berr[17]^2 + v_berr[18]^2 + v_berr[19]^2 + v_berr[20]^2 + v_berr[21]^2"
|
||||
|
||||
variable bsq equal "c_born[1]^2 + c_born[2]^2 + c_born[3]^2 + c_born[4]^2 + c_born[5]^2 + c_born[6]^2 + c_born[7]^2 + c_born[8]^2 + c_born[9]^2 + c_born[10]^2 + c_born[11]^2 + c_born[12]^2 + c_born[13]^2 + c_born[14]^2 + c_born[15]^2 + c_born[16]^2 + c_born[17]^2 + c_born[18]^2 + c_born[19]^2 + c_born[20]^2 + c_born[21]^2"
|
||||
|
||||
variable brelerr equal sqrt(v_berrsq/(v_bsq+${nugget}))
|
||||
variable brelerr equal sqrt(v_berrsq/(v_bsq+1e-06))
|
||||
|
||||
thermo_style custom step temp pe etotal press v_frelerr v_vrelerr v_brelerr
|
||||
thermo ${nthermo}
|
||||
thermo 10
|
||||
run ${nsteps}
|
||||
run 500
|
||||
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5
|
||||
ghost atom cutoff = 5
|
||||
binsize = 2.5, bins = 7 7 7
|
||||
2 neighbor lists, perpetual/occasional/extra = 1 1 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
(2) compute born/matrix, occasional, copy from (1)
|
||||
attributes: half, newton on
|
||||
pair build: copy
|
||||
stencil: none
|
||||
bin: none
|
||||
Per MPI rank memory allocation (min/avg/max) = 6.816 | 6.816 | 6.816 Mbytes
|
||||
Step Temp PotEng TotEng Press v_frelerr v_vrelerr v_brelerr
|
||||
0 10 -6.6101864 -6.471878 947.70558 1.9110624e-09 9.4407596e-10 3.6112548e-09
|
||||
10 9.9369961 -6.6093149 -6.471878 949.31222 1.3055176e-08 4.996456e-10 1.8135199e-09
|
||||
20 9.7500224 -6.6067289 -6.4718779 954.07898 1.3721178e-08 5.6039795e-10 1.6247414e-09
|
||||
30 9.4448115 -6.6025075 -6.4718779 961.85502 1.3813156e-08 6.8451692e-10 1.3087974e-09
|
||||
40 9.0305392 -6.5967776 -6.4718777 972.39819 1.3961749e-08 3.1134064e-10 2.0036072e-09
|
||||
50 8.5196068 -6.5897109 -6.4718776 985.38158 1.3996941e-08 7.0149406e-10 1.6670043e-09
|
||||
60 7.9273388 -6.5815192 -6.4718775 1000.4024 1.4000005e-08 3.5766629e-10 2.53484e-09
|
||||
70 7.2715879 -6.5724494 -6.4718773 1016.9932 1.3996503e-08 6.2731503e-10 1.9890841e-09
|
||||
80 6.5722375 -6.5627766 -6.4718771 1034.6361 1.3973603e-08 3.1142917e-10 1.3798878e-09
|
||||
90 5.8505991 -6.5527956 -6.4718769 1052.7794 1.3983301e-08 3.9931135e-10 2.7529755e-09
|
||||
100 5.128708 -6.542811 -6.4718767 1070.8561 1.395586e-08 2.3152413e-10 2.0674207e-09
|
||||
110 4.4285344 -6.5331269 -6.4718766 1088.305 1.3938374e-08 4.2173005e-10 1.5662067e-09
|
||||
120 3.7711361 -6.5240343 -6.4718764 1104.5919 1.3915264e-08 2.5458038e-10 1.5849397e-09
|
||||
130 3.1757964 -6.5158002 -6.4718762 1119.2319 1.3858843e-08 5.7490448e-10 3.0296967e-09
|
||||
140 2.6591997 -6.5086551 -6.4718761 1131.8095 1.3814891e-08 3.5434633e-10 1.6789888e-09
|
||||
150 2.2347034 -6.5027839 -6.471876 1141.9961 1.3781115e-08 5.0639594e-10 2.9776968e-09
|
||||
160 1.9117661 -6.4983173 -6.471876 1149.564 1.3734288e-08 3.1954962e-10 1.3139064e-09
|
||||
170 1.6955808 -6.4953273 -6.471876 1154.3946 1.3682252e-08 3.5426781e-10 2.5537158e-09
|
||||
180 1.586949 -6.4938249 -6.471876 1156.4812 1.363e-08 4.0804881e-10 1.5958563e-09
|
||||
190 1.5824056 -6.4937621 -6.4718761 1155.925 1.3532637e-08 4.0767685e-10 2.3016751e-09
|
||||
200 1.6745831 -6.4950371 -6.4718762 1152.926 1.3455927e-08 2.953369e-10 2.1101198e-09
|
||||
210 1.8527803 -6.4975018 -6.4718763 1147.7684 1.335224e-08 3.5042319e-10 1.7878344e-09
|
||||
220 2.1036825 -6.5009721 -6.4718764 1140.8026 1.3239176e-08 3.5988448e-10 1.9695755e-09
|
||||
230 2.4121721 -6.5052389 -6.4718766 1132.4243 1.3090019e-08 3.5004036e-10 1.5993755e-09
|
||||
240 2.7621668 -6.5100798 -6.4718767 1123.0538 1.2946525e-08 4.1216361e-10 2.1544908e-09
|
||||
250 3.1374274 -6.5152701 -6.4718768 1113.1152 1.277789e-08 5.9848318e-10 2.5891141e-09
|
||||
260 3.5222906 -6.5205932 -6.471877 1103.0171 1.2591089e-08 2.0080182e-10 1.9280289e-09
|
||||
270 3.9022942 -6.5258491 -6.4718771 1093.1369 1.2432232e-08 4.2494727e-10 2.2260348e-09
|
||||
280 4.2646753 -6.5308612 -6.4718772 1083.8072 1.2268238e-08 6.1239266e-10 1.7606971e-09
|
||||
290 4.598736 -6.5354816 -6.4718772 1075.306 1.2181179e-08 4.9338341e-10 1.5542041e-09
|
||||
300 4.896078 -6.5395941 -6.4718773 1067.85 1.2098274e-08 3.4564838e-10 1.9030041e-09
|
||||
310 5.150715 -6.543116 -6.4718773 1061.5918 1.2184958e-08 4.2383299e-10 1.6691938e-09
|
||||
320 5.3590742 -6.5459978 -6.4718773 1056.6189 1.2312948e-08 3.5194185e-10 1.340539e-09
|
||||
330 5.5199009 -6.5482222 -6.4718773 1052.9565 1.2573918e-08 4.2401322e-10 1.6425443e-09
|
||||
340 5.6340787 -6.5498013 -6.4718773 1050.5719 1.2821551e-08 5.8802825e-10 1.9791699e-09
|
||||
350 5.7043792 -6.5507736 -6.4718772 1049.3813 1.3067314e-08 4.0014945e-10 1.0305017e-09
|
||||
360 5.7351548 -6.5511992 -6.4718772 1049.2581 1.331283e-08 4.1684815e-10 1.3051661e-09
|
||||
370 5.7319891 -6.5511553 -6.4718771 1050.042 1.354018e-08 3.8495426e-10 1.5606716e-09
|
||||
380 5.7013193 -6.5507311 -6.4718771 1051.5496 1.3734888e-08 3.5333605e-10 1.6933716e-09
|
||||
390 5.6500487 -6.5500219 -6.471877 1053.5847 1.3892287e-08 3.8154957e-10 1.5483204e-09
|
||||
400 5.5851679 -6.5491245 -6.471877 1055.9489 1.3988171e-08 5.8769536e-10 1.860034e-09
|
||||
410 5.5134009 -6.5481319 -6.4718769 1058.4508 1.4088779e-08 3.6754739e-10 3.0708184e-09
|
||||
420 5.4408957 -6.547129 -6.4718769 1060.9152 1.4139924e-08 4.9030281e-10 2.8908455e-09
|
||||
430 5.3729707 -6.5461895 -6.4718768 1063.1898 1.4173041e-08 5.2345074e-10 1.9816809e-09
|
||||
440 5.3139284 -6.5453729 -6.4718768 1065.1506 1.4191516e-08 5.9481094e-10 1.6654998e-09
|
||||
450 5.2669383 -6.5447229 -6.4718768 1066.7054 1.4168424e-08 3.0799668e-10 2.0838273e-09
|
||||
460 5.2339881 -6.5442672 -6.4718768 1067.7958 1.4163444e-08 6.3927736e-10 2.7292416e-09
|
||||
470 5.2158979 -6.544017 -6.4718768 1068.3968 1.413819e-08 5.5108262e-10 1.3969622e-09
|
||||
480 5.2123873 -6.5439685 -6.4718768 1068.5155 1.4083227e-08 3.9249548e-10 1.6717922e-09
|
||||
490 5.2221849 -6.544104 -6.4718768 1068.188 1.4035287e-08 2.1988631e-10 1.75155e-09
|
||||
500 5.2431716 -6.5443943 -6.4718768 1067.4759 1.3968666e-08 3.9100701e-10 1.9215444e-09
|
||||
Loop time of 0.169723 on 4 procs for 500 steps with 108 atoms
|
||||
|
||||
Performance: 254.532 ns/day, 0.094 hours/ns, 2945.973 timesteps/s
|
||||
99.7% CPU use with 4 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.0012438 | 0.0014032 | 0.0015571 | 0.4 | 0.83
|
||||
Neigh | 0.0048166 | 0.0051267 | 0.0054319 | 0.4 | 3.02
|
||||
Comm | 0.0075482 | 0.0081723 | 0.0087409 | 0.6 | 4.82
|
||||
Output | 0.0081869 | 0.0082763 | 0.0085015 | 0.1 | 4.88
|
||||
Modify | 0.14635 | 0.14641 | 0.14646 | 0.0 | 86.26
|
||||
Other | | 0.0003391 | | | 0.20
|
||||
|
||||
Nlocal: 27 ave 31 max 24 min
|
||||
Histogram: 1 0 1 0 1 0 0 0 0 1
|
||||
Nghost: 135 ave 138 max 131 min
|
||||
Histogram: 1 0 0 0 0 1 0 1 0 1
|
||||
Neighs: 162 ave 191 max 148 min
|
||||
Histogram: 1 2 0 0 0 0 0 0 0 1
|
||||
|
||||
Total # of neighbors = 648
|
||||
Ave neighs/atom = 6
|
||||
Neighbor list builds = 500
|
||||
Dangerous builds not checked
|
||||
Total wall time: 0:00:00
|
||||
@ -1,175 +0,0 @@
|
||||
LAMMPS (7 Jan 2022)
|
||||
# Numerical difference calculation
|
||||
# of error in forces and virial stress
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 500 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable ndump index 500 # dump output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable fdelta index 1.0e-4 # displacement size
|
||||
variable vdelta index 1.0e-6 # strain size
|
||||
variable temp index 10.0 # temperature
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
atom_modify map yes
|
||||
lattice fcc 5.358000
|
||||
Lattice spacing in x,y,z = 5.358 5.358 5.358
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 3 0 ${nlat}
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 39.903
|
||||
|
||||
velocity all create ${temp} 2357 mom yes dist gaussian
|
||||
velocity all create 10.0 2357 mom yes dist gaussian
|
||||
|
||||
pair_style lj/cubic
|
||||
pair_coeff * * 0.0102701 3.42
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
timestep 0.001
|
||||
fix nve all nve
|
||||
|
||||
# define numerical force calculation
|
||||
|
||||
fix numforce all numdiff ${nthermo} ${fdelta}
|
||||
fix numforce all numdiff 10 ${fdelta}
|
||||
fix numforce all numdiff 10 1.0e-4
|
||||
variable ferrx atom f_numforce[1]-fx
|
||||
variable ferry atom f_numforce[2]-fy
|
||||
variable ferrz atom f_numforce[3]-fz
|
||||
variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2
|
||||
compute faverrsq all reduce ave v_ferrsq
|
||||
variable fsq atom fx^2+fy^2+fz^2
|
||||
compute favsq all reduce ave v_fsq
|
||||
variable frelerr equal sqrt(c_faverrsq/c_favsq)
|
||||
dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz
|
||||
dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz
|
||||
|
||||
# define numerical virial stress tensor calculation
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
fix numvirial all numdiff/virial ${nthermo} ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 1.0e-6
|
||||
variable errxx equal f_numvirial[1]-c_myvirial[1]
|
||||
variable erryy equal f_numvirial[2]-c_myvirial[2]
|
||||
variable errzz equal f_numvirial[3]-c_myvirial[3]
|
||||
variable erryz equal f_numvirial[4]-c_myvirial[6]
|
||||
variable errxz equal f_numvirial[5]-c_myvirial[5]
|
||||
variable errxy equal f_numvirial[6]-c_myvirial[4]
|
||||
variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2"
|
||||
variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2"
|
||||
variable vrelerr equal sqrt(v_verrsq/v_vsq)
|
||||
|
||||
thermo_style custom step temp pe etotal press v_frelerr v_vrelerr
|
||||
thermo ${nthermo}
|
||||
thermo 10
|
||||
run ${nsteps}
|
||||
run 500
|
||||
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.9407173
|
||||
ghost atom cutoff = 5.9407173
|
||||
binsize = 2.9703587, bins = 6 6 6
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cubic, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 6.083 | 6.083 | 6.083 Mbytes
|
||||
Step Temp PotEng TotEng Press v_frelerr v_vrelerr
|
||||
0 10 -7.0259569 -6.8876486 28.564278 19203.344 1.5660292e-06
|
||||
10 9.9376583 -7.0250947 -6.8876486 30.254762 1.5040965e-08 2.1991382e-07
|
||||
20 9.7520139 -7.022527 -6.8876485 35.28505 1.4756358e-08 2.6265315e-06
|
||||
30 9.4477557 -7.0183188 -6.8876485 43.519863 1.4688198e-08 2.6356166e-07
|
||||
40 9.0330215 -7.0125826 -6.8876484 54.727797 1.4637921e-08 5.2292327e-08
|
||||
50 8.5192918 -7.0054772 -6.8876483 68.585553 1.4587854e-08 7.1324716e-08
|
||||
60 7.9212026 -6.997205 -6.8876481 84.684636 1.4525561e-08 3.1108149e-08
|
||||
70 7.2562592 -6.9880081 -6.8876479 102.54088 1.450885e-08 3.2311094e-08
|
||||
80 6.5444294 -6.9781627 -6.8876478 121.60715 1.4444738e-08 2.1776998e-08
|
||||
90 5.8075961 -6.9679715 -6.8876476 141.2895 1.4493562e-08 2.0400898e-08
|
||||
100 5.0688629 -6.957754 -6.8876474 160.9668 1.445455e-08 1.2636688e-08
|
||||
110 4.3517145 -6.947835 -6.8876472 180.0135 1.4460371e-08 1.2528038e-08
|
||||
120 3.6790589 -6.9385314 -6.887647 197.82486 1.4371757e-08 1.4489522e-08
|
||||
130 3.0721984 -6.9301379 -6.8876468 213.84331 1.4364708e-08 1.2461922e-08
|
||||
140 2.5497991 -6.9229125 -6.8876467 227.58429 1.4330926e-08 9.3913926e-09
|
||||
150 2.1269443 -6.917064 -6.8876466 238.6596 1.4287002e-08 4.1510266e-09
|
||||
160 1.8143642 -6.9127407 -6.8876465 246.79599 1.4282669e-08 7.7048281e-09
|
||||
170 1.6179191 -6.9100237 -6.8876465 251.84748 1.42726e-08 1.2719973e-08
|
||||
180 1.5383946 -6.9089239 -6.8876466 253.79991 1.4236534e-08 8.1200831e-09
|
||||
190 1.5716287 -6.9093836 -6.8876467 252.76745 1.41706e-08 6.5670612e-09
|
||||
200 1.7089493 -6.911283 -6.8876468 248.98142 1.4096463e-08 1.1685863e-08
|
||||
210 1.9378716 -6.9144493 -6.8876469 242.77289 1.4008978e-08 1.1226902e-08
|
||||
220 2.2429731 -6.9186692 -6.887647 234.55055 1.3886901e-08 9.9914102e-09
|
||||
230 2.606862 -6.9237023 -6.8876472 224.77626 1.3864576e-08 1.1540228e-08
|
||||
240 3.0111524 -6.9292941 -6.8876474 213.93996 1.3696314e-08 1.1697747e-08
|
||||
250 3.4373794 -6.9351893 -6.8876475 202.53583 1.3626701e-08 1.0398197e-08
|
||||
260 3.8678047 -6.9411426 -6.8876476 191.04084 1.3489489e-08 6.6603364e-09
|
||||
270 4.2860853 -6.9469279 -6.8876478 179.89646 1.3312014e-08 1.1687917e-08
|
||||
280 4.6777954 -6.9523457 -6.8876479 169.49404 1.3081144e-08 1.1336675e-08
|
||||
290 5.030805 -6.9572282 -6.887648 160.16371 1.2947385e-08 1.7342825e-08
|
||||
300 5.3355278 -6.9614428 -6.887648 152.16682 1.2893673e-08 1.7510534e-08
|
||||
310 5.5850532 -6.964894 -6.887648 145.69148 1.2842022e-08 1.2782546e-08
|
||||
320 5.7751794 -6.9675236 -6.8876481 140.85102 1.2903488e-08 1.5319437e-08
|
||||
330 5.9043601 -6.9693103 -6.887648 137.68497 1.3076809e-08 1.1208999e-08
|
||||
340 5.9735784 -6.9702676 -6.887648 136.16232 1.3296904e-08 1.891087e-08
|
||||
350 5.9861549 -6.9704415 -6.887648 136.18679 1.3504051e-08 2.5783601e-08
|
||||
360 5.947496 -6.9699067 -6.8876479 137.60397 1.3731112e-08 2.0556839e-08
|
||||
370 5.8647874 -6.9687627 -6.8876478 140.2101 1.4009878e-08 2.1771736e-08
|
||||
380 5.7466376 -6.9671285 -6.8876477 143.76234 1.4092054e-08 1.1085162e-08
|
||||
390 5.6026773 -6.9651374 -6.8876477 147.99019 1.4282872e-08 2.0221602e-08
|
||||
400 5.4431231 -6.9629305 -6.8876476 152.60787 1.4317739e-08 1.7076065e-08
|
||||
410 5.2783192 -6.960651 -6.8876475 157.32722 1.4415075e-08 2.5031776e-08
|
||||
420 5.1182723 -6.9584374 -6.8876474 161.87063 1.4441435e-08 2.2519289e-08
|
||||
430 4.9722 -6.956417 -6.8876473 165.98344 1.4550624e-08 2.4512613e-08
|
||||
440 4.8481153 -6.9547008 -6.8876473 169.44527 1.4544672e-08 1.4758301e-08
|
||||
450 4.7524707 -6.9533779 -6.8876472 172.07964 1.4546492e-08 1.324687e-08
|
||||
460 4.6898817 -6.9525122 -6.8876472 173.76132 1.4537475e-08 1.351367e-08
|
||||
470 4.6629495 -6.9521397 -6.8876472 174.42109 1.4530458e-08 1.521106e-08
|
||||
480 4.6721922 -6.9522675 -6.8876472 174.04742 1.4543785e-08 1.0905422e-08
|
||||
490 4.7160887 -6.9528747 -6.8876473 172.68525 1.4545591e-08 2.0128525e-08
|
||||
500 4.7912313 -6.953914 -6.8876473 170.43183 1.4438981e-08 1.6062775e-08
|
||||
Loop time of 0.837333 on 1 procs for 500 steps with 108 atoms
|
||||
|
||||
Performance: 51.592 ns/day, 0.465 hours/ns, 597.134 timesteps/s
|
||||
99.8% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.0097726 | 0.0097726 | 0.0097726 | 0.0 | 1.17
|
||||
Neigh | 0.03095 | 0.03095 | 0.03095 | 0.0 | 3.70
|
||||
Comm | 0.005564 | 0.005564 | 0.005564 | 0.0 | 0.66
|
||||
Output | 0.0042451 | 0.0042451 | 0.0042451 | 0.0 | 0.51
|
||||
Modify | 0.78618 | 0.78618 | 0.78618 | 0.0 | 93.89
|
||||
Other | | 0.0006258 | | | 0.07
|
||||
|
||||
Nlocal: 108 ave 108 max 108 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 558 ave 558 max 558 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 972 ave 972 max 972 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 972
|
||||
Ave neighs/atom = 9
|
||||
Neighbor list builds = 500
|
||||
Dangerous builds not checked
|
||||
Total wall time: 0:00:00
|
||||
@ -1,175 +0,0 @@
|
||||
LAMMPS (7 Jan 2022)
|
||||
# Numerical difference calculation
|
||||
# of error in forces and virial stress
|
||||
|
||||
# adjustable parameters
|
||||
|
||||
variable nsteps index 500 # length of run
|
||||
variable nthermo index 10 # thermo output interval
|
||||
variable ndump index 500 # dump output interval
|
||||
variable nlat index 3 # size of box
|
||||
variable fdelta index 1.0e-4 # displacement size
|
||||
variable vdelta index 1.0e-6 # strain size
|
||||
variable temp index 10.0 # temperature
|
||||
|
||||
units metal
|
||||
atom_style atomic
|
||||
|
||||
atom_modify map yes
|
||||
lattice fcc 5.358000
|
||||
Lattice spacing in x,y,z = 5.358 5.358 5.358
|
||||
region box block 0 ${nlat} 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 ${nlat} 0 ${nlat}
|
||||
region box block 0 3 0 3 0 ${nlat}
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
1 by 2 by 2 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 39.903
|
||||
|
||||
velocity all create ${temp} 2357 mom yes dist gaussian
|
||||
velocity all create 10.0 2357 mom yes dist gaussian
|
||||
|
||||
pair_style lj/cubic
|
||||
pair_coeff * * 0.0102701 3.42
|
||||
|
||||
neighbor 0.0 bin
|
||||
neigh_modify every 1 delay 0 check no
|
||||
|
||||
timestep 0.001
|
||||
fix nve all nve
|
||||
|
||||
# define numerical force calculation
|
||||
|
||||
fix numforce all numdiff ${nthermo} ${fdelta}
|
||||
fix numforce all numdiff 10 ${fdelta}
|
||||
fix numforce all numdiff 10 1.0e-4
|
||||
variable ferrx atom f_numforce[1]-fx
|
||||
variable ferry atom f_numforce[2]-fy
|
||||
variable ferrz atom f_numforce[3]-fz
|
||||
variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2
|
||||
compute faverrsq all reduce ave v_ferrsq
|
||||
variable fsq atom fx^2+fy^2+fz^2
|
||||
compute favsq all reduce ave v_fsq
|
||||
variable frelerr equal sqrt(c_faverrsq/c_favsq)
|
||||
dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz
|
||||
dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz
|
||||
|
||||
# define numerical virial stress tensor calculation
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
fix numvirial all numdiff/virial ${nthermo} ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 ${vdelta}
|
||||
fix numvirial all numdiff/virial 10 1.0e-6
|
||||
variable errxx equal f_numvirial[1]-c_myvirial[1]
|
||||
variable erryy equal f_numvirial[2]-c_myvirial[2]
|
||||
variable errzz equal f_numvirial[3]-c_myvirial[3]
|
||||
variable erryz equal f_numvirial[4]-c_myvirial[6]
|
||||
variable errxz equal f_numvirial[5]-c_myvirial[5]
|
||||
variable errxy equal f_numvirial[6]-c_myvirial[4]
|
||||
variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2"
|
||||
variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2"
|
||||
variable vrelerr equal sqrt(v_verrsq/v_vsq)
|
||||
|
||||
thermo_style custom step temp pe etotal press v_frelerr v_vrelerr
|
||||
thermo ${nthermo}
|
||||
thermo 10
|
||||
run ${nsteps}
|
||||
run 500
|
||||
generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
update every 1 steps, delay 0 steps, check no
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 5.9407173
|
||||
ghost atom cutoff = 5.9407173
|
||||
binsize = 2.9703587, bins = 6 6 6
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cubic, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 6.067 | 6.067 | 6.067 Mbytes
|
||||
Step Temp PotEng TotEng Press v_frelerr v_vrelerr
|
||||
0 10 -7.0259569 -6.8876486 28.564278 10664.391 9.1481187e-08
|
||||
10 9.9388179 -7.0251107 -6.8876486 30.21736 1.4771865e-08 1.3452512e-07
|
||||
20 9.7572185 -7.022599 -6.8876485 35.123527 1.437525e-08 8.0966999e-07
|
||||
30 9.4606673 -7.0184974 -6.8876484 43.132052 1.4375468e-08 1.990012e-08
|
||||
40 9.0579092 -7.0129268 -6.8876483 54.000927 1.4350331e-08 1.7239028e-08
|
||||
50 8.5607685 -7.0060508 -6.8876482 67.403151 1.4353284e-08 7.813181e-09
|
||||
60 7.9838726 -6.9980717 -6.8876481 82.935358 1.4398078e-08 2.022316e-08
|
||||
70 7.3442875 -6.9892255 -6.8876479 100.12892 1.434409e-08 7.5938179e-09
|
||||
80 6.6610579 -6.9797757 -6.8876477 118.46358 1.4324787e-08 7.1972571e-09
|
||||
90 5.9546462 -6.9700053 -6.8876476 137.38365 1.4322718e-08 4.3978378e-09
|
||||
100 5.2462727 -6.9602077 -6.8876474 156.31651 1.4273172e-08 4.6728038e-09
|
||||
110 4.5571706 -6.9506767 -6.8876472 174.69294 1.4266163e-08 3.522225e-09
|
||||
120 3.9077807 -6.9416949 -6.887647 191.96859 1.42241e-08 3.5357511e-09
|
||||
130 3.3169241 -6.9335227 -6.8876469 207.64566 1.4203813e-08 2.5182488e-09
|
||||
140 2.8010028 -6.926387 -6.8876468 221.29333 1.4164215e-08 2.3112509e-09
|
||||
150 2.3732854 -6.9204712 -6.8876467 232.5658 1.4134122e-08 1.9368963e-09
|
||||
160 2.0433329 -6.9159076 -6.8876466 241.21647 1.4095473e-08 3.6806452e-09
|
||||
170 1.8166184 -6.912772 -6.8876466 247.10715 1.4049531e-08 2.5319322e-09
|
||||
180 1.6943727 -6.9110813 -6.8876467 250.21143 1.3997912e-08 1.952404e-09
|
||||
190 1.6736731 -6.910795 -6.8876467 250.61203 1.3915487e-08 1.4271767e-09
|
||||
200 1.7477659 -6.9118199 -6.8876468 248.49223 1.3850618e-08 2.4515718e-09
|
||||
210 1.9065921 -6.9140167 -6.8876469 244.12226 1.3747916e-08 1.7957531e-09
|
||||
220 2.1374676 -6.91721 -6.887647 237.84173 1.3674779e-08 2.6613511e-09
|
||||
230 2.4258607 -6.9211989 -6.8876472 230.0395 1.3565712e-08 3.0777067e-09
|
||||
240 2.7562034 -6.9257679 -6.8876473 221.13265 1.3440442e-08 1.7111501e-09
|
||||
250 3.1126827 -6.9306984 -6.8876474 211.54566 1.3270914e-08 1.6690112e-09
|
||||
260 3.4799641 -6.9357784 -6.8876476 201.69126 1.3105092e-08 2.1637558e-09
|
||||
270 3.8438148 -6.9408108 -6.8876477 191.95361 1.2962846e-08 4.4613506e-09
|
||||
280 4.191607 -6.9456212 -6.8876478 182.6745 1.2846383e-08 3.3730203e-09
|
||||
290 4.5126922 -6.9500621 -6.8876478 174.14285 1.2710692e-08 2.2809889e-09
|
||||
300 4.7986487 -6.9540172 -6.8876479 166.58747 1.2657778e-08 6.9880891e-09
|
||||
310 5.0434083 -6.9574025 -6.8876479 160.17316 1.266381e-08 4.2486217e-09
|
||||
320 5.243275 -6.9601668 -6.8876479 154.99974 1.279856e-08 5.1505673e-09
|
||||
330 5.3968455 -6.9622908 -6.8876479 151.1038 1.2981831e-08 3.3339333e-09
|
||||
340 5.5048468 -6.9637845 -6.8876479 148.46296 1.3159021e-08 1.7881393e-09
|
||||
350 5.569902 -6.9646843 -6.8876479 147.00205 1.3439465e-08 5.6876219e-09
|
||||
360 5.5962378 -6.9650485 -6.8876478 146.60113 1.3645943e-08 7.233847e-09
|
||||
370 5.5893468 -6.9649531 -6.8876478 147.10471 1.3829581e-08 4.5514318e-09
|
||||
380 5.5556199 -6.9644866 -6.8876477 148.33195 1.4005893e-08 4.2971846e-09
|
||||
390 5.5019639 -6.9637444 -6.8876476 150.08725 1.4157454e-08 3.3564262e-09
|
||||
400 5.4354239 -6.962824 -6.8876476 152.17073 1.4226422e-08 4.2393923e-09
|
||||
410 5.3628267 -6.9618199 -6.8876475 154.38825 1.4302679e-08 3.8937698e-09
|
||||
420 5.2904639 -6.960819 -6.8876475 156.56034 1.4381099e-08 4.315875e-09
|
||||
430 5.2238282 -6.9598973 -6.8876474 158.52969 1.4426567e-08 4.2658185e-09
|
||||
440 5.1674149 -6.9591171 -6.8876474 160.16704 1.4453381e-08 5.7055268e-09
|
||||
450 5.1245913 -6.9585248 -6.8876474 161.37513 1.4449488e-08 4.4308801e-09
|
||||
460 5.0975361 -6.9581506 -6.8876474 162.09077 1.4445596e-08 5.8269923e-09
|
||||
470 5.0872416 -6.9580082 -6.8876474 162.28517 1.4444348e-08 4.8263194e-09
|
||||
480 5.0935712 -6.9580957 -6.8876474 161.96268 1.4411666e-08 6.222228e-09
|
||||
490 5.115362 -6.9583971 -6.8876474 161.15816 1.4369716e-08 3.3926077e-09
|
||||
500 5.1505605 -6.958884 -6.8876474 159.9333 1.4288515e-08 3.8845251e-09
|
||||
Loop time of 0.252598 on 4 procs for 500 steps with 108 atoms
|
||||
|
||||
Performance: 171.023 ns/day, 0.140 hours/ns, 1979.430 timesteps/s
|
||||
99.8% CPU use with 4 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.0021545 | 0.0022845 | 0.0023794 | 0.2 | 0.90
|
||||
Neigh | 0.0063887 | 0.0067604 | 0.0069752 | 0.3 | 2.68
|
||||
Comm | 0.01048 | 0.010916 | 0.011408 | 0.3 | 4.32
|
||||
Output | 0.0026603 | 0.0027399 | 0.0029738 | 0.3 | 1.08
|
||||
Modify | 0.2295 | 0.22952 | 0.22954 | 0.0 | 90.86
|
||||
Other | | 0.0003814 | | | 0.15
|
||||
|
||||
Nlocal: 27 ave 29 max 25 min
|
||||
Histogram: 1 0 1 0 0 0 0 1 0 1
|
||||
Nghost: 325 ave 327 max 323 min
|
||||
Histogram: 1 0 1 0 0 0 0 1 0 1
|
||||
Neighs: 243 ave 273 max 228 min
|
||||
Histogram: 1 1 1 0 0 0 0 0 0 1
|
||||
|
||||
Total # of neighbors = 972
|
||||
Ave neighs/atom = 9
|
||||
Neighbor list builds = 500
|
||||
Dangerous builds not checked
|
||||
Total wall time: 0:00:00
|
||||
@ -47,8 +47,9 @@ using namespace LAMMPS_NS;
|
||||
|
||||
#define BIG 1000000000
|
||||
|
||||
// This table is used to pick the 3d rij vector indices used to
|
||||
// this table is used to pick the 3d rij vector indices used to
|
||||
// compute the 6 indices long Voigt stress vector
|
||||
|
||||
static int constexpr sigma_albe[6][2] = {
|
||||
{0, 0}, // s11
|
||||
{1, 1}, // s22
|
||||
@ -58,8 +59,9 @@ static int constexpr sigma_albe[6][2] = {
|
||||
{0, 1}, // s66
|
||||
};
|
||||
|
||||
// This table is used to pick the correct indices from the Voigt
|
||||
// this table is used to pick the correct indices from the Voigt
|
||||
// stress vector to compute the Cij matrix (21 terms, see doc) contribution
|
||||
|
||||
static int constexpr C_albe[21][2] = {
|
||||
{0, 0}, // C11
|
||||
{1, 1}, // C22
|
||||
@ -84,8 +86,9 @@ static int constexpr C_albe[21][2] = {
|
||||
{4, 5} // C56
|
||||
};
|
||||
|
||||
// This table is used to pick the 3d rij vector indices used to
|
||||
// this table is used to pick the 3d rij vector indices used to
|
||||
// compute the 21 indices long Cij matrix
|
||||
|
||||
static int constexpr albemunu[21][4] = {
|
||||
{0, 0, 0, 0}, // C11
|
||||
{1, 1, 1, 1}, // C22
|
||||
@ -119,12 +122,9 @@ ComputeBornMatrix::ComputeBornMatrix(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (narg < 3) error->all(FLERR,"Illegal compute born/matrix command");
|
||||
|
||||
MPI_Comm_rank(world, &me);
|
||||
// For now the matrix can be computed as a 21 element vector
|
||||
|
||||
nvalues = 21;
|
||||
|
||||
// Error check
|
||||
|
||||
numflag = 0;
|
||||
numdelta = 0.0;
|
||||
|
||||
@ -281,12 +281,12 @@ ComputeBornMatrix::~ComputeBornMatrix()
|
||||
|
||||
void ComputeBornMatrix::init()
|
||||
{
|
||||
//Timestep value
|
||||
dt = update->dt;
|
||||
|
||||
if (!numflag) {
|
||||
|
||||
// need an occasional half neighbor list
|
||||
|
||||
int irequest = neighbor->request((void *) this);
|
||||
neighbor->requests[irequest]->pair = 0;
|
||||
neighbor->requests[irequest]->compute = 1;
|
||||
@ -297,7 +297,8 @@ void ComputeBornMatrix::init()
|
||||
// check for virial compute
|
||||
|
||||
int icompute = modify->find_compute(id_virial);
|
||||
if (icompute < 0) error->all(FLERR, "Virial compute ID for compute born/matrix does not exist");
|
||||
if (icompute < 0) error->all(FLERR,
|
||||
"Virial compute ID for compute born/matrix does not exist");
|
||||
compute_virial = modify->compute[icompute];
|
||||
|
||||
// set up reverse index lookup
|
||||
@ -320,13 +321,6 @@ void ComputeBornMatrix::init()
|
||||
virialVtoV[4] = 4;
|
||||
virialVtoV[5] = 3;
|
||||
|
||||
// set up 3x3 kronecker deltas
|
||||
|
||||
for(int row = 0; row < NXYZ_VIRIAL; row++)
|
||||
for(int col = 0; col < NXYZ_VIRIAL; col++)
|
||||
kronecker[row][col] = 0;
|
||||
for(int row = 0; row < NXYZ_VIRIAL; row++)
|
||||
kronecker[row][row] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +345,7 @@ void ComputeBornMatrix::compute_vector()
|
||||
|
||||
for (int m = 0; m < nvalues; m++) values_local[m] = 0.0;
|
||||
|
||||
// Compute Born contribution
|
||||
// compute Born contribution
|
||||
|
||||
if (pairflag) compute_pairs();
|
||||
if (bondflag) compute_bonds();
|
||||
@ -365,16 +359,16 @@ void ComputeBornMatrix::compute_vector()
|
||||
} else {
|
||||
|
||||
// calculate Born matrix using stress finite differences
|
||||
|
||||
compute_numdiff();
|
||||
|
||||
// compute_numdiff output is in pressure units
|
||||
// for consistency this is returned in energy units
|
||||
// convert from pressure to energy units
|
||||
|
||||
double inv_nktv2p = 1.0/force->nktv2p;
|
||||
double volume = domain->xprd * domain->yprd * domain->zprd;
|
||||
for (int m = 0; m < nvalues; m++) {
|
||||
values_global[m] *= inv_nktv2p * volume;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int m = 0; m < nvalues; m++) vector[m] = values_global[m];
|
||||
@ -413,7 +407,7 @@ void ComputeBornMatrix::compute_pairs()
|
||||
Pair *pair = force->pair;
|
||||
double **cutsq = force->pair->cutsq;
|
||||
|
||||
// Declares born values
|
||||
// declares born values
|
||||
|
||||
int a, b, c, d;
|
||||
double xi1, xi2, xi3;
|
||||
@ -459,7 +453,8 @@ void ComputeBornMatrix::compute_pairs()
|
||||
|
||||
// Add contribution to Born tensor
|
||||
|
||||
pair->born_matrix(i, j, itype, jtype, rsq, factor_coul, factor_lj, dupair, du2pair);
|
||||
pair->born_matrix(i, j, itype, jtype, rsq, factor_coul,
|
||||
factor_lj, dupair, du2pair);
|
||||
pair_pref = du2pair - dupair * rinv;
|
||||
|
||||
// See albemunu in compute_born_matrix.h for indices order.
|
||||
@ -473,7 +468,8 @@ void ComputeBornMatrix::compute_pairs()
|
||||
b = albemunu[m][1];
|
||||
c = albemunu[m][2];
|
||||
d = albemunu[m][3];
|
||||
values_local[m] += pair_pref * rij[a] * rij[b] * rij[c] * rij[d] * r2inv;
|
||||
values_local[m] += pair_pref * rij[a] * rij[b] *
|
||||
rij[c] * rij[d] * r2inv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -487,7 +483,7 @@ void ComputeBornMatrix::compute_pairs()
|
||||
void ComputeBornMatrix::compute_numdiff()
|
||||
{
|
||||
double energy;
|
||||
int vec_indice;
|
||||
int vec_index;
|
||||
|
||||
// grow arrays if necessary
|
||||
|
||||
@ -507,32 +503,31 @@ void ComputeBornMatrix::compute_numdiff()
|
||||
|
||||
// loop over 6 strain directions
|
||||
// compute stress finite difference in each direction
|
||||
// It must be noted that, as stated in Yoshimoto's eq. 15, eq 16.
|
||||
// and eq. A3, this tensor is NOT the true Cijkl tensor.
|
||||
// We have the relationship
|
||||
// C_ijkl=1./4.(\hat{C}_ijkl+\hat{C}_jikl+\hat{C}_ijlk+\hat{C}_jilk)
|
||||
|
||||
int flag, allflag;
|
||||
|
||||
for (int idir = 0; idir < NDIR_VIRIAL; idir++) {
|
||||
|
||||
// forward
|
||||
|
||||
displace_atoms(nall, idir, 1.0);
|
||||
force_clear(nall);
|
||||
update_virial();
|
||||
for (int jdir = 0; jdir < NDIR_VIRIAL; jdir++) {
|
||||
vec_indice = revalbe[idir][jdir];
|
||||
values_global[vec_indice] = compute_virial->vector[virialVtoV[jdir]];
|
||||
vec_index = revalbe[idir][jdir];
|
||||
values_global[vec_index] = compute_virial->vector[virialVtoV[jdir]];
|
||||
}
|
||||
restore_atoms(nall, idir);
|
||||
|
||||
// backward
|
||||
|
||||
displace_atoms(nall, idir, -1.0);
|
||||
force_clear(nall);
|
||||
update_virial();
|
||||
for (int jdir = 0; jdir < NDIR_VIRIAL; jdir++) {
|
||||
vec_indice = revalbe[idir][jdir];
|
||||
values_global[vec_indice] -= compute_virial->vector[virialVtoV[jdir]];
|
||||
vec_index = revalbe[idir][jdir];
|
||||
values_global[vec_index] -= compute_virial->vector[virialVtoV[jdir]];
|
||||
}
|
||||
|
||||
// End of the strain
|
||||
restore_atoms(nall, idir);
|
||||
}
|
||||
|
||||
@ -543,10 +538,11 @@ void ComputeBornMatrix::compute_numdiff()
|
||||
|
||||
// recompute virial so all virial and energy contributions are as before
|
||||
// also needed for virial stress addon contributions to Born matrix
|
||||
// this will possibly break compute stress/atom, need to test
|
||||
|
||||
update_virial();
|
||||
|
||||
// add on virial terms
|
||||
|
||||
virial_addon();
|
||||
|
||||
// restore original forces for owned and ghost atoms
|
||||
@ -565,6 +561,8 @@ void ComputeBornMatrix::displace_atoms(int nall, int idir, double magnitude)
|
||||
{
|
||||
double **x = atom->x;
|
||||
|
||||
// NOTE: transposing k and l would seem to be equivalent but it is not
|
||||
// only this version matches analytic results for lj/cut
|
||||
int k = dirlist[idir][0];
|
||||
int l = dirlist[idir][1];
|
||||
for (int i = 0; i < nall; i++)
|
||||
@ -578,11 +576,11 @@ void ComputeBornMatrix::displace_atoms(int nall, int idir, double magnitude)
|
||||
void ComputeBornMatrix::restore_atoms(int nall, int idir)
|
||||
{
|
||||
|
||||
// reset all coords, just to be safe, ignore idir
|
||||
// reset only idir coord
|
||||
|
||||
int k = dirlist[idir][0];
|
||||
double **x = atom->x;
|
||||
for (int i = 0; i < nall; i++)
|
||||
for (int k = 0; k < 3; k++)
|
||||
x[i][k] = temp_x[i][k];
|
||||
}
|
||||
|
||||
@ -594,7 +592,12 @@ void ComputeBornMatrix::restore_atoms(int nall, int idir)
|
||||
void ComputeBornMatrix::update_virial()
|
||||
{
|
||||
int eflag = 0;
|
||||
int vflag = 1;
|
||||
|
||||
// this may not be completely general
|
||||
// but it works for lj/cut and sw pair styles
|
||||
// and compute stress/atom output is unaffected
|
||||
|
||||
int vflag = VIRIAL_PAIR;
|
||||
|
||||
if (force->pair) force->pair->compute(eflag, vflag);
|
||||
|
||||
@ -613,10 +616,13 @@ void ComputeBornMatrix::update_virial()
|
||||
/* ----------------------------------------------------------------------
|
||||
calculate virial stress addon terms to the Born matrix
|
||||
this is based on original code of Dr. Yubao Zhen
|
||||
described here: Comp. Phys. Comm. 183 (2012) 261-265
|
||||
as well as Yoshimoto et al., PRB, 71 (2005) 184108, Eq 15.and eq A3.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void ComputeBornMatrix::virial_addon()
|
||||
{
|
||||
|
||||
int kd, nd, id, jd;
|
||||
int m;
|
||||
|
||||
@ -632,8 +638,7 @@ void ComputeBornMatrix::virial_addon()
|
||||
// the 4-rank tensor to a 2-rank tensor
|
||||
// Cijkl = (Bijkl+Bjikl+Bijlk+Bjilk)/4. = (Bijkl+Bjilk)/2.
|
||||
// and when computing only the 21 independant term.
|
||||
// see Comp. Phys. Comm. 183 (2012) 261–265
|
||||
// and Phys. Rev. B 71, 184108 (2005)
|
||||
|
||||
values_global[0] += 2.0*sigv[0];
|
||||
values_global[1] += 2.0*sigv[1];
|
||||
values_global[2] += 2.0*sigv[2];
|
||||
@ -701,6 +706,7 @@ double ComputeBornMatrix::memory_usage()
|
||||
if bond is deleted or turned off (type <= 0)
|
||||
do not count or count contribution
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeBornMatrix::compute_bonds()
|
||||
{
|
||||
int i,m,n,nb,atom1,atom2,imol,iatom,btype,ivar;
|
||||
@ -803,6 +809,7 @@ void ComputeBornMatrix::compute_bonds()
|
||||
if bond is deleted or turned off (type <= 0)
|
||||
do not count or count contribution
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void ComputeBornMatrix::compute_angles()
|
||||
{
|
||||
int i,m,n,na,atom1,atom2,atom3,imol,iatom,atype,ivar;
|
||||
|
||||
@ -73,7 +73,6 @@ namespace LAMMPS_NS {
|
||||
static constexpr int NXYZ_VIRIAL = 3; // number of Cartesian coordinates
|
||||
int revalbe[NDIR_VIRIAL][NDIR_VIRIAL];
|
||||
int virialVtoV[NDIR_VIRIAL];
|
||||
int kronecker[NXYZ_VIRIAL][NXYZ_VIRIAL];
|
||||
double **temp_x; // original coords
|
||||
double **temp_f; // original forces
|
||||
double fixedpoint[NXYZ_VIRIAL]; // displacement field origin
|
||||
|
||||
Reference in New Issue
Block a user