Merge branch 'add-pair-zhou' of https://github.com/tonnamb/lammps into pull-417

This commit is contained in:
Axel Kohlmeyer 2017-03-22 14:05:16 -04:00
commit 43f27250b5
12 changed files with 261214 additions and 1 deletions

BIN
doc/src/Eqs/pair_zhou.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

13
doc/src/Eqs/pair_zhou.tex Normal file
View File

@ -0,0 +1,13 @@
\documentclass[12pt,fleqn]{article}
\usepackage{amsmath}
\thispagestyle{empty}
\begin{document}
\setlength{\jot}{2ex}
\begin{gather*}
E = D_0 [\exp^{-2 \alpha (r-r_0)} - 2\exp^{-\alpha (r-r_0)}] - s_6 \frac{C_6}{r^6} f_{damp}(r,R_r) \\
f_{damp}(r,R_r) = \frac{1}{1 + \exp^{-d(r/R_r - 1)}}
\end{gather*}
\end{document}

View File

@ -1061,7 +1061,8 @@ package"_Section_start.html#start_3.
"table/rx"_pair_table_rx.html,
"tersoff/table (o)"_pair_tersoff.html,
"thole"_pair_thole.html,
"tip4p/long/soft (o)"_pair_lj_soft.html :tb(c=4,ea=c)
"tip4p/long/soft (o)"_pair_lj_soft.html,
"zhou"_pair_zhou.html :tb(c=4,ea=c)
:line

56
doc/src/pair_zhou.txt Normal file
View File

@ -0,0 +1,56 @@
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)
:line
pair_style zhou command :h3
[Syntax:]
pair_style zhou cutoff s6 d :pre
cutoff = global cutoff (distance units)
s6 = global scaling factor of the exchange-correlation functional used (unitless)
d = damping scaling factor of Grimme's method (unitless) :ul
[Examples:]
pair_style zhou 12.0 0.75 20.0
pair_style hybrid/overlay eam/fs lj/charmm/coul/long 10.0 12.0 zhou 12.0 0.75 20.0 morse 5.5 :pre
pair_coeff 1 2 zhou 0.0 1.0 1.0 10.2847 2.361 :pre
[Description:]
Style {zhou} computes pairwise van der Waals (vdW) interactions using the
"(Grimme)"_#Grimme method implemented in the Many-Body Metal-Organic (MOMB)
force field described extensively in "(Fichthorn)"_#Fichthorn and
"(Zhou)"_#Zhou. This potential is widely used to correct for dispersion
in density functional theory calculations.
:c,image(Eqs/pair_zhou.jpg)
For the {zhou} pair style, the following coefficients must be defined for each
pair of atoms types via the "pair_coeff"_pair_coeff.html command as in the
examples above, or in the data file or restart files read by the
"read_data"_read_data.html as described below:
D0 (energy units)
alpha (1/distance units)
r0 (distance units)
C6 (energy*distance^6 units)
Rr (distance units) :ul
:line
:link(Grimme)
[(Grimme)] Grimme, J Comput Chem, 27(15), 1787-1799 (2006).
:link(Fichthorn)
[(Fichthorn)] Fichthorn, Balankura, Qi, CrystEngComm, 18(29), 5410-5417 (2016).
:link(Zhou)
[(Zhou)] Zhou, Saidi, Fichthorn, J Phys Chem C, 118(6), 3366-3374 (2014).

View File

@ -101,5 +101,6 @@ Pair Styles :h1
pair_yukawa_colloid
pair_zbl
pair_zero
pair_zhou
END_RST -->

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
pair_style zhou example
=================
This folder contains a example of the use of pair_style zhou for system
containing Ag, ethylene glycol (EG) and polyvinylpyrrolidone (PVP).
The pair_style is designed for the interaction between metals and organic
compounds. For this Ag-EG-PVP system, we use pair_style zhou for the
interaction between Ag and the oxygen atom in EG and PVP, as described in
the publication listed below.
Zhou, Ya, Wissam A. Saidi, and Kristen A. Fichthorn.
"A force field for describing the polyvinylpyrrolidone-mediated solution-phase
synthesis of shape-selective Ag nanoparticles."
The Journal of Physical Chemistry C 118, no. 6 (2014): 3366-3374.
http://pubs.acs.org/doi/abs/10.1021/jp412098n
Other potentials used for this Ag-EG-PVP system includes the
EAM, Morse, and CHARMM potential. We note that the EAM potential file,
'Ag_O1X5.5_O2X0.55.eam.fs', also contains the information about the
one-way electron density donation from the oxygen atoms to Ag atoms.

File diff suppressed because it is too large Load Diff

197
examples/USER/misc/zhou/system.in Executable file
View File

@ -0,0 +1,197 @@
# ----------------- Settings Section -----------------
units metal
boundary p p p
neigh_modify delay 0 every 1 check yes
atom_style full
bond_style harmonic
angle_style charmm
dihedral_style charmm
improper_style harmonic
pair_style hybrid/overlay eam/fs lj/charmm/coul/long 10.0 12.0 zhou 12.0 0.75 20.0 morse 5.5
kspace_style pppm 1e-4
# ----------------- Atom Definition Section -----------------
read_data system.data
pair_coeff * * eam/fs Ag_O1X5.5_O2X0.55.eam.fs NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL O1 NULL NULL NULL O2 Ag
pair_coeff 1*4 16 morse 0.00480 1.30 1.94 # HGA1, HGA2, HGA3
pair_coeff 5 16 morse 0.00722 1.14 4.85 # CG2R53
pair_coeff 6*8 16 morse 0.00244 1.01 4.92 # CG311, CG321, CG331
pair_coeff 9 16 morse 0.00230 1.03 4.92 # CG3C52
pair_coeff 10 16 morse 0.00492 1.76 3.26 # NG2R53
pair_coeff 11 16 morse 0.00325 3.34 2.65 # OG2D1
pair_coeff 12 16 morse 0.00480 1.30 1.94 # HCA2
pair_coeff 13 16 morse 0.00448 1.06 2.13 # HCP1
pair_coeff 14 16 morse 0.00216 1.26 4.99 # CC32A
pair_coeff 15 16 morse 0.00217 2.09 3.43 # OC311
pair_coeff 1*4 16 zhou 0.0 1.0 1.0 10.2847 2.361 # H
pair_coeff 5*9 16 zhou 0.0 1.0 1.0 36.3619 2.812 # C
pair_coeff 10 16 zhou 0.0 1.0 1.0 30.4846 2.757 # N
pair_coeff 11 16 zhou 0.0 1.0 1.0 22.9973 2.702 # O
pair_coeff 12 16 zhou 0.0 1.0 1.0 10.2847 2.361 # HCA2
pair_coeff 13 16 zhou 0.0 1.0 1.0 10.2847 2.361 # HCP1
pair_coeff 14 16 zhou 0.0 1.0 1.0 36.3619 2.812 # CC32A
pair_coeff 15 16 zhou 0.0 1.0 1.0 22.9973 2.702 # OC311
# arithmetic mixing for CHARMM pair coeffs
pair_coeff 1 1 lj/charmm/coul/long 0.001520 2.387609 0.001520 2.387609 #HRA2 HRA2
pair_coeff 1 2 lj/charmm/coul/long 0.001722 2.387609 0.001722 2.387609 #HRA2 HGA1
pair_coeff 1 3 lj/charmm/coul/long 0.001520 2.387609 0.001520 2.387609 #HRA2 HGA2
pair_coeff 1 4 lj/charmm/coul/long 0.001257 2.387609 0.001257 2.387609 #HRA2 HGA3
pair_coeff 1 5 lj/charmm/coul/long 0.001150 3.153782 0.001150 3.153782 #HRA2 CG2R53
pair_coeff 1 6 lj/charmm/coul/long 0.001454 2.975602 0.000808 2.886512 #HRA2 CG311
pair_coeff 1 7 lj/charmm/coul/long 0.001922 2.984511 0.000808 2.886512 #HRA2 CG321
pair_coeff 1 8 lj/charmm/coul/long 0.002267 3.020147 0.000808 2.886512 #HRA2 CG331
pair_coeff 1 9 lj/charmm/coul/long 0.001988 2.993420 0.000808 2.886512 #HRA2 CG3C52
pair_coeff 1 10 lj/charmm/coul/long 0.003630 2.841967 0.003630 2.841967 #HRA2 NG2R53
pair_coeff 1 11 lj/charmm/coul/long 0.002811 2.708333 0.002811 2.441063 #HRA2 OG2D1
pair_coeff 1 12 lj/charmm/coul/long 0.001520 2.387609 0.001520 2.387609 #HRA2 HCA2
pair_coeff 1 13 lj/charmm/coul/long 0.001739 1.393811 0.001739 1.393811 #HRA2 HCP1
pair_coeff 1 14 lj/charmm/coul/long 0.001922 2.984511 0.000808 2.886512 #HRA2 CC32A
pair_coeff 1 15 lj/charmm/coul/long 0.003558 2.766240 0.003558 2.766240 #HRA2 OC311
pair_coeff 2 2 lj/charmm/coul/long 0.001950 2.387609 0.001950 2.387609 #HGA1 HGA1
pair_coeff 2 3 lj/charmm/coul/long 0.001722 2.387609 0.001722 2.387609 #HGA1 HGA2
pair_coeff 2 4 lj/charmm/coul/long 0.001424 2.387609 0.001424 2.387609 #HGA1 HGA3
pair_coeff 2 5 lj/charmm/coul/long 0.001302 3.153782 0.001302 3.153782 #HGA1 CG2R53
pair_coeff 2 6 lj/charmm/coul/long 0.001646 2.975602 0.000916 2.886512 #HGA1 CG311
pair_coeff 2 7 lj/charmm/coul/long 0.002177 2.984511 0.000916 2.886512 #HGA1 CG321
pair_coeff 2 8 lj/charmm/coul/long 0.002567 3.020147 0.000916 2.886512 #HGA1 CG331
pair_coeff 2 9 lj/charmm/coul/long 0.002252 2.993420 0.000916 2.886512 #HGA1 CG3C52
pair_coeff 2 10 lj/charmm/coul/long 0.004112 2.841967 0.004112 2.841967 #HGA1 NG2R53
pair_coeff 2 11 lj/charmm/coul/long 0.003184 2.708333 0.003184 2.441063 #HGA1 OG2D1
pair_coeff 2 12 lj/charmm/coul/long 0.001722 2.387609 0.001722 2.387609 #HGA1 HCA2
pair_coeff 2 13 lj/charmm/coul/long 0.001970 1.393811 0.001970 1.393811 #HGA1 HCP1
pair_coeff 2 14 lj/charmm/coul/long 0.002177 2.984511 0.000916 2.886512 #HGA1 CC32A
pair_coeff 2 15 lj/charmm/coul/long 0.004030 2.766240 0.004030 2.766240 #HGA1 OC311
pair_coeff 3 3 lj/charmm/coul/long 0.001520 2.387609 0.001520 2.387609 #HGA2 HGA2
pair_coeff 3 4 lj/charmm/coul/long 0.001257 2.387609 0.001257 2.387609 #HGA2 HGA3
pair_coeff 3 5 lj/charmm/coul/long 0.001150 3.153782 0.001150 3.153782 #HGA2 CG2R53
pair_coeff 3 6 lj/charmm/coul/long 0.001454 2.975602 0.000808 2.886512 #HGA2 CG311
pair_coeff 3 7 lj/charmm/coul/long 0.001922 2.984511 0.000808 2.886512 #HGA2 CG321
pair_coeff 3 8 lj/charmm/coul/long 0.002267 3.020147 0.000808 2.886512 #HGA2 CG331
pair_coeff 3 9 lj/charmm/coul/long 0.001988 2.993420 0.000808 2.886512 #HGA2 CG3C52
pair_coeff 3 10 lj/charmm/coul/long 0.003630 2.841967 0.003630 2.841967 #HGA2 NG2R53
pair_coeff 3 11 lj/charmm/coul/long 0.002811 2.708333 0.002811 2.441063 #HGA2 OG2D1
pair_coeff 3 12 lj/charmm/coul/long 0.001520 2.387609 0.001520 2.387609 #HGA2 HCA2
pair_coeff 3 13 lj/charmm/coul/long 0.001739 1.393811 0.001739 1.393811 #HGA2 HCP1
pair_coeff 3 14 lj/charmm/coul/long 0.001922 2.984511 0.000808 2.886512 #HGA2 CC32A
pair_coeff 3 15 lj/charmm/coul/long 0.003558 2.766240 0.003558 2.766240 #HGA2 OC311
pair_coeff 4 4 lj/charmm/coul/long 0.001040 2.387609 0.001040 2.387609 #HGA3 HGA3
pair_coeff 4 5 lj/charmm/coul/long 0.000951 3.153782 0.000951 3.153782 #HGA3 CG2R53
pair_coeff 4 6 lj/charmm/coul/long 0.001202 2.975602 0.000669 2.886512 #HGA3 CG311
pair_coeff 4 7 lj/charmm/coul/long 0.001590 2.984511 0.000669 2.886512 #HGA3 CG321
pair_coeff 4 8 lj/charmm/coul/long 0.001875 3.020147 0.000669 2.886512 #HGA3 CG331
pair_coeff 4 9 lj/charmm/coul/long 0.001644 2.993420 0.000669 2.886512 #HGA3 CG3C52
pair_coeff 4 10 lj/charmm/coul/long 0.003003 2.841967 0.003003 2.841967 #HGA3 NG2R53
pair_coeff 4 11 lj/charmm/coul/long 0.002326 2.708333 0.002326 2.441063 #HGA3 OG2D1
pair_coeff 4 12 lj/charmm/coul/long 0.001257 2.387609 0.001257 2.387609 #HGA3 HCA2
pair_coeff 4 13 lj/charmm/coul/long 0.001439 1.393811 0.001439 1.393811 #HGA3 HCP1
pair_coeff 4 14 lj/charmm/coul/long 0.001590 2.984511 0.000669 2.886512 #HGA3 CC32A
pair_coeff 4 15 lj/charmm/coul/long 0.002943 2.766240 0.002943 2.766240 #HGA3 OC311
pair_coeff 5 5 lj/charmm/coul/long 0.000870 3.919954 0.000870 3.919954 #CG2R53CG2R53
pair_coeff 5 6 lj/charmm/coul/long 0.001100 3.741775 0.000612 3.652685 #CG2R53CG311
pair_coeff 5 7 lj/charmm/coul/long 0.001454 3.750684 0.000612 3.652685 #CG2R53CG321
pair_coeff 5 8 lj/charmm/coul/long 0.001715 3.786320 0.000612 3.652685 #CG2R53CG331
pair_coeff 5 9 lj/charmm/coul/long 0.001504 3.759593 0.000612 3.652685 #CG2R53CG3C52
pair_coeff 5 10 lj/charmm/coul/long 0.002746 3.608140 0.002746 3.608140 #CG2R53NG2R53
pair_coeff 5 11 lj/charmm/coul/long 0.002127 3.474505 0.002127 3.207235 #CG2R53OG2D1
pair_coeff 5 12 lj/charmm/coul/long 0.001150 3.153782 0.001150 3.153782 #CG2R53HCA2
pair_coeff 5 13 lj/charmm/coul/long 0.001316 2.159984 0.001316 2.159984 #CG2R53HCP1
pair_coeff 5 14 lj/charmm/coul/long 0.001454 3.750684 0.000612 3.652685 #CG2R53CC32A
pair_coeff 5 15 lj/charmm/coul/long 0.002692 3.532413 0.002692 3.532413 #CG2R53OC311
pair_coeff 6 6 lj/charmm/coul/long 0.001390 3.563595 0.000430 3.385415 #CG311 CG311
pair_coeff 6 7 lj/charmm/coul/long 0.001838 3.572504 0.000430 3.385415 #CG311 CG321
pair_coeff 6 8 lj/charmm/coul/long 0.002168 3.608140 0.000430 3.385415 #CG311 CG331
pair_coeff 6 9 lj/charmm/coul/long 0.001901 3.581413 0.000430 3.385415 #CG311 CG3C52
pair_coeff 6 10 lj/charmm/coul/long 0.003471 3.429960 0.001931 3.340870 #CG311 NG2R53
pair_coeff 6 11 lj/charmm/coul/long 0.002688 3.296326 0.001495 2.939966 #CG311 OG2D1
pair_coeff 6 12 lj/charmm/coul/long 0.001454 2.975602 0.000808 2.886512 #CG311 HCA2
pair_coeff 6 13 lj/charmm/coul/long 0.001663 1.981804 0.000925 1.892714 #CG311 HCP1
pair_coeff 6 14 lj/charmm/coul/long 0.001838 3.572504 0.000430 3.385415 #CG311 CC32A
pair_coeff 6 15 lj/charmm/coul/long 0.003403 3.354233 0.001893 3.265143 #CG311 OC311
pair_coeff 7 7 lj/charmm/coul/long 0.002430 3.581413 0.000430 3.385415 #CG321 CG321
pair_coeff 7 8 lj/charmm/coul/long 0.002866 3.617049 0.000430 3.385415 #CG321 CG331
pair_coeff 7 9 lj/charmm/coul/long 0.002514 3.590322 0.000430 3.385415 #CG321 CG3C52
pair_coeff 7 10 lj/charmm/coul/long 0.004590 3.438869 0.001931 3.340870 #CG321 NG2R53
pair_coeff 7 11 lj/charmm/coul/long 0.003555 3.305235 0.001495 2.939966 #CG321 OG2D1
pair_coeff 7 12 lj/charmm/coul/long 0.001922 2.984511 0.000808 2.886512 #CG321 HCA2
pair_coeff 7 13 lj/charmm/coul/long 0.002199 1.990713 0.000925 1.892714 #CG321 HCP1
pair_coeff 7 14 lj/charmm/coul/long 0.002430 3.581413 0.000430 3.385415 #CG321 CC32A
pair_coeff 7 15 lj/charmm/coul/long 0.004499 3.363142 0.001893 3.265143 #CG321 OC311
pair_coeff 8 8 lj/charmm/coul/long 0.003380 3.652685 0.000430 3.385415 #CG331 CG331
pair_coeff 8 9 lj/charmm/coul/long 0.002964 3.625958 0.000430 3.385415 #CG331 CG3C52
pair_coeff 8 10 lj/charmm/coul/long 0.005413 3.474505 0.001931 3.340870 #CG331 NG2R53
pair_coeff 8 11 lj/charmm/coul/long 0.004192 3.340871 0.001495 2.939966 #CG331 OG2D1
pair_coeff 8 12 lj/charmm/coul/long 0.002267 3.020147 0.000808 2.886512 #CG331 HCA2
pair_coeff 8 13 lj/charmm/coul/long 0.002593 2.026349 0.000925 1.892714 #CG331 HCP1
pair_coeff 8 14 lj/charmm/coul/long 0.002866 3.617049 0.000430 3.385415 #CG331 CC32A
pair_coeff 8 15 lj/charmm/coul/long 0.005306 3.398778 0.001893 3.265143 #CG331 OC311
pair_coeff 9 9 lj/charmm/coul/long 0.002600 3.599231 0.000430 3.385415 #CG3C52CG3C52
pair_coeff 9 10 lj/charmm/coul/long 0.004748 3.447778 0.001931 3.340870 #CG3C52NG2R53
pair_coeff 9 11 lj/charmm/coul/long 0.003677 3.314144 0.001495 2.939966 #CG3C52OG2D1
pair_coeff 9 12 lj/charmm/coul/long 0.001988 2.993420 0.000808 2.886512 #CG3C52HCA2
pair_coeff 9 13 lj/charmm/coul/long 0.002275 1.999622 0.000925 1.892714 #CG3C52HCP1
pair_coeff 9 14 lj/charmm/coul/long 0.002514 3.590322 0.000430 3.385415 #CG3C52CC32A
pair_coeff 9 15 lj/charmm/coul/long 0.004654 3.372051 0.001893 3.265143 #CG3C52OC311
pair_coeff 10 10 lj/charmm/coul/long 0.008670 3.296325 0.008670 3.296325 #NG2R53NG2R53
pair_coeff 10 11 lj/charmm/coul/long 0.006714 3.162691 0.006714 2.895421 #NG2R53OG2D1
pair_coeff 10 12 lj/charmm/coul/long 0.003630 2.841967 0.003630 2.841967 #NG2R53HCA2
pair_coeff 10 13 lj/charmm/coul/long 0.004154 1.848169 0.004154 1.848169 #NG2R53HCP1
pair_coeff 10 14 lj/charmm/coul/long 0.004590 3.438869 0.001931 3.340870 #NG2R53CC32A
pair_coeff 10 15 lj/charmm/coul/long 0.008498 3.220598 0.008498 3.220598 #NG2R53OC311
pair_coeff 11 11 lj/charmm/coul/long 0.005200 3.029056 0.005200 2.494516 #OG2D1 OG2D1
pair_coeff 11 12 lj/charmm/coul/long 0.002811 2.708333 0.002811 2.441063 #OG2D1 HCA2
pair_coeff 11 13 lj/charmm/coul/long 0.003217 1.714535 0.003217 1.447265 #OG2D1 HCP1
pair_coeff 11 14 lj/charmm/coul/long 0.003555 3.305235 0.001495 2.939966 #OG2D1 CC32A
pair_coeff 11 15 lj/charmm/coul/long 0.006581 3.086964 0.006581 2.819694 #OG2D1 OC311
pair_coeff 12 12 lj/charmm/coul/long 0.001520 2.387609 0.001520 2.387609 #HCA2 HCA2
pair_coeff 12 13 lj/charmm/coul/long 0.001739 1.393811 0.001739 1.393811 #HCA2 HCP1
pair_coeff 12 14 lj/charmm/coul/long 0.001922 2.984511 0.000808 2.886512 #HCA2 CC32A
pair_coeff 12 15 lj/charmm/coul/long 0.003558 2.766240 0.003558 2.766240 #HCA2 OC311
pair_coeff 13 13 lj/charmm/coul/long 0.001990 0.400014 0.001990 0.400014 #HCP1 HCP1
pair_coeff 13 14 lj/charmm/coul/long 0.002199 1.990713 0.000925 1.892714 #HCP1 CC32A
pair_coeff 13 15 lj/charmm/coul/long 0.004071 1.772443 0.004071 1.772443 #HCP1 OC311
pair_coeff 14 14 lj/charmm/coul/long 0.002430 3.581413 0.000430 3.385415 #CC32A CC32A
pair_coeff 14 15 lj/charmm/coul/long 0.004499 3.363142 0.001893 3.265143 #CC32A OC311
pair_coeff 15 15 lj/charmm/coul/long 0.008330 3.144872 0.008330 3.144872 #OC311 OC311
special_bonds charmm
# ----------------- Run Section -----------------
timestep 0.001
restart 2000 NVT.restart.1_dup NVT.restart.1
minimize 1.0e-5 1.0e-7 1000 10000
velocity all create 413.0 12378 dist gaussian
thermo 0
thermo_style custom step pe ke etotal temp vol press lx lz pxx pyy pzz
thermo_modify flush yes
variable STEP equal step
variable PE equal pe
variable KE equal ke
variable ETOTAL equal etotal
variable TEMP equal temp
variable VOL equal vol
variable PRESS equal press
variable LX equal lx
variable LZ equal lz
variable PXX equal pxx
variable PYY equal pyy
variable PZZ equal pzz
fix 1 all nvt temp 413.0 413.0 0.1 fixedpoint 0.0 0.0 0.0
fix thermo_output all print 2000 "${STEP} ${PE} ${KE} ${ETOTAL} ${TEMP} ${VOL} ${PRESS} ${LX} ${LZ} ${PXX} ${PYY} ${PZZ}" file thermo.lammps title "# Step PotEng KinEng TotEng Temp Volume Press Lx Lz Pxx Pyy Pzz"
dump 1 all custom 200000 traj_npt.lammpstrj id mol type x y z ix iy iz
run 15000000

View File

@ -70,4 +70,5 @@ pair_style meam/sw/spline, Robert Rudd (LLNL), robert.rudd at llnl.gov, 1 Oct 12
pair_style morse/smooth/linear, Stefan Paquay (TU Eindhoven), stefanpaquay at gmail.com, 29 Feb 16
pair_style srp, Tim Sirk, tim.sirk at us.army.mil, 21 Nov 14
pair_style tersoff/table, Luca Ferraro, luca.ferraro@caspur.it, 1 Dec 11
pair_style zhou, Kristen Fichthorn, fichthorn@psu.edu, 18 Mar 17
temper/grem, David Stelter, dstelter@bu.edu, 22 Nov 16

363
src/USER-MISC/pair_zhou.cpp Normal file
View File

@ -0,0 +1,363 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, 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.
-------------------------------------------------------------------------
Contributed by Kristen Fichthorn @ Penn State University
------------------------------------------------------------------------- */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "pair_zhou.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neigh_list.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
PairZhou::PairZhou(LAMMPS *lmp) : Pair(lmp) {}
/* ---------------------------------------------------------------------- */
PairZhou::~PairZhou()
{
if (allocated) {
memory->destroy(setflag);
memory->destroy(cutsq);
memory->destroy(cut);
memory->destroy(d0);
memory->destroy(alpha);
memory->destroy(r0);
memory->destroy(c);
memory->destroy(rr);
memory->destroy(morse1);
memory->destroy(offset);
}
}
/* ---------------------------------------------------------------------- */
void PairZhou::compute(int eflag, int vflag)
{
int i,j,ii,jj,inum,jnum,itype,jtype;
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
double rsq,r,dr,dexp,factor_lj,r2inv,r6inv,ddexp,invexp;
int *ilist,*jlist,*numneigh,**firstneigh;
evdwl = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = vflag_fdotr = 0;
double **x = atom->x;
double **f = atom->f;
int *type = atom->type;
int nlocal = atom->nlocal;
double *special_lj = force->special_lj;
int newton_pair = force->newton_pair;
inum = list->inum;
ilist = list->ilist;
numneigh = list->numneigh;
firstneigh = list->firstneigh;
// loop over neighbors of my atoms
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
itype = type[i];
jlist = firstneigh[i];
jnum = numneigh[i];
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
factor_lj = special_lj[sbmask(j)];
j &= NEIGHMASK;
delx = xtmp - x[j][0];
dely = ytmp - x[j][1];
delz = ztmp - x[j][2];
rsq = delx*delx + dely*dely + delz*delz;
jtype = type[j];
if (rsq < cutsq[itype][jtype]) {
r2inv = 1.0/rsq;
r6inv = r2inv*r2inv*r2inv;
r = sqrt(rsq);
dr = r - r0[itype][jtype];
dexp = exp(-alpha[itype][jtype] * dr);
ddexp = exp(-dscale * (r/rr[itype][jtype] - 1.0));
invexp = 1.0/(1+ddexp);
fpair = morse1[itype][jtype] * (dexp*dexp - dexp) / r;
fpair -= sscale*c[itype][jtype] * (invexp*invexp*ddexp*(-dscale/rr[itype][jtype])*r6inv) / r;
fpair -= sscale*c[itype][jtype] * (6.0 * invexp * r6inv * r2inv);
fpair *= factor_lj;
f[i][0] += delx*fpair;
f[i][1] += dely*fpair;
f[i][2] += delz*fpair;
if (newton_pair || j < nlocal) {
f[j][0] -= delx*fpair;
f[j][1] -= dely*fpair;
f[j][2] -= delz*fpair;
}
if (eflag) {
evdwl = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) -
sscale*c[itype][jtype]*r6inv*invexp - offset[itype][jtype];
evdwl *= factor_lj;
}
if (evflag) ev_tally(i,j,nlocal,newton_pair,
evdwl,0.0,fpair,delx,dely,delz);
}
}
}
if (vflag_fdotr) virial_fdotr_compute();
}
/* ----------------------------------------------------------------------
allocate all arrays
------------------------------------------------------------------------- */
void PairZhou::allocate()
{
allocated = 1;
int n = atom->ntypes;
memory->create(setflag,n+1,n+1,"pair:setflag");
for (int i = 1; i <= n; i++)
for (int j = i; j <= n; j++)
setflag[i][j] = 0;
memory->create(cutsq,n+1,n+1,"pair:cutsq");
memory->create(cut,n+1,n+1,"pair:cut");
memory->create(d0,n+1,n+1,"pair:d0");
memory->create(alpha,n+1,n+1,"pair:alpha");
memory->create(r0,n+1,n+1,"pair:r0");
memory->create(c,n+1,n+1,"pair:c");
memory->create(rr,n+1,n+1,"pair:rr");
memory->create(morse1,n+1,n+1,"pair:morse1");
memory->create(offset,n+1,n+1,"pair:offset");
}
/* ----------------------------------------------------------------------
global settings
------------------------------------------------------------------------- */
void PairZhou::settings(int narg, char **arg)
{
if (narg != 3) error->all(FLERR,"Illegal pair_style command");
cut_global = force->numeric(FLERR,arg[0]);
sscale = force->numeric(FLERR,arg[1]);
dscale = force->numeric(FLERR,arg[2]);
// reset cutoffs that have been explicitly set
if (allocated) {
int i,j;
for (i = 1; i <= atom->ntypes; i++)
for (j = i+1; j <= atom->ntypes; j++)
if (setflag[i][j]) cut[i][j] = cut_global;
}
}
/* ----------------------------------------------------------------------
set coeffs for one or more type pairs
------------------------------------------------------------------------- */
void PairZhou::coeff(int narg, char **arg)
{
if (narg < 7 || narg > 8) error->all(FLERR,"Incorrect args for pair coefficients");
if (!allocated) allocate();
int ilo,ihi,jlo,jhi;
force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi);
force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi);
double d0_one = force->numeric(FLERR,arg[2]);
double alpha_one = force->numeric(FLERR,arg[3]);
double r0_one = force->numeric(FLERR,arg[4]);
double c_one = force->numeric(FLERR,arg[5]);
double rr_one = force->numeric(FLERR,arg[6]);
double cut_one = cut_global;
if (narg == 8) cut_one = force->numeric(FLERR,arg[7]);
int count = 0;
for (int i = ilo; i <= ihi; i++) {
for (int j = MAX(jlo,i); j <= jhi; j++) {
d0[i][j] = d0_one;
alpha[i][j] = alpha_one;
r0[i][j] = r0_one;
cut[i][j] = cut_one;
c[i][j] = c_one;
rr[i][j] = rr_one;
setflag[i][j] = 1;
count++;
}
}
if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients");
}
/* ----------------------------------------------------------------------
init for one type pair i,j and corresponding j,i
------------------------------------------------------------------------- */
double PairZhou::init_one(int i, int j)
{
if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set");
morse1[i][j] = 2.0*d0[i][j]*alpha[i][j];
if (offset_flag) {
double alpha_dr = -alpha[i][j] * (cut[i][j] - r0[i][j]);
offset[i][j] = d0[i][j] * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr));
} else offset[i][j] = 0.0;
d0[j][i] = d0[i][j];
alpha[j][i] = alpha[i][j];
r0[j][i] = r0[i][j];
c[j][i] = c[i][j];
rr[j][i] = rr[i][j];
morse1[j][i] = morse1[i][j];
offset[j][i] = offset[i][j];
return cut[i][j];
}
/* ----------------------------------------------------------------------
proc 0 writes to restart file
------------------------------------------------------------------------- */
void PairZhou::write_restart(FILE *fp)
{
write_restart_settings(fp);
int i,j;
for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) {
fwrite(&setflag[i][j],sizeof(int),1,fp);
if (setflag[i][j]) {
fwrite(&d0[i][j],sizeof(double),1,fp);
fwrite(&alpha[i][j],sizeof(double),1,fp);
fwrite(&r0[i][j],sizeof(double),1,fp);
fwrite(&c[i][j],sizeof(double),1,fp);
fwrite(&rr[i][j],sizeof(double),1,fp);
fwrite(&cut[i][j],sizeof(double),1,fp);
}
}
}
/* ----------------------------------------------------------------------
proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */
void PairZhou::read_restart(FILE *fp)
{
read_restart_settings(fp);
allocate();
int i,j;
int me = comm->me;
for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) {
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
if (setflag[i][j]) {
if (me == 0) {
fread(&d0[i][j],sizeof(double),1,fp);
fread(&alpha[i][j],sizeof(double),1,fp);
fread(&r0[i][j],sizeof(double),1,fp);
fread(&c[i][j],sizeof(double),1,fp);
fread(&rr[i][j],sizeof(double),1,fp);
fread(&cut[i][j],sizeof(double),1,fp);
}
MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&c[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&rr[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
}
}
}
/* ----------------------------------------------------------------------
proc 0 writes to restart file
------------------------------------------------------------------------- */
void PairZhou::write_restart_settings(FILE *fp)
{
fwrite(&cut_global,sizeof(double),1,fp);
fwrite(&sscale,sizeof(double),1,fp);
fwrite(&dscale,sizeof(double),1,fp);
fwrite(&offset_flag,sizeof(int),1,fp);
fwrite(&mix_flag,sizeof(int),1,fp);
}
/* ----------------------------------------------------------------------
proc 0 reads from restart file, bcasts
------------------------------------------------------------------------- */
void PairZhou::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
fread(&cut_global,sizeof(double),1,fp);
fread(&sscale,sizeof(double),1,fp);
fread(&dscale,sizeof(double),1,fp);
fread(&offset_flag,sizeof(int),1,fp);
fread(&mix_flag,sizeof(int),1,fp);
}
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
MPI_Bcast(&sscale,1,MPI_DOUBLE,0,world);
MPI_Bcast(&dscale,1,MPI_DOUBLE,0,world);
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);
MPI_Bcast(&mix_flag,1,MPI_INT,0,world);
}
/* ---------------------------------------------------------------------- */
double PairZhou::single(int i, int j, int itype, int jtype, double rsq,
double factor_coul, double factor_lj,
double &fforce)
{
double r,dr,dexp,phi,r2inv,r6inv,ddexp,invexp;
r2inv = 1.0/rsq;
r6inv = r2inv*r2inv*r2inv;
r = sqrt(rsq);
dr = r - r0[itype][jtype];
dexp = exp(-alpha[itype][jtype] * dr);
ddexp = exp(-dscale * (r/rr[itype][jtype] - 1.0));
invexp = 1.0/(1+ddexp);
fforce = factor_lj * morse1[itype][jtype] * (dexp*dexp - dexp) / r;
fforce -= factor_lj * sscale* c[itype][jtype] * (invexp*invexp*ddexp*(-dscale/rr[itype][jtype])*r6inv) / r;
fforce -= factor_lj * sscale* c[itype][jtype] * (6.0 * invexp * r6inv * r2inv);
phi = d0[itype][jtype] * (dexp*dexp - 2.0*dexp) - sscale*c[itype][jtype]*r6inv*invexp - offset[itype][jtype];
return factor_lj*phi;
}

77
src/USER-MISC/pair_zhou.h Normal file
View File

@ -0,0 +1,77 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, 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.
-------------------------------------------------------------------------
Contributed by Kristen Fichthorn @ Penn State University
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(zhou,PairZhou)
#else
#ifndef LMP_PAIR_ZHOU_H
#define LMP_PAIR_ZHOU_H
#include "pair.h"
namespace LAMMPS_NS {
class PairZhou : public Pair {
public:
PairZhou(class LAMMPS *);
virtual ~PairZhou();
virtual void compute(int, int);
virtual void settings(int, char **);
void coeff(int, char **);
virtual double init_one(int, int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
virtual double single(int, int, int, int, double, double, double, double &);
protected:
double cut_global;
double **cut;
double sscale,dscale;
double **d0,**alpha,**r0,**c,**rr;
double **morse1;
double **offset;
void allocate();
};
}
#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: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file.
E: All pair coeffs are not set
All pair coefficients must be set in the data file or by the
pair_coeff command before running a simulation.
*/