Created branch on athomps/lammps repo
This commit is contained in:
136
doc/src/compute_born_matrix.rst
Normal file
136
doc/src/compute_born_matrix.rst
Normal file
@ -0,0 +1,136 @@
|
||||
.. index:: compute born/matrix
|
||||
|
||||
compute born/matrix command
|
||||
===========================
|
||||
|
||||
Syntax
|
||||
""""""
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
compute ID group-ID born/matrix
|
||||
|
||||
* ID, group-ID are documented in :doc:`compute <compute>` command
|
||||
* born/matrix = style name of this compute command
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all born/matrix
|
||||
|
||||
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
|
||||
tensor :math:`\varepsilon` elements. These values are related to:
|
||||
|
||||
.. math::
|
||||
|
||||
C^{B}_{i,j}=\frac{1}{V}\frac{\partial{}^2U}{\partial{}\varepsilon_{i}\partial\varepsilon_{j}}
|
||||
|
||||
also called the Born term of elastic constants in the stress-stress fluctuation
|
||||
formalism. This quantity can be used to compute the elastic constant tensor.
|
||||
Using the symmetric Voigt notation, the elastic constant tensor can be written
|
||||
as a 6x6 symmetric matrix:
|
||||
|
||||
.. math::
|
||||
|
||||
C_{i,j} = \langle{}C^{B}_{i,j}\rangle
|
||||
+ \frac{V}{k_{B}T}\left(\langle\sigma_{i}\sigma_{j}\rangle\right.
|
||||
\left.- \langle\sigma_{i}\rangle\langle\sigma_{j}\rangle\right)
|
||||
+ \frac{Nk_{B}T}{V}
|
||||
\left(\delta_{i,j}+(\delta_{1,i}+\delta_{2,i}+\delta_{3,i})\right.
|
||||
\left.*(\delta_{1,j}+\delta_{2,j}+\delta_{3,j})\right)
|
||||
|
||||
In the above expression, :math:`\sigma` stands for the virial stress
|
||||
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:
|
||||
|
||||
.. math::
|
||||
|
||||
\begin{matrix}
|
||||
C_{1} & C_{7} & C_{8} & C_{9} & C_{10} & C_{11} \\
|
||||
C_{7} & C_{2} & C_{12} & C_{13} & C_{14} & C_{15} \\
|
||||
\vdots & C_{12} & C_{3} & C_{16} & C_{17} & C_{18} \\
|
||||
\vdots & C_{13} & C_{16} & C_{4} & C_{19} & C_{20} \\
|
||||
\vdots & \vdots & \vdots & C_{19} & C_{5} & C_{21} \\
|
||||
\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)
|
||||
<VanWorkum>` or :ref:`(Voyiatzis) <Voyiatzis>`.
|
||||
|
||||
The output can be accessed using usual Lammps routines:
|
||||
|
||||
.. code-block:: LAMMPS
|
||||
|
||||
compute 1 all born/matrix
|
||||
compute 2 all pressure NULL virial
|
||||
variable S1 equal -c_2[1]
|
||||
variable S2 equal -c_2[2]
|
||||
variable S3 equal -c_2[3]
|
||||
variable S4 equal -c_2[4]
|
||||
variable S5 equal -c_2[5]
|
||||
variable S6 equal -c_2[6]
|
||||
fix 1 all ave/time 1 1 1 v_S1 v_S2 v_S3 v_S4 v_S5 v_S6 c_1[*] file born.out
|
||||
|
||||
In this example, the file *born.out* will contain the information needed to
|
||||
compute the first and second terms of the elastic constant matrix in a post
|
||||
processing procedure. The other required quantities can be accessed using any
|
||||
other *LAMMPS* usual method.
|
||||
|
||||
NOTE: In the above :math:`C_{i,j}` computation, the term involving the virial
|
||||
stress tensor :math:`\sigma` is the covariance between each elements. In a
|
||||
solid the virial stress can have large variations between timesteps and average
|
||||
values can be slow to converge. This term is better computed using
|
||||
instantaneous values.
|
||||
|
||||
**Output info:**
|
||||
|
||||
This compute calculates a global array with the number of rows=21.
|
||||
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
|
||||
the :doc:`Howto output <Howto_output>` doc page for an overview of
|
||||
LAMMPS output options.
|
||||
|
||||
The array values calculated by this compute are all "extensive".
|
||||
|
||||
Restrictions
|
||||
""""""""""""
|
||||
|
||||
This compute is part of the EXTRA-COMPUTE package. It is only enabled if
|
||||
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
|
||||
|
||||
The Born term can be decomposed as a product of two terms. The first one
|
||||
is a general term which depends on the configuration. The second one is
|
||||
specific to every interaction composing your force field (non-bonded,
|
||||
bonds, angle...). Currently not all interaction implement the *born_matrix*
|
||||
method giving first and second order derivatives and a warning will
|
||||
be raised if you try to use this compute with such interactions. The returned
|
||||
values of this force field component is currently zero.
|
||||
|
||||
Default
|
||||
"""""""
|
||||
|
||||
none
|
||||
|
||||
----------
|
||||
|
||||
.. _VanWorkum:
|
||||
|
||||
**(Van Workum)** K. Van Workum et al., J. Chem. Phys. 125 144506 (2006)
|
||||
|
||||
.. _Voyiatzis:
|
||||
|
||||
**(Voyiatzis)** E. Voyiatzis, Computer Physics Communications 184(2013)27-33
|
||||
36
examples/cij_nvt/in.ljfcc
Normal file
36
examples/cij_nvt/in.ljfcc
Normal file
@ -0,0 +1,36 @@
|
||||
# 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
|
||||
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 nve
|
||||
|
||||
compute born all born/matrix
|
||||
thermo ${nthermo}
|
||||
thermo_style custom step temp pe press c_born[*]
|
||||
|
||||
run ${nsteps}
|
||||
|
||||
37
examples/cij_nvt/in.ljfcc_num
Normal file
37
examples/cij_nvt/in.ljfcc_num
Normal file
@ -0,0 +1,37 @@
|
||||
# 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
|
||||
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 nve
|
||||
|
||||
compute myvirial all pressure NULL virial
|
||||
compute born all born/matrix numdiff ${delta} myvirial
|
||||
thermo ${nthermo}
|
||||
thermo_style custom step temp pe press c_born[*]
|
||||
|
||||
run ${nsteps}
|
||||
|
||||
102
examples/cij_nvt/log.29Jan2022.born.g++.1
Normal file
102
examples/cij_nvt/log.29Jan2022.born.g++.1
Normal file
@ -0,0 +1,102 @@
|
||||
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
|
||||
102
examples/cij_nvt/log.29Jan2022.born.g++.4
Normal file
102
examples/cij_nvt/log.29Jan2022.born.g++.4
Normal file
@ -0,0 +1,102 @@
|
||||
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
|
||||
1147
src/EXTRA-COMPUTE/compute_born_matrix.cpp
Normal file
1147
src/EXTRA-COMPUTE/compute_born_matrix.cpp
Normal file
File diff suppressed because it is too large
Load Diff
103
src/EXTRA-COMPUTE/compute_born_matrix.h
Normal file
103
src/EXTRA-COMPUTE/compute_born_matrix.h
Normal file
@ -0,0 +1,103 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
Contributing Authors : Germain Clavier (TUe)
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef COMPUTE_CLASS
|
||||
// clang-format off
|
||||
ComputeStyle(born/matrix,ComputeBornMatrix);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_COMPUTE_BORN_MATRIX_H
|
||||
#define LMP_COMPUTE_BORN_MATRIX_H
|
||||
|
||||
#include "compute.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ComputeBornMatrix : public Compute {
|
||||
public:
|
||||
ComputeBornMatrix(class LAMMPS *, int, char **);
|
||||
virtual ~ComputeBornMatrix() override;
|
||||
void init() override;
|
||||
void init_list(int, class NeighList *) override;
|
||||
void compute_vector() override;
|
||||
double memory_usage() override;
|
||||
|
||||
private:
|
||||
|
||||
// Born matrix contributions
|
||||
|
||||
void compute_pairs(); // pair and manybody
|
||||
void compute_bonds(); // bonds
|
||||
void compute_angles(); // angles
|
||||
void compute_dihedrals(); // dihedrals
|
||||
void compute_numdiff(); // stress virial finite differences
|
||||
void displace_atoms(int, int, double); // displace atoms
|
||||
void force_clear(int); // zero out force array
|
||||
void update_virial(); // recalculate the virial
|
||||
void restore_atoms(int, int); // restore atom positions
|
||||
void virial_addon(); // restore atom positions
|
||||
void reallocate(); // grow the atom arrays
|
||||
|
||||
int me; // process rank
|
||||
int nvalues; // length of elastic tensor
|
||||
int numflag; // 1 if using finite differences
|
||||
double numdelta; // size of finite strain
|
||||
int maxatom; // allocated size of atom arrays
|
||||
|
||||
int pairflag, bondflag, angleflag;
|
||||
int dihedflag, impflag, kspaceflag;
|
||||
|
||||
double *values_local,*values_global;
|
||||
double pos,pos1,dt,nktv2p,ftm2v;
|
||||
class NeighList *list;
|
||||
|
||||
char *id_virial; // name of virial compute
|
||||
class Compute *compute_virial; // pointer to virial compute
|
||||
|
||||
static constexpr int NDIR_VIRIAL = 6; // dimension of virial and strain vectors
|
||||
static constexpr int NXYZ_VIRIAL = 3; // number of Cartesian coordinates
|
||||
int revalbe[NDIR_VIRIAL][NDIR_VIRIAL];
|
||||
int voigt3VtoM[NDIR_VIRIAL][2];
|
||||
int voigt3MtoV[NXYZ_VIRIAL][NXYZ_VIRIAL];
|
||||
int virialMtoV[NXYZ_VIRIAL][NXYZ_VIRIAL];
|
||||
int kronecker[NXYZ_VIRIAL][NXYZ_VIRIAL];
|
||||
double **temp_x; // original coords
|
||||
double **temp_f; // original forces
|
||||
double fixedpoint[NXYZ_VIRIAL]; // displacement field origin
|
||||
int dirlist[NDIR_VIRIAL][2]; // strain cartesian indices
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: ... style does not support compute born/matrix
|
||||
|
||||
Some component of the force field (pair, bond, angle...) does not provide
|
||||
a function to return the Born term contribution.
|
||||
*/
|
||||
|
||||
@ -58,6 +58,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
||||
comm_forward = comm_reverse = comm_reverse_off = 0;
|
||||
|
||||
single_enable = 1;
|
||||
born_matrix_enable = 0;
|
||||
single_hessian_enable = 0;
|
||||
restartinfo = 1;
|
||||
respa_enable = 0;
|
||||
|
||||
@ -52,6 +52,7 @@ class Pair : protected Pointers {
|
||||
|
||||
int single_enable; // 1 if single() routine exists
|
||||
int single_hessian_enable; // 1 if single_hessian() routine exists
|
||||
int born_matrix_enable; // 1 if born_matrix() routine exists
|
||||
int restartinfo; // 1 if pair style writes restart info
|
||||
int respa_enable; // 1 if inner/middle/outer rRESPA routines
|
||||
int one_coeff; // 1 if allows only one coeff * * call
|
||||
@ -168,6 +169,13 @@ class Pair : protected Pointers {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
virtual void born_matrix(int /*i*/, int /*j*/, int /*itype*/, int /*jtype*/, double /*rsq*/,
|
||||
double /*factor_coul*/, double /*factor_lj*/, double& du, double& du2)
|
||||
{
|
||||
du = 0.0;
|
||||
du2 = 0.0;
|
||||
}
|
||||
|
||||
virtual void settings(int, char **) = 0;
|
||||
virtual void coeff(int, char **) = 0;
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ using namespace MathConst;
|
||||
PairLJCut::PairLJCut(LAMMPS *lmp) : Pair(lmp)
|
||||
{
|
||||
respa_enable = 1;
|
||||
born_matrix_enable = 1;
|
||||
writedata = 1;
|
||||
}
|
||||
|
||||
@ -680,6 +681,28 @@ double PairLJCut::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void PairLJCut::born_matrix(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
|
||||
double /*factor_coul*/, double factor_lj,
|
||||
double &dupair, double &du2pair)
|
||||
{
|
||||
double rinv,r2inv,r6inv,du,du2;
|
||||
|
||||
r2inv = 1.0/rsq;
|
||||
rinv = sqrt(r2inv);
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
|
||||
// Reminder: lj1 = 48*e*s^12, lj2 = 24*e*s^6
|
||||
// so dupair = -forcelj/r = -fforce*r (forcelj from single method)
|
||||
|
||||
du = r6inv * rinv * (lj2[itype][jtype] - lj1[itype][jtype]*r6inv);
|
||||
du2 = r6inv * r2inv * (13*lj1[itype][jtype]*r6inv - 7*lj2[itype][jtype]);
|
||||
|
||||
dupair = factor_lj*du;
|
||||
du2pair = factor_lj*du2;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void *PairLJCut::extract(const char *str, int &dim)
|
||||
{
|
||||
dim = 2;
|
||||
|
||||
@ -40,6 +40,7 @@ class PairLJCut : public Pair {
|
||||
void write_data(FILE *) override;
|
||||
void write_data_all(FILE *) override;
|
||||
double single(int, int, int, int, double, double, double, double &) override;
|
||||
void born_matrix(int, int, int, int, double, double, double, double &, double &) override;
|
||||
void *extract(const char *, int &) override;
|
||||
|
||||
void compute_inner() override;
|
||||
|
||||
Reference in New Issue
Block a user