Merge pull request from akohlmey/pair-potential-file-unit-convert

Transparently convert supported potential files from metal to real units
This commit is contained in:
Axel Kohlmeyer 2020-06-25 19:31:52 -04:00 committed by GitHub
commit d55a061286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 3243 additions and 483 deletions

View File

@ -77,7 +77,7 @@ else()
foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG})
if(COMPILER_SUPPORTS${_FLAG})
target_compile_options(lammps PRIVATE ${_FLAG})
target_compile_options(lammps PRIVATE ${_FLAG})
endif()
endforeach()
endif()

View File

@ -89,14 +89,20 @@ LAMMPS so long as they are in the format LAMMPS expects, as discussed
on the individual doc pages. The first line of potential files may
contain metadata with upper case tags followed their value. These may
be parsed and used by LAMMPS. Currently supported are the "DATE:"
tag and the "UNITS:" tag. For pair styles that have been programmed
tag and the ``UNITS:`` tag. For pair styles that have been programmed
to support the metadata, the value of the "DATE:" tag is printed to
the screen and logfile so that the version of a potential file can be
later identified. The "UNITS:" tag indicates the :doc:`units <units>`
later identified. The ``UNITS:`` tag indicates the :doc:`units <units>`
setting required for this particular potential file. If the potential
file ware created for a different sets of units, LAMMPS will terminate
file was created for a different sets of units, LAMMPS will terminate
with an error. If the potential file does not contain the tag, no
check will be made.
check will be made and it is the responsibility of the user to determine
that the unit style is correct.
In some select cases and for specific combinations of unit styles,
LAMMPS is capable of automatically converting potential parameters
from a file. In those cases, a warning message signaling that an
automatic conversion has happened is printed to the screen.
When a pair_coeff command using a potential file is specified, LAMMPS
looks for the potential file in 2 places. First it looks in the

View File

@ -76,7 +76,7 @@ Examples
pair_style eam
pair_coeff * * cuu3
pair_coeff 1*3 1\*3 niu3.eam
pair_coeff 1*3 1*3 niu3.eam
pair_style eam/alloy
pair_coeff * * ../potentials/NiAlH_jea.eam.alloy Ni Al Ni Ni

View File

@ -74,7 +74,7 @@ formulation of the V_ij term, where it contains an additional c0 term.
.. math::
V_{ij} & = f_C(r_{ij}) \left[ f_R(r_{ij}) + b_{ij} f_A(r_{ij}) + c_0 \right]
V_{ij} = f_C(r_{ij}) \left[ f_R(r_{ij}) + b_{ij} f_A(r_{ij}) + c_0 \right]
The modified cutoff function :math:`f_C` proposed by :ref:`(Murty) <Murty>` and
having a continuous second-order differential is employed. The

View File

@ -49,6 +49,15 @@ new units. And you must correctly convert all output from the new
units to the old units when comparing to the original results. That
is often not simple to do.
Potential or table files may have a ``UNITS:`` tag included in the
first line indicating the unit style those files were created for.
If the tag exists, its value will be compared to the chosen unit style
and LAMMPS will stop with an error message if there is a mismatch.
In some select cases and for specific combinations of unit styles,
LAMMPS is capable of automatically converting potential parameters
from a file. In those cases, a warning message signaling that an
automatic conversion has happened is printed to the screen.
----------
For style *lj*\ , all quantities are unitless. Without loss of

View File

@ -1760,6 +1760,7 @@ mem
memalign
MEMALIGN
membered
memcheck
Mendelev
mer
Meremianin

View File

@ -1,15 +1,15 @@
#This script implements the BKS pair potential for various silicon dioxide compounds. Inner part is fixed with a harmonic potential. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style hybrid/overlay buck/coul/long ${cut_off} table linear 39901
pair_coeff 1 1 buck/coul/long 0.0 1.0 0.0 #No interactions between Si atoms
pair_coeff 1 2 buck/coul/long 18003.757200 0.205205 133.538100
pair_coeff 2 2 buck/coul/long 1388.773000 0.362319 175.000000 #BKS interaction in PRL 64 1955 (1990)
pair_modify shift yes
pair_coeff 1 2 table potential_SiO2.TPF Si-O ${cut_off}
pair_coeff 2 2 table potential_SiO2.TPF O-O ${cut_off} #See the potential file for more information
kspace_style pppm 1.0e-4
pair_style hybrid/overlay buck/coul/long ${cut_off} table linear 39901
pair_coeff 1 1 buck/coul/long 0.0 1.0 0.0 #No interactions between Si atoms
pair_coeff 1 2 buck/coul/long 18003.757200 0.205205 133.538100
pair_coeff 2 2 buck/coul/long 1388.773000 0.362319 175.000000 #BKS interaction in PRL 64 1955 (1990)
pair_modify shift yes
pair_coeff 1 2 table potential_SiO2.TPF Si-O ${cut_off}
pair_coeff 2 2 table potential_SiO2.TPF O-O ${cut_off} #See the potential file for more information
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000

View File

@ -1,55 +0,0 @@
## This script first uses fix qtb to equilibrate alpha quartz structure to an initial state with quantum nuclear correction and then simulate shock induced phase transition through the quantum thermal bath multi-scale shock technique
variable x_rep equal 2 #plot is made with x_rep = 8 #x-direction replication number
variable y_rep equal 1 #plot is made with y_rep = 5 #y-direction replication number
variable z_rep equal 4 #plot is made with z_rep = 15 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
variable v_msst equal 78.0 #Shock velocity (Angstrom/ps in metal units)
variable q_msst equal 40.0 #Box mass-like parameter in the MSST (mass^2/length^4, where mass=grams/mole and length=Angstrom in metal units)
variable tscale_msst equal 0.05 #Temperature reduction parameter in the MSST (unitless)
variable eta_qbmsst equal 1.0 #Coupling constant between the shock and the quantum thermal bath (unitless constant)
## This part uses fix qtb to prepare alpha-quartz with quantum nuclear correction of the initial state
include alpha_quartz_qtb.mod
## This part demonstrates how to retart fix qbmsst during any stage of the shock simulation.
## PPPM may break down when compression ratio becomes extremely large. One can always use this restart technique to resume the shock simulation.
#Compression restart 1
reset_timestep 0
#Beta is the number of time steps between each update of the quantum bath temperature. Setting a larger beta can reduce thermal flactuations.
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 100
timestep ${delta_t}
run 1000
write_restart restart.1000
#Compression restart 2
#Read restart file and load potential again
clear
read_restart restart.1000
include alpha_quartz_potential.mod
#Use the same fix id and add no tscale if the system is already compressed
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 100
timestep ${delta_t}
restart 1000 restart
run 10000 #10 ps

View File

@ -3,60 +3,60 @@
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 &
a1 4.916000 0.000000 0.000000 &
a2 -2.45800 4.257381 0.000000 &
a3 0.000000 0.000000 5.405400 &
&
basis 0.469700 0.000000 0.000000 &
basis 0.000000 0.469700 0.666667 &
basis 0.530300 0.530300 0.333333 &
&
basis 0.413500 0.266900 0.119100 &
basis 0.266900 0.413500 0.547567 &
basis 0.733100 0.146600 0.785767 &
basis 0.586500 0.853400 0.214233 &
basis 0.853400 0.586500 0.452433 &
basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
lattice custom 1.0 &
a1 4.916000 0.000000 0.000000 &
a2 -2.45800 4.257381 0.000000 &
a3 0.000000 0.000000 5.405400 &
&
basis 0.469700 0.000000 0.000000 &
basis 0.000000 0.469700 0.666667 &
basis 0.530300 0.530300 0.333333 &
&
basis 0.413500 0.266900 0.119100 &
basis 0.266900 0.413500 0.547567 &
basis 0.733100 0.146600 0.785767 &
basis 0.586500 0.853400 0.214233 &
basis 0.853400 0.586500 0.452433 &
basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
create_atoms 1 box &
basis 1 1 &
basis 2 1 &
basis 3 1 &
basis 4 2 &
basis 5 2 &
basis 6 2 &
basis 7 2 &
basis 8 2 &
basis 9 2
replicate ${x_rep} ${y_rep} ${z_rep}
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
create_atoms 1 box &
basis 1 1 &
basis 2 1 &
basis 3 1 &
basis 4 2 &
basis 5 2 &
basis 6 2 &
basis 7 2 &
basis 8 2 &
basis 9 2
replicate ${x_rep} ${y_rep} ${z_rep}
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
set type 2 charge -1.2
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
set type 2 charge -1.2
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
include alpha_quartz_potential.mod
include alpha_quartz_potential.mod
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} #NPH does the time integration
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 100
run 2000 # 2 ps
unfix quartz_qtb
unfix scapegoat_qtb
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} ptemp ${temperature} #NPH does the time integration
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 200
run 2000 # 2 ps
unfix quartz_qtb
unfix scapegoat_qtb

View File

@ -0,0 +1,55 @@
## This script first uses fix qtb to equilibrate alpha quartz structure to an initial state with quantum nuclear correction and then simulate shock induced phase transition through the quantum thermal bath multi-scale shock technique
variable x_rep equal 2 #plot is made with x_rep = 8 #x-direction replication number
variable y_rep equal 1 #plot is made with y_rep = 5 #y-direction replication number
variable z_rep equal 4 #plot is made with z_rep = 15 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
variable v_msst equal 78.0 #Shock velocity (Angstrom/ps in metal units)
variable q_msst equal 40.0 #Box mass-like parameter in the MSST (mass^2/length^4, where mass=grams/mole and length=Angstrom in metal units)
variable tscale_msst equal 0.05 #Temperature reduction parameter in the MSST (unitless)
variable eta_qbmsst equal 1.0 #Coupling constant between the shock and the quantum thermal bath (unitless constant)
## This part uses fix qtb to prepare alpha-quartz with quantum nuclear correction of the initial state
include alpha_quartz_qtb.mod
## This part demonstrates how to retart fix qbmsst during any stage of the shock simulation.
## PPPM may break down when compression ratio becomes extremely large. One can always use this restart technique to resume the shock simulation.
#Compression restart 1
reset_timestep 0
#Beta is the number of time steps between each update of the quantum bath temperature. Setting a larger beta can reduce thermal flactuations.
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 200
timestep ${delta_t}
run 1000
write_restart restart.1000
#Compression restart 2
#Read restart file and load potential again
clear
read_restart restart.1000
include alpha_quartz_potential.mod
#Use the same fix id and add no tscale if the system is already compressed
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 500
timestep ${delta_t}
restart 1000 restart
run 10000 #10 ps

View File

@ -0,0 +1,430 @@
LAMMPS (15 Jun 2020)
using 1 OpenMP thread(s) per MPI task
## This script first uses fix qtb to equilibrate alpha quartz structure to an initial state with quantum nuclear correction and then simulate shock induced phase transition through the quantum thermal bath multi-scale shock technique
variable x_rep equal 2 #plot is made with x_rep = 8 #x-direction replication number
variable y_rep equal 1 #plot is made with y_rep = 5 #y-direction replication number
variable z_rep equal 4 #plot is made with z_rep = 15 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
variable v_msst equal 78.0 #Shock velocity (Angstrom/ps in metal units)
variable q_msst equal 40.0 #Box mass-like parameter in the MSST (mass^2/length^4, where mass=grams/mole and length=Angstrom in metal units)
variable tscale_msst equal 0.05 #Temperature reduction parameter in the MSST (unitless)
variable eta_qbmsst equal 1.0 #Coupling constant between the shock and the quantum thermal bath (unitless constant)
## This part uses fix qtb to prepare alpha-quartz with quantum nuclear correction of the initial state
include alpha_quartz_qtb.mod
## This script first constructs an alpha quartz structure of a given size. It then uses fix qtb to equilibrate the computational cell to the specified temperature and pressure.
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 a1 4.916000 0.000000 0.000000 a2 -2.45800 4.257381 0.000000 a3 0.000000 0.000000 5.405400 basis 0.469700 0.000000 0.000000 basis 0.000000 0.469700 0.666667 basis 0.530300 0.530300 0.333333 basis 0.413500 0.266900 0.119100 basis 0.266900 0.413500 0.547567 basis 0.733100 0.146600 0.785767 basis 0.586500 0.853400 0.214233 basis 0.853400 0.586500 0.452433 basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
Lattice spacing in x,y,z = 7.374 4.25738 5.4054
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
Created orthogonal box = (0.0 0.0 0.0) to (4.916 8.514762 5.4054)
1 by 1 by 1 MPI processor grid
create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 2 basis 5 2 basis 6 2 basis 7 2 basis 8 2 basis 9 2
Created 18 atoms
create_atoms CPU = 0.000 seconds
replicate ${x_rep} ${y_rep} ${z_rep}
replicate 2 ${y_rep} ${z_rep}
replicate 2 1 ${z_rep}
replicate 2 1 4
orthogonal box = (0.0 0.0 0.0) to (9.832 8.514762 21.6216)
1 by 1 by 1 MPI processor grid
144 atoms
replicate CPU = 0.000271082 secs
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
48 settings made for charge
set type 2 charge -1.2
96 settings made for charge
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
include alpha_quartz_potential.mod
#This script implements the BKS pair potential for various silicon dioxide compounds. Inner part is fixed with a harmonic potential. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style hybrid/overlay buck/coul/long ${cut_off} table linear 39901
pair_style hybrid/overlay buck/coul/long 10 table linear 39901
pair_coeff 1 1 buck/coul/long 0.0 1.0 0.0 #No interactions between Si atoms
pair_coeff 1 2 buck/coul/long 18003.757200 0.205205 133.538100
pair_coeff 2 2 buck/coul/long 1388.773000 0.362319 175.000000 #BKS interaction in PRL 64 1955 (1990)
pair_modify shift yes
pair_coeff 1 2 table potential_SiO2.TPF Si-O ${cut_off}
pair_coeff 1 2 table potential_SiO2.TPF Si-O 10
pair_coeff 2 2 table potential_SiO2.TPF O-O ${cut_off} #See the potential file for more information
pair_coeff 2 2 table potential_SiO2.TPF O-O 10
WARNING: 1 of 39901 force values in table are inconsistent with -dE/dr.
Should only be flagged at inflection points (src/pair_table.cpp:471)
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
variable p_damp equal 0.001*1000
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} ptemp ${temperature} #NPH does the time integration
fix scapegoat_qtb all nph iso 1.03125 ${pressure} ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp 300
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
fix quartz_qtb all qtb temp 300 damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100
fix quartz_qtb all qtb temp 300 damp 1 seed 35082 f_max 120.00 N_f 100
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 200
run 2000 # 2 ps
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.301598
grid = 9 8 15
stencil order = 5
estimated absolute RMS force accuracy = 0.00117056
estimated relative force accuracy = 8.12908e-05
using double precision FFTW3
3d grid and FFT values/proc = 5280 1080
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 4
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
Per MPI rank memory allocation (min/avg/max) = 80.09 | 80.09 | 80.09 Mbytes
Step Temp Press TotEng Volume Lx Ly Lz Pxx Pyy Pzz Pxy Pyz Pxz
0 0 -34026.791 -2793.6042 1810.0985 9.832 8.514762 21.6216 -37470.578 -37470.432 -27139.363 -6.4345368e-12 0.94245783 4.2212262e-10
200 170.7381 43248.332 -2790.8398 1879.164 9.9554912 8.6217086 21.89317 39337.624 42979.126 47428.246 324.91326 454.85872 -2034.6053
400 258.09921 -28257.8 -2788.3487 1856.1432 9.9146707 8.5863569 21.803402 -19478.873 -29571.375 -35723.152 4633.9026 8487.8103 -626.12005
600 277.77032 -22751.351 -2786.2715 1866.9783 9.9339253 8.6030319 21.845744 -21727.335 -29200.027 -17326.692 -4327.8571 -8218.4965 252.30681
800 349.8665 30508.003 -2784.2204 1873.4953 9.9454706 8.6130304 21.871134 29929.055 33562.672 28032.281 -3188.5605 12329.482 7558.5678
1000 373.67651 -18839.569 -2783.2178 1855.5937 9.9136922 8.5855095 21.80125 -18063.486 -22288.321 -16166.902 -416.09547 -10368.975 9030.4208
1200 423.3474 6846.9905 -2781.9271 1896.2131 9.9855083 8.6477041 21.959181 2147.3938 11765.857 6627.7202 -7627.6782 -1297.6517 -4758.4746
1400 418.54527 -6416.7506 -2781.4358 1834.2719 9.8755745 8.5524986 21.717425 5693.0543 -19487.901 -5455.405 827.66513 -523.1508 -3890.9919
1600 429.42796 3939.8836 -2780.5861 1895.8859 9.984934 8.6472068 21.957918 3755.6959 -1326.4343 9390.3893 1948.1153 4489.8629 1466.0914
1800 447.7623 -8344.6306 -2780.1071 1858.4925 9.9188518 8.5899779 21.812596 -17549.498 3336.8135 -10821.208 1643.4226 -644.56065 -8935.9666
2000 438.1306 -6691.4691 -2780.7407 1871.3547 9.9416812 8.6097487 21.862801 -6959.2196 -8486.8466 -4628.341 -1019.9006 443.03694 -2751.917
Loop time of 2.46815 on 1 procs for 2000 steps with 144 atoms
Performance: 70.012 ns/day, 0.343 hours/ns, 810.323 timesteps/s
99.8% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 2.0003 | 2.0003 | 2.0003 | 0.0 | 81.04
Kspace | 0.20006 | 0.20006 | 0.20006 | 0.0 | 8.11
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.023753 | 0.023753 | 0.023753 | 0.0 | 0.96
Output | 0.0001986 | 0.0001986 | 0.0001986 | 0.0 | 0.01
Modify | 0.23896 | 0.23896 | 0.23896 | 0.0 | 9.68
Other | | 0.004907 | | | 0.20
Nlocal: 144 ave 144 max 144 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 3943 ave 3943 max 3943 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 41952 ave 41952 max 41952 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 41952
Ave neighs/atom = 291.333
Neighbor list builds = 0
Dangerous builds = 0
unfix quartz_qtb
unfix scapegoat_qtb
## This part demonstrates how to retart fix qbmsst during any stage of the shock simulation.
## PPPM may break down when compression ratio becomes extremely large. One can always use this restart technique to resume the shock simulation.
#Compression restart 1
reset_timestep 0
#Beta is the number of time steps between each update of the quantum bath temperature. Setting a larger beta can reduce thermal flactuations.
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q ${q_msst} tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp 1 f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init 300
QBMSST parameters:
Shock in z direction
Cell mass-like parameter qmass (units of mass^2/length^4) = 4.00000e+01
Shock velocity = 7.80000e+01
Artificial viscosity (units of mass/length/time) = 0.00000e+00
Initial pressure calculated on first step
Initial volume calculated on first step
Initial energy calculated on first step
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 200
timestep ${delta_t}
timestep 0.001
run 1000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.303132
grid = 9 8 16
stencil order = 5
estimated absolute RMS force accuracy = 0.00104699
estimated relative force accuracy = 7.27093e-05
using double precision FFTW3
3d grid and FFT values/proc = 5520 1152
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 4
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
Fix QBMSST v0 = 1.87135e+03
Fix QBMSST p0 = -4.62948e+03
Fix QBMSST e0 = to be -2.78074e+03
Fix QBMSST initial strain rate of -4.01096e-01 established by reducing temperature by factor of 5.00000e-02
Per MPI rank memory allocation (min/avg/max) = 80.1 | 80.1 | 80.1 Mbytes
Step v_T_qm Press TotEng Volume Lx Ly Lz Pzz v_dhug v_dray v_lgr_vel v_lgr_pos
0 300 -6922.9433 -2780.7394 1871.3547 9.9416812 8.6097487 21.862801 -4819.9907 10.953265 -190.51273 0 0
200 294.95797 54876.416 -2779.2988 1723.7621 9.9416812 8.6097487 20.138495 108897.19 -29.773973 -9271.7281 6.1518102 -15.057867
400 288.3711 139521.03 -2778.7321 1628.5574 9.9416812 8.6097487 19.026231 222107.71 8.0682073 24727.575 10.120041 -28.714693
600 280.56521 98070.281 -2779.8934 1687.2434 9.9416812 8.6097487 19.711852 164558.51 2.6076928 16005.656 7.6739491 -42.705007
800 274.94701 106060.26 -2779.2916 1651.0723 9.9416812 8.6097487 19.289269 176842.6 -39.645354 -1804.9466 9.1815975 -56.628078
1000 268.47106 189695.34 -2779.4951 1492.6355 9.9416812 8.6097487 17.438272 277351.5 -84.834482 -33116.996 15.785409 -69.870519
Loop time of 2.05219 on 1 procs for 1000 steps with 144 atoms
Performance: 42.101 ns/day, 0.570 hours/ns, 487.284 timesteps/s
99.8% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 1.6815 | 1.6815 | 1.6815 | 0.0 | 81.94
Kspace | 0.10373 | 0.10373 | 0.10373 | 0.0 | 5.05
Neigh | 0.0061183 | 0.0061183 | 0.0061183 | 0.0 | 0.30
Comm | 0.012444 | 0.012444 | 0.012444 | 0.0 | 0.61
Output | 0.00014687 | 0.00014687 | 0.00014687 | 0.0 | 0.01
Modify | 0.24529 | 0.24529 | 0.24529 | 0.0 | 11.95
Other | | 0.002948 | | | 0.14
Nlocal: 144 ave 144 max 144 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 4243 ave 4243 max 4243 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 48210 ave 48210 max 48210 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 48210
Ave neighs/atom = 334.792
Neighbor list builds = 8
Dangerous builds = 0
write_restart restart.1000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.306435
grid = 9 8 15
stencil order = 5
estimated absolute RMS force accuracy = 0.000955688
estimated relative force accuracy = 6.63689e-05
using double precision FFTW3
3d grid and FFT values/proc = 5280 1080
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 3
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
#Compression restart 2
#Read restart file and load potential again
clear
using 1 OpenMP thread(s) per MPI task
read_restart restart.1000
restoring atom style charge from restart
orthogonal box = (-0.05484062286382799 -0.04749337384227555 2.0916641327653274) to (9.886840622863804 8.562255373842252 19.52993586723476)
1 by 1 by 1 MPI processor grid
restoring pair style hybrid/overlay from restart
144 atoms
read_restart CPU = 0.0002563 secs
include alpha_quartz_potential.mod
#This script implements the BKS pair potential for various silicon dioxide compounds. Inner part is fixed with a harmonic potential. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style hybrid/overlay buck/coul/long ${cut_off} table linear 39901
pair_style hybrid/overlay buck/coul/long 10 table linear 39901
pair_coeff 1 1 buck/coul/long 0.0 1.0 0.0 #No interactions between Si atoms
pair_coeff 1 2 buck/coul/long 18003.757200 0.205205 133.538100
pair_coeff 2 2 buck/coul/long 1388.773000 0.362319 175.000000 #BKS interaction in PRL 64 1955 (1990)
pair_modify shift yes
pair_coeff 1 2 table potential_SiO2.TPF Si-O ${cut_off}
pair_coeff 1 2 table potential_SiO2.TPF Si-O 10
pair_coeff 2 2 table potential_SiO2.TPF O-O ${cut_off} #See the potential file for more information
pair_coeff 2 2 table potential_SiO2.TPF O-O 10
WARNING: 1 of 39901 force values in table are inconsistent with -dE/dr.
Should only be flagged at inflection points (src/pair_table.cpp:471)
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
#Use the same fix id and add no tscale if the system is already compressed
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q ${q_msst} tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp 1 f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init 300
QBMSST parameters:
Shock in z direction
Cell mass-like parameter qmass (units of mass^2/length^4) = 4.00000e+01
Shock velocity = 7.80000e+01
Artificial viscosity (units of mass/length/time) = 0.00000e+00
Initial pressure calculated on first step
Initial volume calculated on first step
Initial energy calculated on first step
Resetting global fix info from restart file:
fix style: qbmsst, fix ID: shock
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 500
timestep ${delta_t}
timestep 0.001
restart 1000 restart
run 10000 #10 ps
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.306435
grid = 9 8 15
stencil order = 5
estimated absolute RMS force accuracy = 0.000955688
estimated relative force accuracy = 6.63689e-05
using double precision FFTW3
3d grid and FFT values/proc = 5280 1080
All restart file global fix info was re-assigned
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 3
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
Per MPI rank memory allocation (min/avg/max) = 80.12 | 80.12 | 80.12 Mbytes
Step v_T_qm Press TotEng Volume Lx Ly Lz Pzz v_dhug v_dray v_lgr_vel v_lgr_pos
1000 268.47106 189686.77 -2781.5194 1492.6355 9.9416812 8.6097487 17.438272 277378.37 -84.692548 -33090.129 15.785409 0
1500 362.13476 692245.96 -2800.9352 1011.2037 9.9416812 8.6097487 11.813766 661095.53 188.71833 -49928.712 35.851981 -24.11484
2000 860.78914 714816.8 -2830.893 997.64749 9.9416812 8.6097487 11.65539 653537.64 852.68158 -68765.537 36.41702 -44.978484
2500 1620.8281 709511.19 -2840.8217 1000.3425 9.9416812 8.6097487 11.686875 660030.01 1184.3105 -60030.892 36.304689 -65.69966
3000 2395.6824 649526.84 -2832.6859 995.56591 9.9416812 8.6097487 11.631071 660984.37 939.07209 -63050.693 36.503782 -86.383242
3500 3034.6774 715794.56 -2822.6098 995.8622 9.9416812 8.6097487 11.634532 712849.74 1055.7295 -10938.816 36.491433 -106.99315
4000 3487.9039 736791.25 -2804.1216 994.13867 9.9416812 8.6097487 11.614397 765817.85 943.15747 40595.305 36.563271 -127.76315
4500 3718.6279 813775.8 -2788.1942 995.82514 9.9416812 8.6097487 11.634099 881961.06 1370.5559 158141.68 36.492977 -148.68649
5000 3691.4947 750146.58 -2770.5541 1018.4785 9.9416812 8.6097487 11.898756 770500.36 196.2793 65528.786 35.548762 -169.8589
5500 3585.8602 831522.51 -2766.0198 1005.6834 9.9416812 8.6097487 11.749273 916093.67 1088.1987 200476.48 36.082073 -190.89436
6000 3431.6405 749891.94 -2771.6404 1011.9077 9.9416812 8.6097487 11.82199 781321.11 268.24344 70882.55 35.82264 -212.20913
6500 3350.2876 666113.16 -2780.4124 1028.8353 9.9416812 8.6097487 12.019753 749294.32 371.38231 52939.676 35.117081 -233.59556
7000 3339.2397 675783.2 -2782.7559 1022.6541 9.9416812 8.6097487 11.947539 690109.39 -26.949124 -11388.054 35.374719 -254.95868
7500 3395.582 726601.74 -2784.7652 1018.1439 9.9416812 8.6097487 11.894846 759167.86 506.5811 53917.852 35.56271 -276.24361
8000 3393.2372 625141.93 -2771.6398 1035.4915 9.9416812 8.6097487 12.097517 598674.46 -895.80046 -92142.112 34.839641 -297.61681
8500 3272.9752 659367.77 -2776.608 1031.8188 9.9416812 8.6097487 12.054609 688358.42 -142.30814 -5513.8593 34.992722 -318.94541
9000 3277.8848 724828.76 -2777.6502 1017.6314 9.9416812 8.6097487 11.888859 724452.11 58.574942 18775.738 35.58407 -340.1718
9500 3273.7854 620652.38 -2780.0794 1023.5922 9.9416812 8.6097487 11.958499 747175.42 317.3826 46458.505 35.335617 -361.41643
10000 3329.1766 668606.38 -2786.3493 1022.9534 9.9416812 8.6097487 11.951035 703351.81 168.14538 2103.38 35.362244 -382.64609
10500 3398.9956 642919.16 -2784.2833 1016.2587 9.9416812 8.6097487 11.872822 661298.16 -230.03577 -45520.34 35.641287 -403.78721
11000 3418.7053 675754.06 -2782.6318 1005.7483 9.9416812 8.6097487 11.75003 689789.84 -136.97148 -25773.422 36.079372 -424.97556
Loop time of 32.4277 on 1 procs for 10000 steps with 144 atoms
Performance: 26.644 ns/day, 0.901 hours/ns, 308.378 timesteps/s
99.5% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 28.397 | 28.397 | 28.397 | 0.0 | 87.57
Kspace | 1.0225 | 1.0225 | 1.0225 | 0.0 | 3.15
Neigh | 0.27594 | 0.27594 | 0.27594 | 0.0 | 0.85
Comm | 0.1797 | 0.1797 | 0.1797 | 0.0 | 0.55
Output | 0.10409 | 0.10409 | 0.10409 | 0.0 | 0.32
Modify | 2.4112 | 2.4112 | 2.4112 | 0.0 | 7.44
Other | | 0.03707 | | | 0.11
Nlocal: 144 ave 144 max 144 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 5541 ave 5541 max 5541 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 74662 ave 74662 max 74662 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 74662
Ave neighs/atom = 518.486
Neighbor list builds = 207
Dangerous builds = 0
Total wall time: 0:00:37

View File

@ -0,0 +1,430 @@
LAMMPS (15 Jun 2020)
using 1 OpenMP thread(s) per MPI task
## This script first uses fix qtb to equilibrate alpha quartz structure to an initial state with quantum nuclear correction and then simulate shock induced phase transition through the quantum thermal bath multi-scale shock technique
variable x_rep equal 2 #plot is made with x_rep = 8 #x-direction replication number
variable y_rep equal 1 #plot is made with y_rep = 5 #y-direction replication number
variable z_rep equal 4 #plot is made with z_rep = 15 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
variable v_msst equal 78.0 #Shock velocity (Angstrom/ps in metal units)
variable q_msst equal 40.0 #Box mass-like parameter in the MSST (mass^2/length^4, where mass=grams/mole and length=Angstrom in metal units)
variable tscale_msst equal 0.05 #Temperature reduction parameter in the MSST (unitless)
variable eta_qbmsst equal 1.0 #Coupling constant between the shock and the quantum thermal bath (unitless constant)
## This part uses fix qtb to prepare alpha-quartz with quantum nuclear correction of the initial state
include alpha_quartz_qtb.mod
## This script first constructs an alpha quartz structure of a given size. It then uses fix qtb to equilibrate the computational cell to the specified temperature and pressure.
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 a1 4.916000 0.000000 0.000000 a2 -2.45800 4.257381 0.000000 a3 0.000000 0.000000 5.405400 basis 0.469700 0.000000 0.000000 basis 0.000000 0.469700 0.666667 basis 0.530300 0.530300 0.333333 basis 0.413500 0.266900 0.119100 basis 0.266900 0.413500 0.547567 basis 0.733100 0.146600 0.785767 basis 0.586500 0.853400 0.214233 basis 0.853400 0.586500 0.452433 basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
Lattice spacing in x,y,z = 7.374 4.25738 5.4054
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
Created orthogonal box = (0.0 0.0 0.0) to (4.916 8.514762 5.4054)
1 by 2 by 2 MPI processor grid
create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 2 basis 5 2 basis 6 2 basis 7 2 basis 8 2 basis 9 2
Created 18 atoms
create_atoms CPU = 0.000 seconds
replicate ${x_rep} ${y_rep} ${z_rep}
replicate 2 ${y_rep} ${z_rep}
replicate 2 1 ${z_rep}
replicate 2 1 4
orthogonal box = (0.0 0.0 0.0) to (9.832 8.514762 21.6216)
1 by 1 by 4 MPI processor grid
144 atoms
replicate CPU = 0.000225782 secs
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
48 settings made for charge
set type 2 charge -1.2
96 settings made for charge
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
include alpha_quartz_potential.mod
#This script implements the BKS pair potential for various silicon dioxide compounds. Inner part is fixed with a harmonic potential. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style hybrid/overlay buck/coul/long ${cut_off} table linear 39901
pair_style hybrid/overlay buck/coul/long 10 table linear 39901
pair_coeff 1 1 buck/coul/long 0.0 1.0 0.0 #No interactions between Si atoms
pair_coeff 1 2 buck/coul/long 18003.757200 0.205205 133.538100
pair_coeff 2 2 buck/coul/long 1388.773000 0.362319 175.000000 #BKS interaction in PRL 64 1955 (1990)
pair_modify shift yes
pair_coeff 1 2 table potential_SiO2.TPF Si-O ${cut_off}
pair_coeff 1 2 table potential_SiO2.TPF Si-O 10
pair_coeff 2 2 table potential_SiO2.TPF O-O ${cut_off} #See the potential file for more information
pair_coeff 2 2 table potential_SiO2.TPF O-O 10
WARNING: 1 of 39901 force values in table are inconsistent with -dE/dr.
Should only be flagged at inflection points (src/pair_table.cpp:471)
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
variable p_damp equal 0.001*1000
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} ptemp ${temperature} #NPH does the time integration
fix scapegoat_qtb all nph iso 1.03125 ${pressure} ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp 300
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
fix quartz_qtb all qtb temp 300 damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100
fix quartz_qtb all qtb temp 300 damp 1 seed 35082 f_max 120.00 N_f 100
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 200
run 2000 # 2 ps
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.301598
grid = 9 8 15
stencil order = 5
estimated absolute RMS force accuracy = 0.00117056
estimated relative force accuracy = 8.12908e-05
using double precision FFTW3
3d grid and FFT values/proc = 2400 288
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 4
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
Per MPI rank memory allocation (min/avg/max) = 79.7 | 79.7 | 79.7 Mbytes
Step Temp Press TotEng Volume Lx Ly Lz Pxx Pyy Pzz Pxy Pyz Pxz
0 0 -34026.791 -2793.6042 1810.0985 9.832 8.514762 21.6216 -37470.578 -37470.432 -27139.363 1.0530512e-10 0.94245783 4.0087238e-10
200 153.57631 45538.205 -2790.8177 1873.0866 9.9447472 8.612404 21.869543 41721.016 44095.248 50798.351 -3961.4596 1223.325 2871.656
400 234.74785 -34404.175 -2789.0189 1850.2127 9.9041 8.5772024 21.780156 -28329.333 -39376.313 -35506.88 -1154.5043 -5411.1071 2246.6749
600 265.24833 -20905.145 -2786.2727 1874.9981 9.948129 8.6153326 21.87698 -22753.886 -21091.083 -18870.468 -4645.5548 2968.2945 1415.0311
800 297.79035 32990.58 -2784.8247 1853.6946 9.910309 8.5825796 21.79381 30061.364 35359.18 33551.195 -3092.2971 1525.52 -6461.0249
1000 367.71884 -27539.239 -2783.0102 1864.7161 9.9299114 8.5995557 21.836917 -20273.387 -38720.429 -23623.901 7639.0334 -866.35665 543.52723
1200 399.77109 3807.7814 -2781.511 1893.4978 9.9807399 8.6435745 21.948695 1625.8226 7441.2236 2356.298 -4057.1674 3814.9305 1528.4567
1400 466.57962 -4148.235 -2780.1546 1851.5925 9.9065614 8.5793341 21.785568 -10883.19 1816.768 -3378.2828 896.25296 -7208.541 -42.253127
1600 497.86539 14505.31 -2778.9409 1882.2616 9.9609584 8.6264432 21.905193 8268.1103 20614.738 14633.082 -2690.5669 6807.3187 11995.878
1800 557.31182 -108.04462 -2778.1875 1875.514 9.9490413 8.6161228 21.878986 948.68308 -1929.7575 656.94053 -1628.2172 -6594.5909 -4423.4368
2000 480.39449 -8852.2243 -2778.4963 1862.9552 9.9267847 8.596848 21.830042 -18274.307 3038.8369 -11321.203 -5002.1016 12023.282 6845.2769
Loop time of 1.42181 on 4 procs for 2000 steps with 144 atoms
Performance: 121.535 ns/day, 0.197 hours/ns, 1406.656 timesteps/s
87.5% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.72578 | 0.80093 | 0.87518 | 6.1 | 56.33
Kspace | 0.33737 | 0.41245 | 0.48642 | 8.4 | 29.01
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.066098 | 0.071334 | 0.076039 | 1.6 | 5.02
Output | 0.00021172 | 0.00039291 | 0.00093484 | 0.0 | 0.03
Modify | 0.090105 | 0.1077 | 0.11384 | 3.1 | 7.58
Other | | 0.029 | | | 2.04
Nlocal: 36 ave 36 max 36 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Nghost: 2614 ave 2614 max 2614 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Neighs: 10488 ave 11326 max 9404 min
Histogram: 1 0 0 0 0 0 2 0 0 1
Total # of neighbors = 41952
Ave neighs/atom = 291.333
Neighbor list builds = 0
Dangerous builds = 0
unfix quartz_qtb
unfix scapegoat_qtb
## This part demonstrates how to retart fix qbmsst during any stage of the shock simulation.
## PPPM may break down when compression ratio becomes extremely large. One can always use this restart technique to resume the shock simulation.
#Compression restart 1
reset_timestep 0
#Beta is the number of time steps between each update of the quantum bath temperature. Setting a larger beta can reduce thermal flactuations.
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q ${q_msst} tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale ${tscale_msst} damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp 1 f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.05 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init 300
QBMSST parameters:
Shock in z direction
Cell mass-like parameter qmass (units of mass^2/length^4) = 4.00000e+01
Shock velocity = 7.80000e+01
Artificial viscosity (units of mass/length/time) = 0.00000e+00
Initial pressure calculated on first step
Initial volume calculated on first step
Initial energy calculated on first step
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 200
timestep ${delta_t}
timestep 0.001
run 1000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.30088
grid = 9 8 15
stencil order = 5
estimated absolute RMS force accuracy = 0.00120534
estimated relative force accuracy = 8.37062e-05
using double precision FFTW3
3d grid and FFT values/proc = 2400 288
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 4
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
Fix QBMSST v0 = 1.86296e+03
Fix QBMSST p0 = -1.13219e+04
Fix QBMSST e0 = to be -2.77850e+03
Fix QBMSST initial strain rate of -4.21890e-01 established by reducing temperature by factor of 5.00000e-02
Per MPI rank memory allocation (min/avg/max) = 79.7 | 79.7 | 79.7 Mbytes
Step v_T_qm Press TotEng Volume Lx Ly Lz Pzz v_dhug v_dray v_lgr_vel v_lgr_pos
0 300 -9106.318 -2778.4963 1862.9552 9.9267847 8.596848 21.830042 -11562.002 12.009862 -240.0699 0 0
200 296.47213 25984.111 -2777.5178 1770.2164 9.9267847 8.596848 20.743332 64970.204 -25.305765 -1564.7673 3.8828772 -15.16768
400 291.06707 69977.517 -2777.6325 1684.893 9.9267847 8.596848 19.743515 144833.82 -12.184734 6667.384 7.4552796 -29.607028
600 287.21118 39706.699 -2778.0322 1716.9533 9.9267847 8.596848 20.119196 87971.152 -38.593844 -23279.741 6.1129484 -43.751298
800 284.33611 18833.281 -2778.1637 1792.7576 9.9267847 8.596848 21.007468 43725.433 -8.1267799 -3885.5802 2.9391022 -58.454556
1000 281.98328 -6030.6935 -2778.3314 1881.8369 9.9267847 8.596848 22.051297 -14118.602 1.3183874 13055.078 -0.79055793 -73.780965
Loop time of 1.25215 on 4 procs for 1000 steps with 144 atoms
Performance: 69.001 ns/day, 0.348 hours/ns, 798.628 timesteps/s
90.6% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 0.67979 | 0.73665 | 0.8091 | 5.4 | 58.83
Kspace | 0.18687 | 0.25893 | 0.31544 | 9.1 | 20.68
Neigh | 0.0011306 | 0.0012404 | 0.0013735 | 0.3 | 0.10
Comm | 0.040339 | 0.041345 | 0.042296 | 0.4 | 3.30
Output | 0.00020051 | 0.00035506 | 0.00081801 | 0.0 | 0.03
Modify | 0.19595 | 0.2007 | 0.20253 | 0.6 | 16.03
Other | | 0.01292 | | | 1.03
Nlocal: 36 ave 38 max 34 min
Histogram: 1 0 1 0 0 0 0 1 0 1
Nghost: 2527.75 ave 2547 max 2518 min
Histogram: 2 0 0 1 0 0 0 0 0 1
Neighs: 10194.8 ave 11177 max 9437 min
Histogram: 2 0 0 0 0 0 1 0 0 1
Total # of neighbors = 40779
Ave neighs/atom = 283.188
Neighbor list builds = 6
Dangerous builds = 0
write_restart restart.1000
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.302953
grid = 9 8 16
stencil order = 5
estimated absolute RMS force accuracy = 0.00105569
estimated relative force accuracy = 7.33134e-05
using double precision FFTW3
3d grid and FFT values/proc = 2640 288
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 4
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
#Compression restart 2
#Read restart file and load potential again
clear
using 1 OpenMP thread(s) per MPI task
read_restart restart.1000
restoring atom style charge from restart
orthogonal box = (-0.04739235907204603 -0.041042988010289584 -0.21484841641189512) to (9.879392359072014 8.555804988010294 21.83644841641206)
1 by 1 by 4 MPI processor grid
restoring pair style hybrid/overlay from restart
144 atoms
read_restart CPU = 0.000472307 secs
include alpha_quartz_potential.mod
#This script implements the BKS pair potential for various silicon dioxide compounds. Inner part is fixed with a harmonic potential. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style hybrid/overlay buck/coul/long ${cut_off} table linear 39901
pair_style hybrid/overlay buck/coul/long 10 table linear 39901
pair_coeff 1 1 buck/coul/long 0.0 1.0 0.0 #No interactions between Si atoms
pair_coeff 1 2 buck/coul/long 18003.757200 0.205205 133.538100
pair_coeff 2 2 buck/coul/long 1388.773000 0.362319 175.000000 #BKS interaction in PRL 64 1955 (1990)
pair_modify shift yes
pair_coeff 1 2 table potential_SiO2.TPF Si-O ${cut_off}
pair_coeff 1 2 table potential_SiO2.TPF Si-O 10
pair_coeff 2 2 table potential_SiO2.TPF O-O ${cut_off} #See the potential file for more information
pair_coeff 2 2 table potential_SiO2.TPF O-O 10
WARNING: 1 of 39901 force values in table are inconsistent with -dE/dr.
Should only be flagged at inflection points (src/pair_table.cpp:471)
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
#Use the same fix id and add no tscale if the system is already compressed
fix shock all qbmsst z ${v_msst} q ${q_msst} tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q ${q_msst} tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp ${damp_qtb} f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp 1 f_max 120 N_f 100 seed 35082 eta ${eta_qbmsst} beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init ${temperature}
fix shock all qbmsst z 78 q 40 tscale 0.0 damp 1 f_max 120 N_f 100 seed 35082 eta 1 beta 5 T_init 300
QBMSST parameters:
Shock in z direction
Cell mass-like parameter qmass (units of mass^2/length^4) = 4.00000e+01
Shock velocity = 7.80000e+01
Artificial viscosity (units of mass/length/time) = 0.00000e+00
Initial pressure calculated on first step
Initial volume calculated on first step
Initial energy calculated on first step
Resetting global fix info from restart file:
fix style: qbmsst, fix ID: shock
fix_modify shock energy yes
variable dhug equal f_shock[1]
variable dray equal f_shock[2]
variable lgr_vel equal f_shock[3]
variable lgr_pos equal f_shock[4]
variable T_qm equal f_shock[5] #Temperature with quantum nuclear correction
thermo_style custom step v_T_qm press etotal vol lx ly lz pzz v_dhug v_dray v_lgr_vel v_lgr_pos
thermo 500
timestep ${delta_t}
timestep 0.001
restart 1000 restart
run 10000 #10 ps
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.302953
grid = 9 8 16
stencil order = 5
estimated absolute RMS force accuracy = 0.00105569
estimated relative force accuracy = 7.33134e-05
using double precision FFTW3
3d grid and FFT values/proc = 2640 288
All restart file global fix info was re-assigned
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 2 4
2 neighbor lists, perpetual/occasional/extra = 2 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
(2) pair table, perpetual, skip from (1)
attributes: half, newton on
pair build: skip
stencil: none
bin: none
Per MPI rank memory allocation (min/avg/max) = 79.71 | 79.71 | 79.71 Mbytes
Step v_T_qm Press TotEng Volume Lx Ly Lz Pzz v_dhug v_dray v_lgr_vel v_lgr_pos
1000 281.98328 -6031.2395 -2778.6227 1881.8369 9.9267847 8.596848 22.051297 -14113.621 1.3373278 13060.059 -0.79055793 0
1500 266.12746 44405.573 -2777.9815 1739.6543 9.9267847 8.596848 20.385206 92590.239 -12.06041 397.47049 5.1624821 -37.823748
2000 255.79411 17620.408 -2777.9685 1785.7619 9.9267847 8.596848 20.925494 48670.364 -16.082827 -4813.6764 3.2320016 -73.974437
2500 256.8887 40153.833 -2778.4337 1752.9461 9.9267847 8.596848 20.540959 79665.002 7.7413878 -1368.8927 4.6059671 -112.35254
3000 261.55251 5315.4799 -2779.0755 1834.3375 9.9267847 8.596848 21.4947 15896.368 22.588205 3192.882 1.1981949 -148.36068
3500 261.57101 57911.809 -2778.1223 1713.3956 9.9267847 8.596848 20.077507 110996.8 -9.4471543 -3240.9018 6.2619064 -186.41261
4000 254.88665 13952.95 -2778.4816 1818.2782 9.9267847 8.596848 21.306518 26833.588 2.2818412 647.88057 1.8705799 -222.72504
4500 240.08908 73322.997 -2776.7382 1668.6666 9.9267847 8.596848 19.553375 151978.11 -43.917346 189.1572 8.1346613 -260.52885
5000 214.49084 1925.2557 -2777.0657 1890.0985 9.9267847 8.596848 22.148106 -5218.7292 -44.5537 28890.787 -1.1364617 -297.26329
5500 194.6515 71804.842 -2777.3417 1669.7297 9.9267847 8.596848 19.565832 146911.42 -34.911593 -3985.0635 8.0901523 -334.1879
6000 186.23814 10196.007 -2777.1394 1837.3793 9.9267847 8.596848 21.530344 23550.907 -18.381207 13401.096 1.0708382 -371.9208
6500 172.53603 5474.3725 -2777.4502 1818.0038 9.9267847 8.596848 21.303303 18389.825 -22.65951 -8026.2088 1.8820667 -407.83084
7000 160.91186 107908.64 -2777.6746 1621.7378 9.9267847 8.596848 19.003464 196841.27 -8.6606903 5654.1938 10.099523 -444.9925
7500 146.01905 147030.69 -2777.2543 1539.7536 9.9267847 8.596848 18.042777 253089.02 -43.928324 -6926.1018 13.532114 -478.63113
8000 207.17758 837859.1 -2796.8957 989.32874 9.9267847 8.596848 11.592918 811765.11 1172.3778 89652.363 36.577833 -503.41923
8500 725.15657 853732.89 -2832.3144 974.18299 9.9267847 8.596848 11.415441 773926.64 1749.5702 39098.598 37.21197 -524.17835
9000 1554.6089 807867.74 -2843.0063 990.10922 9.9267847 8.596848 11.602064 749697.22 1959.0322 28239.71 36.545155 -544.77354
9500 2440.1194 748145.05 -2839.2364 992.38871 9.9267847 8.596848 11.628775 691503.58 1437.0708 -28040.223 36.449715 -565.41198
10000 3112.1817 823862.43 -2820.0495 982.35471 9.9267847 8.596848 11.511197 754954.89 1330.6807 26987.244 36.869828 -586.12357
10500 3550.0273 868916.79 -2803.7678 983.70386 9.9267847 8.596848 11.527006 867368.45 1727.9058 140533.46 36.813341 -607.00946
11000 3839.7527 830581.55 -2795.3804 995.31485 9.9267847 8.596848 11.663063 811740 1150.0462 94652.768 36.327201 -628.02229
Loop time of 15.1476 on 4 procs for 10000 steps with 144 atoms
Performance: 57.039 ns/day, 0.421 hours/ns, 660.171 timesteps/s
91.3% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 7.7228 | 9.085 | 10.626 | 36.0 | 59.98
Kspace | 1.6343 | 3.1795 | 4.5467 | 61.0 | 20.99
Neigh | 0.02063 | 0.027076 | 0.034395 | 3.1 | 0.18
Comm | 0.54719 | 0.57781 | 0.60468 | 2.8 | 3.81
Output | 0.10128 | 0.1019 | 0.10373 | 0.3 | 0.67
Modify | 2.0819 | 2.1159 | 2.1495 | 1.8 | 13.97
Other | | 0.06035 | | | 0.40
Nlocal: 36 ave 38 max 33 min
Histogram: 1 0 0 0 0 0 1 0 1 1
Nghost: 4267 ave 4304 max 4239 min
Histogram: 1 0 1 0 1 0 0 0 0 1
Neighs: 18859.2 ave 25108 max 12333 min
Histogram: 1 0 0 1 0 0 1 0 0 1
Total # of neighbors = 75437
Ave neighs/atom = 523.868
Neighbor list builds = 95
Dangerous builds = 0
Total wall time: 0:00:17

View File

@ -1,4 +1,4 @@
#Potential between O,Si atoms. r ranges from 0.1 to 20.0. This file+BKS(with no shift)=alpha*(r-rs)^2(0.1<r<rs);BKS(20.0>r>rs). alpha=100, rsOO=1.43869, rsSiO=1.19362. All with metal units.
#Potential between O,Si atoms. UNITS: metal r ranges from 0.1 to 20.0. This file+BKS(with no shift)=alpha*(r-rs)^2(0.1<r<rs);BKS(20.0>r>rs). alpha=100, rsOO=1.43869, rsSiO=1.19362. All with metal units.
Si-O
N 39901

View File

@ -1,79 +0,0 @@
## This script first constructs an alpha quartz structure of a given size. It then uses fix qtb to equilibrate the computational cell to the specified temperature and pressure.
variable x_rep equal 2 #x-direction replication number
variable y_rep equal 2 #y-direction replication number
variable z_rep equal 2 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 &
a1 4.916000 0.000000 0.000000 &
a2 -2.45800 4.257381 0.000000 &
a3 0.000000 0.000000 5.405400 &
&
basis 0.469700 0.000000 0.000000 &
basis 0.000000 0.469700 0.666667 &
basis 0.530300 0.530300 0.333333 &
&
basis 0.413500 0.266900 0.119100 &
basis 0.266900 0.413500 0.547567 &
basis 0.733100 0.146600 0.785767 &
basis 0.586500 0.853400 0.214233 &
basis 0.853400 0.586500 0.452433 &
basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
create_atoms 1 box &
basis 1 1 &
basis 2 1 &
basis 3 1 &
basis 4 2 &
basis 5 2 &
basis 6 2 &
basis 7 2 &
basis 8 2 &
basis 9 2
replicate ${x_rep} ${y_rep} ${z_rep}
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
set type 2 charge -1.2
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style buck/coul/long ${cut_off} #BKS interaction, PRL 64 1955 (1990)
pair_coeff 1 1 0.0 1.0 0.0
pair_coeff 1 2 18003.757200 0.205205 133.538100
pair_coeff 2 2 1388.773000 0.362319 175.000000
pair_modify shift yes
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} #NPH does the time integration
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 100
run 20000 # 20 ps
unfix quartz_qtb
unfix scapegoat_qtb

View File

@ -0,0 +1,79 @@
## This script first constructs an alpha quartz structure of a given size. It then uses fix qtb to equilibrate the computational cell to the specified temperature and pressure.
variable x_rep equal 2 #x-direction replication number
variable y_rep equal 2 #y-direction replication number
variable z_rep equal 2 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 &
a1 4.916000 0.000000 0.000000 &
a2 -2.45800 4.257381 0.000000 &
a3 0.000000 0.000000 5.405400 &
&
basis 0.469700 0.000000 0.000000 &
basis 0.000000 0.469700 0.666667 &
basis 0.530300 0.530300 0.333333 &
&
basis 0.413500 0.266900 0.119100 &
basis 0.266900 0.413500 0.547567 &
basis 0.733100 0.146600 0.785767 &
basis 0.586500 0.853400 0.214233 &
basis 0.853400 0.586500 0.452433 &
basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
create_atoms 1 box &
basis 1 1 &
basis 2 1 &
basis 3 1 &
basis 4 2 &
basis 5 2 &
basis 6 2 &
basis 7 2 &
basis 8 2 &
basis 9 2
replicate ${x_rep} ${y_rep} ${z_rep}
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
set type 2 charge -1.2
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style buck/coul/long ${cut_off} #BKS interaction, PRL 64 1955 (1990)
pair_coeff 1 1 0.0 1.0 0.0
pair_coeff 1 2 18003.757200 0.205205 133.538100
pair_coeff 2 2 1388.773000 0.362319 175.000000
pair_modify shift yes
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} ptemp ${temperature} #NPH does the time integration
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 500
run 10000 # 20 ps
unfix quartz_qtb
unfix scapegoat_qtb

View File

@ -0,0 +1,152 @@
LAMMPS (15 Jun 2020)
using 1 OpenMP thread(s) per MPI task
## This script first constructs an alpha quartz structure of a given size. It then uses fix qtb to equilibrate the computational cell to the specified temperature and pressure.
variable x_rep equal 2 #x-direction replication number
variable y_rep equal 2 #y-direction replication number
variable z_rep equal 2 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 a1 4.916000 0.000000 0.000000 a2 -2.45800 4.257381 0.000000 a3 0.000000 0.000000 5.405400 basis 0.469700 0.000000 0.000000 basis 0.000000 0.469700 0.666667 basis 0.530300 0.530300 0.333333 basis 0.413500 0.266900 0.119100 basis 0.266900 0.413500 0.547567 basis 0.733100 0.146600 0.785767 basis 0.586500 0.853400 0.214233 basis 0.853400 0.586500 0.452433 basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
Lattice spacing in x,y,z = 7.374 4.25738 5.4054
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
Created orthogonal box = (0.0 0.0 0.0) to (4.916 8.514762 5.4054)
1 by 1 by 1 MPI processor grid
create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 2 basis 5 2 basis 6 2 basis 7 2 basis 8 2 basis 9 2
Created 18 atoms
create_atoms CPU = 0.000 seconds
replicate ${x_rep} ${y_rep} ${z_rep}
replicate 2 ${y_rep} ${z_rep}
replicate 2 2 ${z_rep}
replicate 2 2 2
orthogonal box = (0.0 0.0 0.0) to (9.832 17.029524 10.8108)
1 by 1 by 1 MPI processor grid
144 atoms
replicate CPU = 0.000219584 secs
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
48 settings made for charge
set type 2 charge -1.2
96 settings made for charge
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style buck/coul/long ${cut_off} #BKS interaction, PRL 64 1955 (1990)
pair_style buck/coul/long 10
pair_coeff 1 1 0.0 1.0 0.0
pair_coeff 1 2 18003.757200 0.205205 133.538100
pair_coeff 2 2 1388.773000 0.362319 175.000000
pair_modify shift yes
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
variable p_damp equal 0.001*1000
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} ptemp ${temperature} #NPH does the time integration
fix scapegoat_qtb all nph iso 1.03125 ${pressure} ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp 300
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
fix quartz_qtb all qtb temp 300 damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100
fix quartz_qtb all qtb temp 300 damp 1 seed 35082 f_max 120.00 N_f 100
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 500
run 10000 # 20 ps
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.307414
grid = 9 15 10
stencil order = 5
estimated absolute RMS force accuracy = 0.000822922
estimated relative force accuracy = 5.71487e-05
using double precision FFTW3
3d grid and FFT values/proc = 5984 1350
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 3 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
Per MPI rank memory allocation (min/avg/max) = 79.54 | 79.54 | 79.54 Mbytes
Step Temp Press TotEng Volume Lx Ly Lz Pxx Pyy Pzz Pxy Pyz Pxz
0 0 -34025.794 -2793.6041 1810.0985 9.832 17.029524 10.8108 -37478.502 -37477.413 -27121.466 -1.3649088e-10 1.3388978 5.8209479e-10
500 281.29079 -40385.348 -2786.6755 1844.5575 9.893999 17.136909 10.878971 -44649.574 -45631.516 -30874.953 -5970.3691 3630.1324 5208.8966
1000 405.39848 -15491.657 -2783.3315 1874.0851 9.9465141 17.227868 10.936714 -7770.4561 -21469.887 -17234.627 -4706.5632 -8313.9522 -5109.7918
1500 428.98568 -12118.951 -2781.3232 1874.1627 9.9466513 17.228106 10.936865 -11239.135 -11740.052 -13377.666 -3778.9317 -6220.1431 12775.412
2000 522.11905 -6687.482 -2779.2181 1855.9626 9.914349 17.172157 10.901347 -8016.0133 -10737.23 -1309.2028 -4980.3805 5270.2674 5848.5479
2500 496.74376 4264.2623 -2778.9979 1849.3244 9.9025147 17.151659 10.888335 -477.1374 3487.19 9782.7343 -4961.2016 2380.6522 4736.0758
3000 456.49628 2320.781 -2779.3844 1853.2925 9.9095923 17.163918 10.896117 5479.6232 -2954.3023 4437.022 3719.9287 4445.0723 -3278.5058
3500 485.20722 -7480.1789 -2778.6062 1859.6305 9.920876 17.183462 10.908524 -9340.6334 -6129.8494 -6970.0541 -7379.3507 1772.8159 334.33057
4000 527.61216 -13499.73 -2777.3433 1889.9405 9.9744857 17.276316 10.96747 -16483.038 -7465.2297 -16550.923 -2517.02 -1863.063 3314.927
4500 519.94117 721.60614 -2777.8506 1879.6562 9.9563603 17.244922 10.947541 -913.2791 -1765.7541 4843.8516 4466.5704 -14141.087 -6439.5669
5000 505.27757 -6278.3805 -2777.3641 1881.2931 9.9592497 17.249927 10.950718 -14254.233 -2653.6233 -1927.2858 1838.1568 5767.9267 597.47761
5500 500.70903 11303.821 -2777.8881 1871.0076 9.9410666 17.218433 10.930724 -6452.7947 24876.967 15487.29 522.01171 10473.257 9780.893
6000 526.65329 7991.2419 -2777.172 1856.9227 9.9160583 17.175117 10.903227 -68.823156 11005.468 13037.081 1253.9214 10039.559 1053.0486
6500 485.30026 12811.546 -2777.5866 1845.31 9.8953442 17.139239 10.88045 10063.921 20215.037 8155.6798 -3886.954 2249.2807 4855.0011
7000 507.85472 2649.7919 -2777.3359 1861.2877 9.923822 17.188564 10.911763 -4214.7779 6995.1472 5169.0064 -2188.489 6157.0955 533.65478
7500 528.5729 3161.4629 -2779.0851 1855.7946 9.9140499 17.171639 10.901018 2935.365 -2873.1363 9422.1601 771.1885 -4360.9131 4939.8209
8000 533.77283 4534.849 -2777.6538 1858.4772 9.9188246 17.179909 10.906268 -1187.9433 15739.396 -946.90551 -5187.8588 2446.5059 8079.2032
8500 518.71765 1108.9877 -2777.7019 1866.6125 9.9332765 17.20494 10.922159 8720.4976 -8234.9325 2841.3979 5148.5004 -2125.3524 -4127.7468
9000 536.71495 -496.88283 -2778.0262 1877.7099 9.9529227 17.238968 10.943761 -3481.5874 -4611.6246 6602.5634 -2788.5111 -13323.148 4338.813
9500 527.06773 -236.09043 -2778.1125 1895.9227 9.9849986 17.294525 10.97903 -12233.409 7578.0514 3947.0863 -6399.0254 995.22838 8590.7109
10000 526.77335 -4480.6866 -2777.7171 1886.8998 9.9691335 17.267046 10.961585 -3139.961 1336.993 -11639.092 13496.371 -11543.676 -6180.9262
Loop time of 8.86837 on 1 procs for 10000 steps with 144 atoms
Performance: 97.425 ns/day, 0.246 hours/ns, 1127.603 timesteps/s
99.8% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 6.1503 | 6.1503 | 6.1503 | 0.0 | 69.35
Kspace | 1.1522 | 1.1522 | 1.1522 | 0.0 | 12.99
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.11705 | 0.11705 | 0.11705 | 0.0 | 1.32
Output | 0.00035834 | 0.00035834 | 0.00035834 | 0.0 | 0.00
Modify | 1.4245 | 1.4245 | 1.4245 | 0.0 | 16.06
Other | | 0.02397 | | | 0.27
Nlocal: 144 ave 144 max 144 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 3804 ave 3804 max 3804 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 41952 ave 41952 max 41952 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 41952
Ave neighs/atom = 291.333
Neighbor list builds = 0
Dangerous builds = 0
unfix quartz_qtb
unfix scapegoat_qtb
Total wall time: 0:00:08

View File

@ -0,0 +1,152 @@
LAMMPS (15 Jun 2020)
using 1 OpenMP thread(s) per MPI task
## This script first constructs an alpha quartz structure of a given size. It then uses fix qtb to equilibrate the computational cell to the specified temperature and pressure.
variable x_rep equal 2 #x-direction replication number
variable y_rep equal 2 #y-direction replication number
variable z_rep equal 2 #z-direction replication number
variable cut_off equal 10.0 #Cut-off distance for the Buckingham term (Angstrom in metal units)
variable pressure equal 1.03125 #Initial state pressure (bar in metal units)
variable temperature equal 300.0 #Initial state quantum temperature (K in metal units)
variable delta_t equal 1.0e-3 #MD timestep length (ps in metal units)
variable damp_qtb equal 1 #1/gamma where gamma is the friction coefficient in quantum thermal bath (ps in metal units)
## This part defines units, alpha-quartz crystal, and atomic information
#General
units metal
dimension 3
boundary p p p
atom_style charge
#Lattice
lattice custom 1.0 a1 4.916000 0.000000 0.000000 a2 -2.45800 4.257381 0.000000 a3 0.000000 0.000000 5.405400 basis 0.469700 0.000000 0.000000 basis 0.000000 0.469700 0.666667 basis 0.530300 0.530300 0.333333 basis 0.413500 0.266900 0.119100 basis 0.266900 0.413500 0.547567 basis 0.733100 0.146600 0.785767 basis 0.586500 0.853400 0.214233 basis 0.853400 0.586500 0.452433 basis 0.146600 0.733100 0.880900 #American Mineralogist 65 920 1980 (Space Group 154)
Lattice spacing in x,y,z = 7.374 4.25738 5.4054
#Computational Cell
region orthorhombic_unit_cell block 0 4.916000 0 8.514762 0 5.405400 units box
create_box 2 orthorhombic_unit_cell
Created orthogonal box = (0.0 0.0 0.0) to (4.916 8.514762 5.4054)
1 by 2 by 2 MPI processor grid
create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 2 basis 5 2 basis 6 2 basis 7 2 basis 8 2 basis 9 2
Created 18 atoms
create_atoms CPU = 0.000 seconds
replicate ${x_rep} ${y_rep} ${z_rep}
replicate 2 ${y_rep} ${z_rep}
replicate 2 2 ${z_rep}
replicate 2 2 2
orthogonal box = (0.0 0.0 0.0) to (9.832 17.029524 10.8108)
1 by 2 by 2 MPI processor grid
144 atoms
replicate CPU = 0.000231981 secs
#Atomic Information
mass 1 28.085500
mass 2 15.999400
set type 1 charge +2.4
48 settings made for charge
set type 2 charge -1.2
96 settings made for charge
## This part implements the BKS pair potential with a cut-off distance for the Buckingham term. Long range Coulomb interactions are evaluated with the pppm method.
#Pair Potentials
pair_style buck/coul/long ${cut_off} #BKS interaction, PRL 64 1955 (1990)
pair_style buck/coul/long 10
pair_coeff 1 1 0.0 1.0 0.0
pair_coeff 1 2 18003.757200 0.205205 133.538100
pair_coeff 2 2 1388.773000 0.362319 175.000000
pair_modify shift yes
kspace_style pppm 1.0e-4
#Neighbor style
neighbor 2.0 bin
neigh_modify check yes every 1 delay 0 page 100000 one 2000
## This part equilibrates your crystal to a pressure of ${pressure}(unit pressure) and a temperature of ${temperature}(unit temperatureture) with quantum nuclear effects
variable p_damp equal ${delta_t}*1000 #Recommended pressure damping parameter in fix nph
variable p_damp equal 0.001*1000
fix scapegoat_qtb all nph iso ${pressure} ${pressure} ${p_damp} ptemp ${temperature} #NPH does the time integration
fix scapegoat_qtb all nph iso 1.03125 ${pressure} ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 ${p_damp} ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp ${temperature}
fix scapegoat_qtb all nph iso 1.03125 1.03125 1 ptemp 300
fix quartz_qtb all qtb temp ${temperature} damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100 #Change f_max (THz) if your Debye frequency is higher
fix quartz_qtb all qtb temp 300 damp ${damp_qtb} seed 35082 f_max 120.00 N_f 100
fix quartz_qtb all qtb temp 300 damp 1 seed 35082 f_max 120.00 N_f 100
thermo_style custom step temp press etotal vol lx ly lz pxx pyy pzz pxy pyz pxz
thermo 500
run 10000 # 20 ps
PPPM initialization ...
using 12-bit tables for long-range coulomb (src/kspace.cpp:332)
G vector (1/distance) = 0.307414
grid = 9 15 10
stencil order = 5
estimated absolute RMS force accuracy = 0.000822922
estimated relative force accuracy = 5.71487e-05
using double precision FFTW3
3d grid and FFT values/proc = 2688 405
Neighbor list info ...
update every 1 steps, delay 0 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 12
ghost atom cutoff = 12
binsize = 6, bins = 2 3 2
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair buck/coul/long, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d/newton
bin: standard
Per MPI rank memory allocation (min/avg/max) = 79.08 | 79.08 | 79.09 Mbytes
Step Temp Press TotEng Volume Lx Ly Lz Pxx Pyy Pzz Pxy Pyz Pxz
0 0 -34025.794 -2793.6041 1810.0985 9.832 17.029524 10.8108 -37478.502 -37477.413 -27121.466 -5.9958847e-10 1.3388978 7.2750373e-10
500 222.04947 -50221.579 -2787.6677 1851.5661 9.9065143 17.158586 10.892732 -61493.697 -53512.432 -35658.61 4973.9976 7095.5481 -2041.6341
1000 361.92367 -14345.85 -2783.1509 1861.0579 9.9234137 17.187857 10.911314 -4145.4149 -28701.195 -10190.939 7896.3934 -3901.2874 -490.57107
1500 457.97039 -4934.8727 -2779.8321 1860.2254 9.9219337 17.185294 10.909687 -3680.7192 -3045.0707 -8078.8283 456.70383 -4705.3346 -2175.8144
2000 523.52684 -9516.755 -2778.5181 1866.3577 9.9328244 17.204157 10.921662 -11042.489 -7777.5634 -9730.2127 -2016.3336 6027.001 -4150.3656
2500 489.58881 -4968.5157 -2777.3948 1864.0745 9.9287723 17.197139 10.917206 -13652.344 -2823.514 1570.3111 -7481.9537 -1150.3548 10502.368
3000 559.52782 -2882.7076 -2777.5527 1883.2223 9.9626528 17.255821 10.95446 3061.1755 -10570.656 -1138.642 -12045.354 -856.20951 16292.443
3500 521.67929 9974.5929 -2776.7752 1880.5936 9.9580152 17.247789 10.94936 15358.559 7855.8683 6709.3509 7292.9372 -9848.9204 -523.61056
4000 497.90872 -2012.9259 -2776.5554 1862.1703 9.9253904 17.191281 10.913488 -1154.5123 4270.0275 -9154.2927 971.94826 -10157.618 4694.0509
4500 533.64016 -7218.9278 -2775.8789 1883.3041 9.962797 17.256071 10.954618 -18299.547 -5497.566 2140.3296 -1335.6063 -10353.21 5703.7506
5000 551.61416 1590.9702 -2777.6093 1866.2047 9.9325531 17.203687 10.921363 -4600.02 6535.3 2837.6306 3412.3383 9492.18 1017.5742
5500 499.36075 188.82067 -2777.9872 1863.2925 9.9273838 17.194734 10.91568 -3238.914 1143.013 2662.363 4193.7623 -11565.423 2575.9361
6000 478.563 4064.8319 -2778.946 1867.7185 9.935238 17.208337 10.924316 1947.7246 3346.7411 6900.0301 -6339.9554 4133.6942 -4555.406
6500 512.63865 10227.461 -2778.8476 1855.5323 9.9135828 17.17083 10.900505 7423.8967 7558.2024 15700.285 -621.4585 -2620.4837 -3256.7524
7000 489.9889 13037.303 -2778.8793 1856.2469 9.9148553 17.173034 10.901904 10690.345 16770.786 11650.779 -4056.5527 -5023.8847 469.21909
7500 495.52187 1320.5068 -2778.1189 1871.7467 9.9423755 17.2207 10.932164 1978.2905 738.78041 1244.4496 1826.0923 -7829.3563 1873.2713
8000 474.60945 -4203.2068 -2778.8915 1866.5966 9.9332482 17.204891 10.922128 -1480.6896 -12516.261 1387.3306 2731.4462 -1292.9741 10743.939
8500 473.16225 -6266.1992 -2778.594 1872.9075 9.9444304 17.224259 10.934423 -12680.492 -2832.6603 -3285.4455 7226.9632 3762.6841 -5834.9064
9000 486.6579 2843.7947 -2778.0388 1877.3735 9.9523282 17.237939 10.943107 805.23659 6213.7247 1512.4228 2685.2063 -3517.5266 -17054.035
9500 549.35112 -1028.3899 -2776.8124 1880.7965 9.9583733 17.248409 10.949754 -1817.8413 2754.8459 -4022.1743 -3101.1463 8397.2345 -8608.1342
10000 562.27081 12885.53 -2775.7435 1850.2864 9.9042316 17.154633 10.890222 15758.218 9989.5121 12908.859 -25.724137 -16691.374 267.85371
Loop time of 3.80648 on 4 procs for 10000 steps with 144 atoms
Performance: 226.981 ns/day, 0.106 hours/ns, 2627.100 timesteps/s
94.8% CPU use with 4 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 1.3526 | 1.6581 | 1.9634 | 21.3 | 43.56
Kspace | 0.92143 | 1.2222 | 1.5232 | 24.7 | 32.11
Neigh | 0 | 0 | 0 | 0.0 | 0.00
Comm | 0.31886 | 0.32256 | 0.32604 | 0.5 | 8.47
Output | 0.0003643 | 0.00083923 | 0.0022533 | 0.0 | 0.02
Modify | 0.39166 | 0.45985 | 0.52607 | 8.9 | 12.08
Other | | 0.143 | | | 3.76
Nlocal: 36 ave 36 max 36 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Nghost: 2614 ave 2614 max 2614 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Neighs: 10488 ave 12570 max 8406 min
Histogram: 2 0 0 0 0 0 0 0 0 2
Total # of neighbors = 41952
Ave neighs/atom = 291.333
Neighbor list builds = 0
Dangerous builds = 0
unfix quartz_qtb
unfix scapegoat_qtb
Total wall time: 0:00:03

View File

@ -371,8 +371,14 @@ void PairEAMAlloyGPU::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(PairEAM::lmp, filename,
"EAMAlloy", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -417,11 +423,19 @@ void PairEAMAlloyGPU::read_file(char *filename)
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
if (unit_convert) {
for (int j = 1; j < file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k < file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -371,8 +371,14 @@ void PairEAMFSGPU::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(PairEAM::lmp, filename, "EAMFS",
unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -416,6 +422,10 @@ void PairEAMFSGPU::read_file(char *filename)
file->mass[i] = values.next_double();
reader.next_dvector(&file->frho[i][1], file->nrho);
if (unit_convert) {
for (int j = 1; j <= file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(&file->rhor[i][j][1], file->nr);
@ -425,6 +435,10 @@ void PairEAMFSGPU::read_file(char *filename)
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k <= file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -985,8 +985,13 @@ void PairEAMAlloyKokkos<DeviceType>::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAMAlloy", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -1031,11 +1036,19 @@ void PairEAMAlloyKokkos<DeviceType>::read_file(char *filename)
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
if (unit_convert) {
for (int j = 1; j < file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k < file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -985,8 +985,13 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAMFS", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -1030,6 +1035,10 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
file->mass[i] = values.next_double();
reader.next_dvector(&file->frho[i][1], file->nrho);
if (unit_convert) {
for (int j = 1; j <= file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(&file->rhor[i][j][1], file->nr);
@ -1039,6 +1048,10 @@ void PairEAMFSKokkos<DeviceType>::read_file(char *filename)
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k < file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -43,6 +43,7 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0;
manybody_flag = 1;
embedstep = -1;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
nmax = 0;
rho = NULL;
@ -466,8 +467,13 @@ void PairEAM::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAM", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
@ -492,6 +498,14 @@ void PairEAM::read_file(char *filename)
reader.next_dvector(&file->frho[1], file->nrho);
reader.next_dvector(&file->zr[1], file->nr);
reader.next_dvector(&file->rhor[1], file->nr);
if (unit_convert) {
const double sqrt_conv = sqrt(conversion_factor);
for (int i = 1; i <= file->nrho; ++i)
file->frho[i] *= conversion_factor;
for (int j = 1; j <= file->nr; ++j)
file->zr[j] *= sqrt_conv;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -119,8 +119,13 @@ void PairEAMAlloy::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAMAlloy", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -165,11 +170,19 @@ void PairEAMAlloy::read_file(char *filename)
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
if (unit_convert) {
for (int j = 1; j < file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k < file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -29,6 +29,8 @@
#include "memory.h"
#include "error.h"
#include "tokenizer.h"
#include "utils.h"
#include "fmt/format.h"
using namespace LAMMPS_NS;
@ -40,6 +42,7 @@ PairEAMCD::PairEAMCD(LAMMPS *lmp, int _cdeamVersion)
{
single_enable = 0;
restartinfo = 0;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
rhoB = NULL;
D_values = NULL;
@ -500,12 +503,11 @@ void PairEAMCD::read_h_coeff(char *filename)
FILE *fptr;
char line[MAXLINE];
char nextline[MAXLINE];
fptr = force->open_potential(filename);
if (fptr == NULL) {
char str[128];
snprintf(str,128,"Cannot open EAM potential file %s", filename);
error->one(FLERR,str);
}
int convert_flag = unit_convert_flag;
fptr = force->open_potential(filename, &convert_flag);
if (fptr == NULL)
error->one(FLERR,fmt::format("Cannot open EAMCD potential file {}",
filename));
// h coefficients are stored at the end of the file.
// Skip to last line of file.

View File

@ -119,8 +119,15 @@ void PairEAMFS::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAMFS", unit_convert_flag);
// transparently convert units for supported conversions
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -164,6 +171,10 @@ void PairEAMFS::read_file(char *filename)
file->mass[i] = values.next_double();
reader.next_dvector(&file->frho[i][1], file->nrho);
if (unit_convert) {
for (int j = 1; j <= file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(&file->rhor[i][j][1], file->nr);
@ -173,6 +184,10 @@ void PairEAMFS::read_file(char *filename)
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k <= file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -44,6 +44,7 @@ PairSW::PairSW(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0;
one_coeff = 1;
manybody_flag = 1;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
nelements = 0;
elements = NULL;
@ -355,9 +356,16 @@ void PairSW::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "Stillinger-Weber");
PotentialFileReader reader(lmp, file, "Stillinger-Weber",
unit_convert_flag);
char * line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -407,6 +415,10 @@ void PairSW::read_file(char *file)
error->one(FLERR, e.what());
}
if (unit_convert) {
params[nparams].epsilon *= conversion_factor;
}
if (params[nparams].epsilon < 0.0 || params[nparams].sigma < 0.0 ||
params[nparams].littlea < 0.0 || params[nparams].lambda < 0.0 ||
params[nparams].gamma < 0.0 || params[nparams].biga < 0.0 ||

View File

@ -49,6 +49,7 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0;
one_coeff = 1;
manybody_flag = 1;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
nelements = 0;
elements = NULL;
@ -400,9 +401,14 @@ void PairTersoff::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "Tersoff");
char * line;
PotentialFileReader reader(lmp, file, "Tersoff", unit_convert_flag);
char *line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -426,7 +432,6 @@ void PairTersoff::read_file(char *file)
if (kname == elements[kelement]) break;
if (kelement == nelements) continue;
// load up parameter settings and error check their values
if (nparams == maxparam) {
@ -453,6 +458,11 @@ void PairTersoff::read_file(char *file)
params[nparams].lam1 = values.next_double();
params[nparams].biga = values.next_double();
params[nparams].powermint = int(params[nparams].powerm);
if (unit_convert) {
params[nparams].biga *= conversion_factor;
params[nparams].bigb *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -53,9 +53,14 @@ void PairTersoffMOD::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "Tersoff");
PotentialFileReader reader(lmp, file, "TersoffMod", unit_convert_flag);
char * line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -109,6 +114,11 @@ void PairTersoffMOD::read_file(char *file)
params[nparams].c4 = values.next_double();
params[nparams].c5 = values.next_double();
params[nparams].powermint = int(params[nparams].powerm);
if (unit_convert) {
params[nparams].biga *= conversion_factor;
params[nparams].bigb *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -44,9 +44,14 @@ void PairTersoffMODC::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "Tersoff");
PotentialFileReader reader(lmp, file, "TersoffModC", unit_convert_flag);
char * line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -101,6 +106,12 @@ void PairTersoffMODC::read_file(char *file)
params[nparams].c5 = values.next_double();
params[nparams].c0 = values.next_double();
params[nparams].powermint = int(params[nparams].powerm);
if (unit_convert) {
params[nparams].biga *= conversion_factor;
params[nparams].bigb *= conversion_factor;
params[nparams].c0 *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -71,9 +71,15 @@ void PairTersoffZBL::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "Tersoff");
PotentialFileReader reader(lmp, file, "TersoffZBL", unit_convert_flag);
char * line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -97,7 +103,6 @@ void PairTersoffZBL::read_file(char *file)
if (kname == elements[kelement]) break;
if (kelement == nelements) continue;
// load up parameter settings and error check their values
if (nparams == maxparam) {
@ -128,6 +133,11 @@ void PairTersoffZBL::read_file(char *file)
params[nparams].ZBLcut = values.next_double();
params[nparams].ZBLexpscale = values.next_double();
params[nparams].powermint = int(params[nparams].powerm);
if (unit_convert) {
params[nparams].biga *= conversion_factor;
params[nparams].bigb *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -45,6 +45,7 @@ PairVashishta::PairVashishta(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0;
one_coeff = 1;
manybody_flag = 1;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
nelements = 0;
elements = NULL;
@ -361,9 +362,15 @@ void PairVashishta::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(lmp, file, "Vashishta");
PotentialFileReader reader(lmp, file, "Vashishta", unit_convert_flag);
char * line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -412,6 +419,14 @@ void PairVashishta::read_file(char *file)
params[nparams].r0 = values.next_double();
params[nparams].bigc = values.next_double();
params[nparams].costheta = values.next_double();
if (unit_convert) {
params[nparams].bigh *= conversion_factor;
params[nparams].bigd *= conversion_factor;
params[nparams].bigw *= conversion_factor;
params[nparams].bigb *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -27,6 +27,7 @@
#include "force.h"
#include "neigh_list.h"
#include "memory.h"
#include "update.h"
using namespace LAMMPS_NS;
@ -176,8 +177,6 @@ void PairEAMOpt::eval()
// rho = density at each atom
// loop over neighbors of my atoms
// loop over neighbors of my atoms
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
double xtmp = xx[i].x;
@ -234,10 +233,11 @@ void PairEAMOpt::eval()
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
double p = rho[i]*rdrho;
int m = MIN((int)p,nrho-2);
p -= (double)m;
++m;
double p = rho[i]*rdrho + 1.0;
int m = static_cast<int> (p);
m = MAX(1,MIN(m,nrho-1));
p -= m;
p = MIN(p,1.0);
coeff = frho_spline[type2frho[type[i]]][m];
fp[i] = (coeff[0]*p + coeff[1])*p + coeff[2];
if (EFLAG) {
@ -252,6 +252,7 @@ void PairEAMOpt::eval()
// communicate derivative of embedding function
comm->forward_comm_pair(this);
embedstep = update->ntimestep;
// compute forces on each atom
// loop over neighbors of my atoms
@ -290,7 +291,9 @@ void PairEAMOpt::eval()
double p = r*tmp_rdr;
if ( (int)p <= nr2 ) {
int m = (int) p + 1;
m = MIN(m,nr-1);
p -= (double)((int) p);
p = MIN(p,1.0);
fast_gamma_t& a = tabssi[jtype*nr+m];
rhoip = (a.rhor6i*p + a.rhor5i)*p + a.rhor4i;

View File

@ -119,8 +119,13 @@ void PairEAMAlloyIntel::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAMAlloy", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -165,11 +170,19 @@ void PairEAMAlloyIntel::read_file(char *filename)
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
if (unit_convert) {
for (int j = 1; j < file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k < file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -119,8 +119,13 @@ void PairEAMFSIntel::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(lmp, filename, "EAM");
PotentialFileReader reader(lmp, filename, "EAMFS", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -164,6 +169,10 @@ void PairEAMFSIntel::read_file(char *filename)
file->mass[i] = values.next_double();
reader.next_dvector(&file->frho[i][1], file->nrho);
if (unit_convert) {
for (int j = 1; j <= file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(&file->rhor[i][j][1], file->nr);
@ -173,6 +182,10 @@ void PairEAMFSIntel::read_file(char *filename)
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k <= file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -33,6 +33,8 @@
#include "comm.h"
#include "memory.h"
#include "utils.h"
#include "tokenizer.h"
#include "potential_file_reader.h"
#include "error.h"
@ -59,6 +61,7 @@ PairTersoffTable::PairTersoffTable(LAMMPS *lmp) : Pair(lmp)
restartinfo = 0;
one_coeff = 1;
manybody_flag = 1;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
nelements = 0;
elements = nullptr;
@ -840,146 +843,115 @@ double PairTersoffTable::init_one(int i, int j)
void PairTersoffTable::read_file(char *file)
{
int params_per_line = 17;
char **words = new char*[params_per_line+1];
memory->sfree(params);
params = NULL;
params = nullptr;
nparams = maxparam = 0;
// open file on proc 0
FILE *fp;
if (comm->me == 0) {
fp = force->open_potential(file);
if (fp == NULL) {
char str[128];
snprintf(str,128,"Cannot open Tersoff potential file %s",file);
error->one(FLERR,str);
}
}
PotentialFileReader reader(lmp, file, "TersoffTable", unit_convert_flag);
char *line;
// transparently convert units for supported conversions
// read each set of params from potential file
// one set of params can span multiple lines
// store params if all 3 element tags are in element list
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
int n,nwords,ielement,jelement,kelement;
char line[MAXLINE],*ptr;
int eof = 0;
while((line = reader.next_line(NPARAMS_PER_LINE))) {
while (1) {
if (comm->me == 0) {
ptr = fgets(line,MAXLINE,fp);
if (ptr == NULL) {
eof = 1;
fclose(fp);
} else n = strlen(line) + 1;
}
MPI_Bcast(&eof,1,MPI_INT,0,world);
if (eof) break;
MPI_Bcast(&n,1,MPI_INT,0,world);
MPI_Bcast(line,n,MPI_CHAR,0,world);
try {
ValueTokenizer values(line);
// strip comment, skip line if blank
std::string iname = values.next_string();
std::string jname = values.next_string();
std::string kname = values.next_string();
if ((ptr = strchr(line,'#'))) *ptr = '\0';
nwords = utils::count_words(line);
if (nwords == 0) continue;
// ielement,jelement,kelement = 1st args
// if all 3 args are in element list, then parse this line
// else skip to next entry in file
// concatenate additional lines until have params_per_line words
int ielement, jelement, kelement;
while (nwords < params_per_line) {
n = strlen(line);
if (comm->me == 0) {
ptr = fgets(&line[n],MAXLINE-n,fp);
if (ptr == NULL) {
eof = 1;
fclose(fp);
} else n = strlen(line) + 1;
for (ielement = 0; ielement < nelements; ielement++)
if (iname == elements[ielement]) break;
if (ielement == nelements) continue;
for (jelement = 0; jelement < nelements; jelement++)
if (jname == elements[jelement]) break;
if (jelement == nelements) continue;
for (kelement = 0; kelement < nelements; kelement++)
if (kname == elements[kelement]) break;
if (kelement == nelements) continue;
// load up parameter settings and error check their values
if (nparams == maxparam) {
maxparam += DELTA;
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param),
"pair:params");
}
// some parameters are not used since only Tersoff_2 is implemented
params[nparams].ielement = ielement;
params[nparams].jelement = jelement;
params[nparams].kelement = kelement;
params[nparams].powerm = values.next_double(); // not used
params[nparams].gamma = values.next_double(); // not used
params[nparams].lam3 = values.next_double(); // not used
params[nparams].c = values.next_double();
params[nparams].d = values.next_double();
params[nparams].h = values.next_double();
params[nparams].powern = values.next_double();
params[nparams].beta = values.next_double();
params[nparams].lam2 = values.next_double();
params[nparams].bigb = values.next_double();
double bigr = values.next_double();
double bigd = values.next_double();
params[nparams].cutoffR = bigr - bigd;
params[nparams].cutoffS = bigr + bigd;
params[nparams].lam1 = values.next_double();
params[nparams].biga = values.next_double();
if (unit_convert) {
params[nparams].biga *= conversion_factor;
params[nparams].bigb *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}
MPI_Bcast(&eof,1,MPI_INT,0,world);
if (eof) break;
MPI_Bcast(&n,1,MPI_INT,0,world);
MPI_Bcast(line,n,MPI_CHAR,0,world);
if ((ptr = strchr(line,'#'))) *ptr = '\0';
nwords = utils::count_words(line);
if (params[nparams].c < 0.0 ||
params[nparams].d < 0.0 ||
params[nparams].powern < 0.0 ||
params[nparams].beta < 0.0 ||
params[nparams].lam2 < 0.0 ||
params[nparams].bigb < 0.0 ||
params[nparams].cutoffR < 0.0 ||
params[nparams].cutoffS < 0.0 ||
params[nparams].cutoffR > params[nparams].cutoffS ||
params[nparams].lam1 < 0.0 ||
params[nparams].biga < 0.0
) error->one(FLERR,"Illegal Tersoff parameter");
// only tersoff_2 parametrization is implemented
if (params[nparams].gamma != 1.0 || params[nparams].lam3 != 0.0)
error->one(FLERR,"Currently the tersoff/table pair_style only "
"implements the Tersoff_2 parametrization");
nparams++;
}
if (nwords != params_per_line)
error->all(FLERR,"Incorrect format in Tersoff potential file");
// words = ptrs to all words in line
nwords = 0;
words[nwords++] = strtok(line," \t\n\r\f");
while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue;
// ielement,jelement,kelement = 1st args
// if all 3 args are in element list, then parse this line
// else skip to next entry in file
for (ielement = 0; ielement < nelements; ielement++)
if (strcmp(words[0],elements[ielement]) == 0) break;
if (ielement == nelements) continue;
for (jelement = 0; jelement < nelements; jelement++)
if (strcmp(words[1],elements[jelement]) == 0) break;
if (jelement == nelements) continue;
for (kelement = 0; kelement < nelements; kelement++)
if (strcmp(words[2],elements[kelement]) == 0) break;
if (kelement == nelements) continue;
// load up parameter settings and error check their values
if (nparams == maxparam) {
maxparam += DELTA;
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param),
"pair:params");
}
params[nparams].ielement = ielement;
params[nparams].jelement = jelement;
params[nparams].kelement = kelement;
params[nparams].powerm = atof(words[3]); // not used (only tersoff_2 is implemented)
params[nparams].gamma = atof(words[4]); // not used (only tersoff_2 is implemented)
params[nparams].lam3 = atof(words[5]); // not used (only tersoff_2 is implemented)
params[nparams].c = atof(words[6]);
params[nparams].d = atof(words[7]);
params[nparams].h = atof(words[8]);
params[nparams].powern = atof(words[9]);
params[nparams].beta = atof(words[10]);
params[nparams].lam2 = atof(words[11]);
params[nparams].bigb = atof(words[12]);
// current implementation is based on functional form
// of tersoff_2 as reported in the reference paper
double bigr = atof(words[13]);
double bigd = atof(words[14]);
params[nparams].cutoffR = bigr - bigd;
params[nparams].cutoffS = bigr + bigd;
params[nparams].lam1 = atof(words[15]);
params[nparams].biga = atof(words[16]);
if (params[nparams].c < 0.0 ||
params[nparams].d < 0.0 ||
params[nparams].powern < 0.0 ||
params[nparams].beta < 0.0 ||
params[nparams].lam2 < 0.0 ||
params[nparams].bigb < 0.0 ||
params[nparams].cutoffR < 0.0 ||
params[nparams].cutoffS < 0.0 ||
params[nparams].cutoffR > params[nparams].cutoffS ||
params[nparams].lam1 < 0.0 ||
params[nparams].biga < 0.0
) error->all(FLERR,"Illegal Tersoff parameter");
// only tersoff_2 parametrization is implemented
if (params[nparams].gamma != 1.0 || params[nparams].lam3 != 0.0)
error->all(FLERR,"Current tersoff/table pair_style implements only tersoff_2 parametrization");
nparams++;
}
delete [] words;
MPI_Bcast(&nparams, 1, MPI_INT, 0, world);
MPI_Bcast(&maxparam, 1, MPI_INT, 0, world);
if(comm->me != 0) {
params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params");
}
MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world);
}
/* ---------------------------------------------------------------------- */

View File

@ -40,8 +40,10 @@ class PairTersoffTable : public Pair {
virtual void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
double init_one(int, int);
void init_style();
double init_one(int, int);
static const int NPARAMS_PER_LINE = 17;
protected:
struct Param {

View File

@ -119,8 +119,14 @@ void PairEAMAlloyOMP::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(PairEAM::lmp, filename, "EAM");
PotentialFileReader reader(PairEAM::lmp, filename,
"EAMAlloy", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -165,11 +171,19 @@ void PairEAMAlloyOMP::read_file(char *filename)
reader.next_dvector(&file->frho[i][1], file->nrho);
reader.next_dvector(&file->rhor[i][1], file->nr);
if (unit_convert) {
for (int j = 1; j < file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
}
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k < file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -119,8 +119,14 @@ void PairEAMFSOMP::read_file(char *filename)
// read potential file
if(comm->me == 0) {
PotentialFileReader reader(PairEAM::lmp, filename, "EAM");
PotentialFileReader reader(PairEAM::lmp, filename,
"EAMFS", unit_convert_flag);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
try {
reader.skip_line();
reader.skip_line();
@ -164,6 +170,10 @@ void PairEAMFSOMP::read_file(char *filename)
file->mass[i] = values.next_double();
reader.next_dvector(&file->frho[i][1], file->nrho);
if (unit_convert) {
for (int j = 1; j <= file->nrho; ++j)
file->frho[i][j] *= conversion_factor;
}
for (int j = 0; j < file->nelements; j++) {
reader.next_dvector(&file->rhor[i][j][1], file->nr);
@ -173,6 +183,10 @@ void PairEAMFSOMP::read_file(char *filename)
for (int i = 0; i < file->nelements; i++) {
for (int j = 0; j <= i; j++) {
reader.next_dvector(&file->z2r[i][j][1], file->nr);
if (unit_convert) {
for (int k = 1; k <= file->nr; ++k)
file->z2r[i][j][k] *= conversion_factor;
}
}
}
} catch (TokenizerException & e) {

View File

@ -92,9 +92,16 @@ void PairTersoffZBLOMP::read_file(char *file)
// open file on proc 0
if (comm->me == 0) {
PotentialFileReader reader(PairTersoff::lmp, file, "Tersoff");
PotentialFileReader reader(PairTersoff::lmp, file, "TersoffZBLOMP",
unit_convert_flag);
char * line;
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
while((line = reader.next_line(NPARAMS_PER_LINE))) {
try {
ValueTokenizer values(line);
@ -118,7 +125,6 @@ void PairTersoffZBLOMP::read_file(char *file)
if (kname == elements[kelement]) break;
if (kelement == nelements) continue;
// load up parameter settings and error check their values
if (nparams == maxparam) {
@ -149,6 +155,11 @@ void PairTersoffZBLOMP::read_file(char *file)
params[nparams].ZBLcut = values.next_double();
params[nparams].ZBLexpscale = values.next_double();
params[nparams].powermint = int(params[nparams].powerm);
if (unit_convert) {
params[nparams].biga *= conversion_factor;
params[nparams].bigb *= conversion_factor;
}
} catch (TokenizerException & e) {
error->one(FLERR, e.what());
}

View File

@ -1011,7 +1011,7 @@ tagint Force::tnumeric(const char *file, int line, char *str)
if fails, search in dir specified by env variable LAMMPS_POTENTIALS
------------------------------------------------------------------------- */
FILE *Force::open_potential(const char *name)
FILE *Force::open_potential(const char *name, int *auto_convert)
{
std::string filepath = utils::get_potential_file_path(name);
@ -1024,9 +1024,35 @@ FILE *Force::open_potential(const char *name)
utils::logmesg(lmp, fmt::format("Reading potential file {} "
"with DATE: {}\n", name, date));
}
if (!units.empty() && (units != unit_style)) {
error->one(FLERR, fmt::format("Potential file {} requires {} units "
"but {} units are in use", name, units, unit_style));
if (auto_convert == nullptr) {
if (units != unit_style) {
error->one(FLERR, fmt::format("Potential file {} requires {} units "
"but {} units are in use", name, units,
unit_style));
return nullptr;
}
} else {
if (units == unit_style) {
*auto_convert = utils::NOCONVERT;
} else {
if ((units == "metal") && (unit_style == "real")
&& (*auto_convert & utils::METAL2REAL)) {
*auto_convert = utils::METAL2REAL;
} else if ((units == "real") && (unit_style == "metal")
&& (*auto_convert & utils::REAL2METAL)) {
*auto_convert = utils::REAL2METAL;
} else {
error->one(FLERR, fmt::format("Potential file {} requires {} units "
"but {} units are in use", name,
units, unit_style));
return nullptr;
}
}
if (*auto_convert != utils::NOCONVERT)
lmp->error->warning(FLERR, fmt::format("Converting potential file in "
"{} units to {} units",
units, unit_style));
}
return fopen(filepath.c_str(), "r");
}

View File

@ -135,7 +135,7 @@ class Force : protected Pointers {
bigint bnumeric(const char *, int, char *);
tagint tnumeric(const char *, int, char *);
FILE *open_potential(const char *);
FILE *open_potential(const char *, int *auto_convert = nullptr);
bigint memory_usage();

View File

@ -66,6 +66,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
no_virial_fdotr_compute = 0;
writedata = 0;
ghostneigh = 0;
unit_convert_flag = utils::NOCONVERT;
nextra = 0;
pvector = NULL;

View File

@ -53,6 +53,7 @@ class Pair : protected Pointers {
int respa_enable; // 1 if inner/middle/outer rRESPA routines
int one_coeff; // 1 if allows only one coeff * * call
int manybody_flag; // 1 if a manybody potential
int unit_convert_flag; // value != 0 indicates support for unit conversion.
int no_virial_fdotr_compute; // 1 if does not invoke virial_fdotr_compute()
int writedata; // 1 if writes coeffs to data file
int ghostneigh; // 1 if pair style needs neighbors of ghosts

View File

@ -44,6 +44,7 @@ PairTable::PairTable(LAMMPS *lmp) : Pair(lmp)
{
ntables = 0;
tables = NULL;
unit_convert_flag = utils::get_supported_conversions(utils::ENERGY);
}
/* ---------------------------------------------------------------------- */
@ -358,9 +359,14 @@ double PairTable::init_one(int i, int j)
void PairTable::read_table(Table *tb, char *file, char *keyword)
{
TableFileReader reader(lmp, file, "pair");
TableFileReader reader(lmp, file, "pair", unit_convert_flag);
char * line = reader.find_section_start(keyword);
// transparently convert units for supported conversions
int unit_convert = reader.get_unit_convert();
double conversion_factor = utils::get_conversion_factor(utils::ENERGY,
unit_convert);
char *line = reader.find_section_start(keyword);
if (!line) {
error->one(FLERR,"Did not find keyword in table file");
@ -370,7 +376,7 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
// allocate table arrays for file values
line = reader.next_line();
param_extract(tb,line);
param_extract(tb, line);
memory->create(tb->rfile,tb->ninput,"pair:rfile");
memory->create(tb->efile,tb->ninput,"pair:efile");
memory->create(tb->ffile,tb->ninput,"pair:ffile");
@ -404,8 +410,8 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
ValueTokenizer values(line);
values.next_int();
rfile = values.next_double();
tb->efile[i] = values.next_double();
tb->ffile[i] = values.next_double();
tb->efile[i] = conversion_factor * values.next_double();
tb->ffile[i] = conversion_factor * values.next_double();
} catch (TokenizerException & e) {
++cerror;
}
@ -461,29 +467,26 @@ void PairTable::read_table(Table *tb, char *file, char *keyword)
}
}
if (ferror) {
std::string str = fmt::format("{} of {} force values in table are inconsistent with -dE/dr.\n"
" Should only be flagged at inflection points",ferror,tb->ninput);
error->warning(FLERR,str.c_str());
}
if (ferror)
error->warning(FLERR,fmt::format("{} of {} force values in table are "
"inconsistent with -dE/dr.\n Should "
"only be flagged at inflection points",
ferror,tb->ninput));
// warn if re-computed distance values differ from file values
if (rerror) {
char str[128];
sprintf(str,"%d of %d distance values in table with relative error\n"
" over %g to re-computed values",rerror,tb->ninput,EPSILONR);
error->warning(FLERR,str);
}
if (rerror)
error->warning(FLERR,fmt::format("{} of {} distance values in table with "
"relative error\n over {} to "
"re-computed values",
rerror,tb->ninput,EPSILONR));
// warn if data was read incompletely, e.g. columns were missing
if (cerror) {
char str[128];
sprintf(str,"%d of %d lines in table were incomplete\n"
" or could not be parsed completely",cerror,tb->ninput);
error->warning(FLERR,str);
}
if (cerror)
error->warning(FLERR,fmt::format("{} of {} lines in table were "
"incomplete\n or could not be parsed "
"completely",cerror,tb->ninput));
}
/* ----------------------------------------------------------------------

View File

@ -31,11 +31,13 @@ using namespace LAMMPS_NS;
PotentialFileReader::PotentialFileReader(LAMMPS *lmp,
const std::string &filename,
const std::string &potential_name) :
const std::string &potential_name,
const int auto_convert) :
Pointers(lmp),
reader(nullptr),
filename(filename),
filetype(potential_name + " potential")
filetype(potential_name + " potential"),
unit_convert(auto_convert)
{
if (comm->me != 0) {
error->one(FLERR, "FileReader should only be called by proc 0!");
@ -143,7 +145,7 @@ std::string PotentialFileReader::next_string() {
return "";
}
TextFileReader * PotentialFileReader::open_potential(const std::string& path) {
TextFileReader *PotentialFileReader::open_potential(const std::string &path) {
std::string filepath = utils::get_potential_file_path(path);
if (!filepath.empty()) {
@ -151,15 +153,30 @@ TextFileReader * PotentialFileReader::open_potential(const std::string& path) {
std::string date = utils::get_potential_date(filepath, filetype);
std::string units = utils::get_potential_units(filepath, filetype);
if (!date.empty()) {
utils::logmesg(lmp, fmt::format("Reading potential file {} with DATE: {}\n", filename, date));
}
if (!date.empty())
utils::logmesg(lmp, fmt::format("Reading {} file {} with DATE: {}\n",
filetype, filename, date));
if (!units.empty() && (units != unit_style)) {
lmp->error->one(FLERR, fmt::format("Potential file {} requires {} units "
"but {} units are in use",filename, units, unit_style));
if (units.empty()) {
unit_convert = utils::NOCONVERT;
} else {
if (units == unit_style) {
unit_convert = utils::NOCONVERT;
} else {
if ((units == "metal") && (unit_style == "real") && (unit_convert & utils::METAL2REAL)) {
unit_convert = utils::METAL2REAL;
} else if ((units == "real") && (unit_style == "metal") && (unit_convert & utils::REAL2METAL)) {
unit_convert = utils::REAL2METAL;
} else {
lmp->error->one(FLERR, fmt::format("{} file {} requires {} units "
"but {} units are in use", filetype,
filename, units, unit_style));
}
}
}
if (unit_convert != utils::NOCONVERT)
lmp->error->warning(FLERR, fmt::format("Converting {} in {} units to {} "
"units", filetype, units, unit_style));
return new TextFileReader(filepath, filetype);
}
return nullptr;

View File

@ -28,22 +28,25 @@ namespace LAMMPS_NS
{
class PotentialFileReader : protected Pointers {
protected:
TextFileReader * reader;
TextFileReader *reader;
std::string filename;
std::string filetype;
int unit_convert;
TextFileReader * open_potential(const std::string& path);
TextFileReader *open_potential(const std::string& path);
public:
PotentialFileReader(class LAMMPS *lmp, const std::string &filename, const std::string &potential_name);
PotentialFileReader(class LAMMPS *lmp, const std::string &filename,
const std::string &potential_name,
const int auto_convert = 0);
virtual ~PotentialFileReader();
void ignore_comments(bool value);
void skip_line();
char * next_line(int nparams = 0);
void next_dvector(double * list, int n);
ValueTokenizer next_values(int nparams, const std::string & separators = TOKENIZER_DEFAULT_SEPARATORS);
char *next_line(int nparams = 0);
void next_dvector(double *list, int n);
ValueTokenizer next_values(int nparams, const std::string &separators = TOKENIZER_DEFAULT_SEPARATORS);
// convenience functions
double next_double();
@ -51,6 +54,9 @@ namespace LAMMPS_NS
tagint next_tagint();
bigint next_bigint();
std::string next_string();
// unit conversion info
int get_unit_convert() const { return unit_convert; }
};
} // namespace LAMMPS_NS

View File

@ -27,17 +27,18 @@
using namespace LAMMPS_NS;
TableFileReader::TableFileReader(LAMMPS *lmp,
const std::string &filename,
const std::string &type) :
PotentialFileReader(lmp, filename, type + " table")
const std::string &filename,
const std::string &type,
const int auto_convert) :
PotentialFileReader(lmp, filename, type + " table", auto_convert)
{
}
TableFileReader::~TableFileReader() {
}
char * TableFileReader::find_section_start(const std::string & keyword) {
char * line = nullptr;
char *TableFileReader::find_section_start(const std::string & keyword) {
char *line = nullptr;
while ((line = reader->next_line())) {
ValueTokenizer values(line);
std::string word = values.next_string();

View File

@ -24,10 +24,11 @@ namespace LAMMPS_NS
{
class TableFileReader : public PotentialFileReader {
public:
TableFileReader(class LAMMPS *lmp, const std::string &filename, const std::string & type);
TableFileReader(class LAMMPS *lmp, const std::string &filename,
const std::string &type, const int auto_convert = 0);
virtual ~TableFileReader();
char * find_section_start(const std::string & keyword);
char *find_section_start(const std::string &keyword);
};
} // namespace LAMMPS_NS

View File

@ -315,6 +315,7 @@ void Thermo::header()
std::string hdr;
for (int i = 0; i < nfield; i++) hdr += keyword[i] + std::string(" ");
hdr += "\n";
if (me == 0) utils::logmesg(lmp,hdr);
}
@ -1061,7 +1062,7 @@ int Thermo::add_variable(const char *id)
customize a new keyword by adding to if statement
------------------------------------------------------------------------- */
int Thermo::evaluate_keyword(char *word, double *answer)
int Thermo::evaluate_keyword(const char *word, double *answer)
{
// turn off normflag if natoms = 0 to avoid divide by 0
// normflag must be set for lo-level thermo routines that may be invoked

View File

@ -39,7 +39,7 @@ class Thermo : protected Pointers {
void modify_params(int, char **);
void header();
void compute(int);
int evaluate_keyword(char *, double *);
int evaluate_keyword(const char *, double *);
private:
char *line;

View File

@ -663,6 +663,36 @@ std::string utils::get_potential_units(const std::string & path, const std::stri
return "";
}
/* ----------------------------------------------------------------------
return bitmask of supported conversions for a given property
------------------------------------------------------------------------- */
int utils::get_supported_conversions(const int property)
{
if (property == ENERGY) {
return METAL2REAL | REAL2METAL;
}
return NOCONVERT;
}
/* ----------------------------------------------------------------------
return conversion factor for a given property and conversion setting
return 0.0 if unknown.
------------------------------------------------------------------------- */
double utils::get_conversion_factor(const int property, const int conversion)
{
if (property == ENERGY) {
if (conversion == NOCONVERT) {
return 1.0;
} else if (conversion == METAL2REAL) {
return 23.060549;
} else if (conversion == REAL2METAL) {
return 1.0/23.060549;
}
}
return 0.0;
}
/* ------------------------------------------------------------------ */
extern "C" {

View File

@ -255,6 +255,24 @@ namespace LAMMPS_NS {
* \return UNITS field if present
*/
std::string get_potential_units(const std::string & path, const std::string & potential_name);
enum { NOCONVERT = 0, METAL2REAL = 1, REAL2METAL = 1<<1 };
enum { UNKNOWN = 0, ENERGY };
/**
* \brief Return bitmask of available conversion factors for a given propert
* \param property property to be converted
* \return bitmask indicating available conversions
*/
int get_supported_conversions(const int property);
/**
* \brief Return unit conversion factor for given property and selected from/to units
* \param property property to be converted
* \param conversion constant indicating the conversion
* \return conversion factor
*/
double get_conversion_factor(const int property, const int conversion);
}
}

View File

@ -909,7 +909,7 @@ TEST(PairStyle, opt)
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
if (!verbose) ::testing::internal::CaptureStdout();
::testing::internal::CaptureStdout();
LAMMPS *lmp = init_lammps(argc, argv, test_config);
std::string output = ::testing::internal::GetCapturedStdout();

View File

@ -1,7 +1,7 @@
---
lammps_version: 5 May 2020
date_generated: Fri May 15 23:19:20 202
epsilon: 5.0e-12
lammps_version: 15 Jun 2020
date_generated: Thu Jun 25 12:25:55 202
epsilon: 5e-12
prerequisites: ! |
pair eam
pre_commands: ! |
@ -10,81 +10,82 @@ post_commands: ! ""
input_file: in.metal
pair_style: eam
pair_coeff: ! |
1 1 Ni_u3.eam
1 1 Al_jnp.eam
2 2 Cu_u3.eam
extract: ! ""
natoms: 32
init_vdwl: -119.530487743563
init_vdwl: -368.582927487109
init_coul: 0
init_stress: ! |2-
4.8826272345202817e+01 4.5850488601145123e+01 4.1343857791628459e+01 4.4988644962998467e+00 -4.9951074981736998e-01 -2.1768789288131187e+00
init_stress: ! |-
-3.9250135569982547e+02 -4.6446788990491922e+02 -4.1339651642483534e+02 1.9400736722937047e+01 1.1111963280257109e+00 1.2102392154667630e+01
init_forces: ! |2
29 8.0800296830781970e-01 2.3879075266467829e+00 -8.3048670580586403e-02
4 2.7343534029869865e-01 -2.9878342106756367e-01 -1.2265223367116376e+00
8 -1.4720323385487724e+00 -1.4228179264986509e+00 9.6490960676696425e-01
13 -6.5176153773352563e-01 8.5767931224231297e-01 -1.0911744305807993e+00
15 -7.3903169091302345e-01 7.5680244318270884e-01 -7.2708235694598555e-01
3 -8.8972662160783789e-01 3.8990091972163423e+00 -1.0661156728781842e+00
10 -7.8846939852443865e-01 -3.8705457047816734e+00 -2.4629929283458956e+00
11 -9.8435494678902746e-01 -7.0900821618683274e-01 8.7706624584090875e-01
16 2.4583295121993398e+00 -2.1972676866087717e+00 8.3284121924556553e-01
21 4.0030874815543029e+00 1.0711165397007254e+00 2.4473954375123813e-01
26 -1.3811106600228646e+00 -3.5588639228797661e+00 2.8632910127148117e+00
7 -1.6363024522676575e+00 2.1007504896592857e+00 -3.9914508545625160e-01
9 5.7947847523538809e-01 -1.0536323905325453e+00 -6.4053794186990365e-01
12 1.1287163019780053e+00 -2.0776211837684415e+00 -2.0233323652665197e-01
2 -4.1490810252266974e-01 -1.6223974813453232e+00 9.8899266934997998e-01
18 -2.9490223023424624e+00 -6.7264893552133265e-01 -1.3875167298795910e+00
19 -3.1847050581559415e+00 -1.8169235559519932e+00 8.0598800871995424e-01
24 2.6007360409657871e+00 1.8259122746264185e+00 1.8348671705526824e+00
6 9.3578152728737196e-01 4.2423394202927650e-01 -1.1063087875863249e-01
20 4.8971016839265114e-01 3.9218805807784085e-01 -7.3184770760670148e-01
22 1.8086294180444197e-02 -2.0048898956069334e+00 -2.5326361122481866e-01
25 1.5827181697200143e+00 3.6148366642417934e-01 -1.0499794196925945e+00
5 1.7730142843252130e+00 3.4084808701534719e+00 7.4953511407886242e-01
27 1.1415770912387406e+00 3.1938755741801723e-02 1.8323119673595856e-01
28 1.1504782845312334e-01 1.3053527012833483e+00 1.6722391212961463e+00
1 -6.4076239230307086e-03 1.4271865784071405e+00 5.0439174022242561e-01
14 1.2901780857744278e+00 -2.0966095595276873e-01 1.5801785995295483e+00
17 9.9925856969280202e-01 2.8118162051561075e+00 -1.7641749946493385e-01
23 1.0999852359764739e+00 2.9307377042640232e+00 -1.8605350165432875e+00
30 -9.9030220835307969e-01 -5.9609338894221275e-01 -1.8459334541555570e+00
31 -3.9990682938968608e-01 -2.4015626569287210e+00 1.6801191688208930e+00
32 -4.8091016044865871e+00 -1.4798789422382359e+00 -4.6731344040392714e-01
run_vdwl: -119.870792403123
1 3.8702196239123237e+00 3.2087381358567679e+00 -3.2785146725168746e+00
2 1.5399659055502801e+00 5.3765327929110125e+00 1.5740005508928423e+00
3 9.6731722224674677e-01 -1.3144867798433710e+01 -9.0231732944261689e-01
4 -2.5073370343027146e+00 -5.2079180074533618e+00 -5.8913203171674402e+00
5 -2.8515169765266575e+00 7.6648779774003719e+00 -1.6135262802376316e+00
6 2.0428463056677254e-01 5.1885731021366555e+00 -5.9322347514392992e-01
7 -9.7176119399525651e-01 3.5285494740740462e+00 3.2284411698905560e+00
8 7.5364432092290201e-01 -5.2936287201396057e+00 -6.2408220629962896e+00
9 -5.8493861425957814e+00 -3.7463543270548563e+00 -3.9409131835960420e+00
10 -1.8023712766215385e+00 3.7006913245199451e+00 -3.8897352514951287e+00
11 3.5323555367973203e-01 -1.1327469434419406e+01 6.7182457803171030e+00
12 -4.4655507115633153e+00 -4.1270694194866087e+00 4.6918435871989708e+00
13 4.4725135751254337e+00 -3.8312677334791485e+00 -2.6917694312049267e-01
14 -2.7336352778320090e+00 7.7812926164057377e+00 2.4973630791939097e+00
15 1.8398608400295208e-01 5.9059792700196434e+00 -9.9161720399808750e+00
16 5.8469261701364097e+00 -2.2571985010582432e+00 2.9857327422767823e+00
17 2.7560211432940238e+00 4.9207971970570350e+00 2.9070576476805532e+00
18 -1.4813870095597501e+00 -1.7378482556644488e+00 -1.6058192501275290e+00
19 1.4804205290003427e+00 -1.2245161773643600e+01 4.9726493930925530e-01
20 -3.6615637886242993e+00 -4.8732204205525411e+00 5.2596344008240576e+00
21 -1.3508123203296574e+00 1.0609703405450992e+01 2.7016894640855278e+00
22 -3.5308456248307213e-01 -1.2267881896396968e+01 3.8041687814180614e-01
23 2.1268575998905277e+00 -9.8195553504983524e-01 -5.0711605404266065e+00
24 6.0440647757301482e+00 -3.8588578230300516e+00 7.2719736140423983e+00
25 8.4455109296650068e+00 7.0624962219255796e+00 -3.1806612774968732e+00
26 -3.0905548748191465e+00 -7.7229205387362132e-01 5.3313905785014661e+00
27 -2.9657410879726704e+00 -8.6651631017774271e+00 -6.7853125584804292e+00
28 4.9373045778342588e+00 6.6292206752376668e+00 4.6463544925063864e+00
29 -6.7596568116029587e+00 1.1854971416292608e+01 -3.1889511538178256e-01
30 -3.1599376372205530e+00 1.2411259590817497e+01 -3.3705452712364457e+00
31 -4.7553805255326909e+00 2.0807423151380857e+00 9.7968713347921295e+00
32 4.7774045900242150e+00 -3.5862707137302143e+00 -3.6201646908067486e+00
run_vdwl: -373.391968845895
run_coul: 0
run_stress: ! |2-
4.7751995066352151e+01 4.4830156042194794e+01 4.0389886435910626e+01 4.2184912902327492e+00 -5.6543256799494823e-01 -2.0752485517795161e+00
run_stress: ! |-
-3.9486584521928387e+02 -4.6496789731502832e+02 -4.1710147439166667e+02 1.8213412417226081e+01 7.6724894655338038e-01 1.2094096020348012e+01
run_forces: ! |2
29 7.5690592801898815e-01 2.3151863977187501e+00 -5.6022314357905889e-02
4 2.6331390998279414e-01 -2.7131757020660047e-01 -1.2171723766818878e+00
8 -1.4819123498210278e+00 -1.3892127647468901e+00 9.4351114037722761e-01
13 -6.7030752430639429e-01 8.1027363373017303e-01 -1.0419798308062822e+00
15 -7.2914425790656268e-01 7.3381515730032987e-01 -7.0649536261355972e-01
3 -8.2862609949331145e-01 3.6488186893647363e+00 -1.0624581553334507e+00
10 -6.1483994156789068e-01 -3.7021751622708732e+00 -2.3234131680128005e+00
11 -9.5907408526990645e-01 -7.3338326161574841e-01 8.4459514391866075e-01
16 2.2537479937597746e+00 -2.1115143339299585e+00 7.8862148815663591e-01
21 3.8499378367182593e+00 9.5004430642537196e-01 2.6813205101176563e-01
26 -1.2549911173346853e+00 -3.3303513611819771e+00 2.7419485545991917e+00
7 -1.5803819585422452e+00 2.0775725635516813e+00 -4.1643485965418925e-01
9 5.9616913379864100e-01 -1.0900041633317910e+00 -6.6263113823586650e-01
12 1.1188274327648378e+00 -1.9856343707557884e+00 -1.8931698797528046e-01
2 -4.1672554481721213e-01 -1.6030271664710254e+00 9.7652355703236493e-01
18 -2.8528759296970057e+00 -6.4627753964043022e-01 -1.3476345322887988e+00
19 -3.0612708341260451e+00 -1.7499039144402915e+00 7.5685549599560620e-01
24 2.4838924866176000e+00 1.7760409543710471e+00 1.7927340588029941e+00
6 9.3519811444520051e-01 4.3790210252755352e-01 -1.1115261874946925e-01
20 4.7860017665455917e-01 4.0873358602741239e-01 -7.2787329983734494e-01
22 4.5683760799552345e-02 -1.9499040012633670e+00 -2.4911444772283134e-01
25 1.5498059277046197e+00 3.7493980878195188e-01 -1.0267705215988105e+00
5 1.6772659871839077e+00 3.2412248124601644e+00 7.8861775101712162e-01
27 1.1181252050394743e+00 2.1210906682851027e-02 1.5259049481566841e-01
28 8.6158085875367885e-02 1.2958084369079632e+00 1.6341119769792032e+00
1 -6.8020837225162042e-02 1.3929213106632692e+00 4.9572035003963544e-01
14 1.2851416793310484e+00 -1.0078910089733506e-01 1.4693455274495928e+00
17 9.8653851440129303e-01 2.7301368714775602e+00 -1.8133160965911002e-01
23 1.0757192308685777e+00 2.8092242654474213e+00 -1.7775969588994822e+00
30 -9.5705266545383005e-01 -5.7810207051480700e-01 -1.7663162149693394e+00
31 -4.2417243253557779e-01 -2.3534705046561171e+00 1.6411799159456588e+00
32 -4.6616358258676422e+00 -1.4287865175152361e+00 -4.3077310874491803e-01
1 3.6065103849698468e+00 3.3850045614133313e+00 -3.2099404138931509e+00
2 1.5272319527263032e+00 5.1159618338839312e+00 1.4386822600144664e+00
3 8.8889124738965819e-01 -1.2549265126891074e+01 -7.6286300397645501e-01
4 -2.5149887025851170e+00 -5.1630477798481431e+00 -5.7927560583461730e+00
5 -2.7577319227243340e+00 7.7337372091606680e+00 -1.6161053768722711e+00
6 2.9829137219780122e-01 4.9518159754562241e+00 -6.3319133869634869e-01
7 -8.7309179105028933e-01 3.7242971801706921e+00 3.1667500872407377e+00
8 7.4988511941705449e-01 -5.2345536588071093e+00 -6.0694489025295839e+00
9 -5.6748652076461674e+00 -3.6155005353015062e+00 -3.8960205269343655e+00
10 -1.6985487726687425e+00 3.3586465595352220e+00 -3.9313302972889002e+00
11 3.0645290480830667e-01 -1.1180223984570517e+01 6.5832137421124841e+00
12 -4.4891921700259347e+00 -4.1479969157235592e+00 4.6314455848790201e+00
13 4.3217028924633345e+00 -3.6856204342214225e+00 -3.0397864454481671e-01
14 -2.5849914165064707e+00 7.5606403552491512e+00 2.3174690493053731e+00
15 1.1796272962339260e-01 5.7288100295841362e+00 -9.7607016326972875e+00
16 5.7880766878601184e+00 -2.4198072924490344e+00 3.0510124864170507e+00
17 2.6948634470285198e+00 4.9491285704784493e+00 2.8470505948516216e+00
18 -1.3885896269097586e+00 -1.7319937370042313e+00 -1.4698594584039826e+00
19 1.3993184597149559e+00 -1.1797240539240345e+01 4.4955145029402199e-01
20 -3.6118153030811628e+00 -4.8252169436385737e+00 5.1301467326003083e+00
21 -1.3245618504864409e+00 1.0413638773882035e+01 2.6136063969881485e+00
22 -3.6531531607881618e-01 -1.2221686471408907e+01 3.4297492050272915e-01
23 2.1591154306811964e+00 -8.2020156536698485e-01 -4.8505116467228593e+00
24 5.8317944566991562e+00 -3.8285931693697965e+00 7.1438153964941415e+00
25 8.3117675961796262e+00 7.0110643410721547e+00 -3.1321086296777607e+00
26 -2.9593072762047514e+00 -7.3717349777411822e-01 5.3317823136164311e+00
27 -2.8851089719214054e+00 -8.5425149524249182e+00 -6.6688154620289835e+00
28 4.7313345552457529e+00 6.4894520960745865e+00 4.4358188230989617e+00
29 -6.6981970679986764e+00 1.1511660045027716e+01 -2.4612864290481729e-01
30 -2.9580050013088863e+00 1.2189750141569847e+01 -3.2455167441500565e+00
31 -4.5434783129378946e+00 1.9394948274115587e+00 9.6218495408600599e+00
32 4.5945894731298162e+00 -3.5624658959294715e+00 -3.5158925996077341e+00
...

View File

@ -0,0 +1,90 @@
---
lammps_version: 15 Jun 2020
date_generated: Thu Jun 25 11:40:47 202
epsilon: 7.5e-12
prerequisites: ! |
pair eam/alloy
pre_commands: ! |
variable units index real
post_commands: ! ""
input_file: in.metal
pair_style: eam/alloy
pair_coeff: ! |
* * CuNi.eam.alloy Cu Ni
extract: ! ""
natoms: 32
init_vdwl: -2737.69103243003
init_coul: 0
init_stress: ! |2-
1.1764167914492630e+03 1.1205980824873152e+03 1.0864455580994877e+03 8.1647231129875934e+01 -2.5037139879631205e+01 -6.3600641311729632e+01
init_forces: ! |2
1 5.2672451511791571e+00 2.9722735284353401e+01 1.1075184641021506e+01
2 -1.0636773406463684e+01 -4.4073764067943728e+01 2.0771028937481248e+01
3 -2.2965537069495454e+01 9.7562921273648755e+01 -2.4642335703402438e+01
4 7.4656490760559127e+00 -5.4658324632906563e-01 -2.4960279603333927e+01
5 3.1230848773422942e+01 6.4617845424874886e+01 2.1933694652888928e+01
6 2.1832213719963605e+01 1.1143486075604935e+01 -3.4239959293183455e+00
7 -2.9357107589496898e+01 4.2158182777227005e+01 -8.5586094830391737e+00
8 -3.6073223340439661e+01 -2.4215275768396296e+01 2.9725386697629890e+01
9 1.4987399784928266e+01 -2.7061834122202470e+01 -1.3299771204450476e+01
10 -1.2413956598774377e+01 -7.6775514871436584e+01 -5.4742781546994578e+01
11 -2.1067380701478477e+01 -1.6615953683959319e+01 1.8476258567375464e+01
12 1.9461184824514678e+01 -3.8109085731939743e+01 -5.3661246617685698e+00
13 -1.4482196622742837e+01 1.5568716854391997e+01 -2.4158915065964425e+01
14 3.2825757431900875e+01 -1.1627824476982159e+01 3.5262711606238248e+01
15 -1.8746762621101752e+01 8.1538251436098452e+00 -1.0644311994127357e+01
16 4.8624977409645190e+01 -4.4113270120576303e+01 1.8303261804100114e+01
17 2.2698244093478909e+01 6.6392356130851752e+01 -7.1977884622409611e+00
18 -6.7980771356824789e+01 -1.4937345732539860e+01 -3.2011413553574002e+01
19 -7.8000063810705043e+01 -3.3213815725148109e+01 2.0380659433340828e+01
20 1.3799086550197625e+01 1.3483094603013749e+01 -2.1521630948739766e+01
21 8.5316643556023976e+01 1.4311382265670481e+01 1.3218228731927237e+00
22 3.1576126714640402e+00 -3.4015985036776200e+01 -8.2959114388958923e+00
23 1.9744512575830672e+01 6.1755929602595728e+01 -3.8176255063513352e+01
24 5.2798113388347907e+01 4.7195292661174186e+01 3.7832549147780398e+01
25 2.7490207016385277e+01 1.5425133021820687e+00 -2.2503456988828329e+01
26 -2.1990208289852045e+01 -7.4941647823295114e+01 6.1475112414163846e+01
27 2.5616643621116541e+01 -2.0334701161446000e+00 2.8572235129465353e+00
28 -4.7832347888405167e+00 2.6723575502863220e+01 3.5294244672040442e+01
29 2.6981880708270644e+01 4.4677369269953125e+01 -9.1942728940884999e-01
30 -1.7901630000432533e+01 -2.7359294215609250e+01 -3.9336329099287354e+01
31 -1.2722584214735921e+00 -5.4089290760926374e+01 3.1561919199814422e+01
32 -1.0162711573460452e+02 -2.1279270671809893e+01 -6.5117201231268016e+00
run_vdwl: 13786.8231164129
run_coul: 0
run_stress: ! |2-
1.5453045758769309e+04 1.4324564159674526e+04 2.0339719265203345e+04 -4.3703985097767185e+02 -2.4828700331963573e+03 2.6371860977250676e+03
run_forces: ! |2
1 -4.1235070358044659e+03 -1.6712537087260623e+02 1.0285277274671844e+02
2 -1.7134569288200260e+03 5.6109874495911663e+02 1.5833880163322256e+03
3 7.0660491674313107e+02 1.9980947258587582e+02 3.5478310177110990e+02
4 -1.5805950092619389e+02 -6.3394860464940950e+02 -8.2522020103607213e+02
5 3.9405888405680394e+03 -3.4696561240376559e+03 -1.8565396295835055e+03
6 4.1907332132232949e+02 4.0962894944175537e+02 1.0986647025780044e+03
7 -9.6645970600745068e+02 -3.5911787935573295e+02 -2.2384719111997448e+01
8 1.0265438581270025e+03 2.0808489842263230e+03 2.0164534268299593e+02
9 1.1337966507234397e+02 -5.0396233184209956e+02 3.8179698908837855e+02
10 1.2342073717320160e+02 9.5758334207234370e+01 6.8799216904595795e+01
11 -1.5320242612327118e+02 7.0895437874334675e+01 2.8604566716136226e+00
12 8.6000100331177282e+02 -1.3442535831934245e+02 -6.4193775682228159e+02
13 -2.4471242994052943e+02 -5.4264102607261088e+02 5.7696771921238769e+02
14 -3.9018569969952148e+02 3.0656573620303129e+03 1.5177932576921341e+02
15 -4.7634536416264723e+02 -1.2625516023855293e+03 -1.7806430239510228e+03
16 -2.8401490184979775e+03 1.5282109260061861e+03 -2.2214870113522261e+03
17 -1.2156159328353674e+03 -4.3257815608068495e+02 -2.1345521131783940e+02
18 3.0311750850899062e+02 3.4429089555337708e+02 -7.3709708806569222e+02
19 1.2045122218993047e+03 -9.7593750646130388e+02 5.4415371253339413e+02
20 -1.1696081099779099e+02 -8.3225560965709064e+01 -7.0457470193504179e+01
21 2.0598989260724796e+01 2.2356469079280821e+01 -7.9554177550795458e+01
22 -2.9312564165082662e+01 -5.9822361803205673e+01 -8.0777528003415412e+01
23 1.1532179753142320e+02 7.6103559438211744e+02 -5.6029347839975208e+02
24 -1.3770034997569367e+03 -2.7507426940749701e+02 3.3464942960699559e+03
25 5.1243904877931982e+02 -2.7117746030264681e+02 3.9984232018060953e+02
26 1.0172211816330174e+03 -9.5258495026629555e+02 -3.7013789400208352e+03
27 -9.3684148116059225e+02 4.9006556088962600e+02 4.5089073710681248e+02
28 2.6547988549156657e+03 5.0325157403920872e+02 5.1846329264498263e+03
29 1.3361686744155916e+03 2.5910193784510094e-01 1.0501345350932172e+03
30 4.1083282961451692e+02 6.3716214702023012e+02 -3.1059177937091031e+03
31 2.2436377537176742e+02 -5.0079917535823097e+02 6.8158392999295370e+02
32 -2.4717482535028790e+02 -1.4570181605226207e+02 -2.8412607206596493e+02
...

View File

@ -0,0 +1,91 @@
---
lammps_version: 15 Jun 2020
date_generated: Thu Jun 25 15:30:51 202
epsilon: 5e-12
prerequisites: ! |
pair eam/cd
pre_commands: ! |
variable units index real
post_commands: ! |
change_box all x final 0 10 y final 0 10 z final 0 10
input_file: in.metal
pair_style: eam/cd
pair_coeff: ! |
* * FeCr.cdeam Fe Cr
extract: ! ""
natoms: 32
init_vdwl: -1785.33573859861
init_coul: 0
init_stress: ! |2-
6.8043301174259739e+02 6.7297960563391212e+02 5.1465006825793432e+02 1.8121853680469485e+02 -2.1539743820861840e+01 1.9524563154151586e+01
init_forces: ! |2
8 -5.7350284149741624e+00 -3.5278567560873412e+01 -1.2945450320411185e+01
11 -1.8097851375135637e+01 -1.4526564839671716e+01 1.4745586739847019e+00
13 1.1989580066351607e+01 1.5624364891748142e+01 -9.7439139691488030e+00
18 -9.0623448888489833e+01 -3.6012980670109037e+01 -4.4206358603667979e+01
29 3.4315696679075806e+01 8.0626370079554022e+01 -8.5024543289523695e+00
4 9.8106599747837144e+00 -2.2423551582732831e+01 -2.2394700365566653e+01
9 -9.7103731975151177e+00 -6.9064607099453728e+00 -2.1661283927312738e+00
15 -1.7792920650091148e+01 3.5590552950398063e+01 -2.5723318396810825e+01
22 -6.5675672460417749e+00 -4.7649450274482049e+01 1.9724013269199872e+00
25 5.9273822696594358e+01 3.4630131644829056e+01 -2.9728016814706639e+00
3 -2.1730644235860989e+01 2.5556005146056687e+01 -1.3958230488587832e+01
10 -6.4920942773028782e+00 -2.5683534959198733e+00 -1.6573064725963313e+01
16 5.4866106162193525e+01 -2.6559412741299443e+01 -1.9741676495697597e+01
21 3.5877005997488176e+01 4.1948795376449915e+01 2.6549358660124593e+01
26 -3.5041054144373000e+01 -3.8690624501424864e+01 2.3990991622029867e+01
7 -2.5368323752589127e+01 2.9810504132177154e+01 -1.2638531317689472e+01
12 3.6951069676944783e+01 -2.1917541992301505e+01 -1.3427277677714791e+01
17 1.0715624362332361e+01 4.5671651640165596e+00 2.1824770610292802e+01
30 -1.1158262405262283e+01 1.5645450981201234e+01 -1.6793195768740460e+01
2 -2.1575934430928174e+00 -4.8375617933428616e+00 1.1868004064201370e+01
19 -5.6881035489195945e+01 -7.2486978424465079e+01 8.5346400279864998e+00
24 1.0635249022606776e+02 4.8261805685832684e+01 5.3930408354403887e+01
27 4.5450128358507476e+00 8.5625984164024569e+00 1.8060331715170475e+00
6 -1.2960045695799433e+01 1.4917602053253173e+01 -1.1634623653327418e+01
20 1.2523060387800900e+01 -1.1092095621986928e+01 7.3361549932744214e+00
31 -1.9746718194509153e+01 -3.1423401701143103e+01 5.6625794900273178e+01
5 -1.7188199887458431e+01 1.3020595354001873e+01 1.1713947051593561e+01
28 -8.4196479821767927e+00 5.9390977389974946e+00 2.9015171484281339e+00
32 -6.0270099286644097e+01 -3.5352975667087023e+01 -1.5579017839726889e+01
1 8.7363936089779717e+00 -4.0061891709735753e-01 -5.2750678284773072e+00
14 1.1426402460118315e+01 -9.4966708566757614e+00 3.1977067658213787e+01
23 2.8557983431932612e+01 4.2922771735639678e+01 -8.2298364085589899e+00
run_vdwl: 50833.2095623296
run_coul: 0
run_stress: ! |2-
1.1422757276809528e+06 6.4698538309370587e+05 4.1051148563743639e+05 9.5363304679864508e+04 -1.8362039585635712e+05 -1.1661012466179539e+05
run_forces: ! |2
8 -7.4661838460394447e+03 -1.1211419092422286e+03 -9.9785680647352237e+03
11 -1.2156739748086065e+03 -2.5965260670035150e+03 1.0931787195989891e+03
13 1.8896681608362815e+00 4.8691607259253615e+00 -1.2350445460364599e+00
18 9.6833281561496918e+01 2.3040573196963848e+02 -5.8045206738908905e+02
29 -1.1522875720670490e+04 2.1859177429597104e+04 6.6026924351739190e+03
4 8.2866585144562814e+03 2.1987889627894292e+03 -7.3269584596262430e+03
9 -4.6751202227701178e+04 -4.5455389599126109e+04 6.9310666457731364e+04
15 -1.7479956445491218e+03 -1.6324715355756180e+03 -3.8088738011660148e+03
22 5.9705595976766408e+05 -7.3498559170154767e+04 -2.8830207944910129e+05
25 -6.2964336519821500e+05 1.0487031227925362e+06 -4.2163928496550000e+05
3 -3.9919676312365680e+05 -2.9469092131577781e+05 4.7182000013219666e+04
10 1.7089467526999904e+03 1.5998419382683467e+03 3.7660701226776023e+03
16 -6.0049578751180682e+05 6.0547722741760917e+04 2.7117954880042706e+05
21 -6.4190745440347127e+03 -5.4746193210828164e+02 9.9912667127815421e+03
26 -1.2400361710263705e+02 -1.6482646184110337e+02 -1.3181023673232635e+03
7 -4.4527084366605749e+01 1.2083311421562247e+02 1.4090365320304585e+02
12 -9.1471177123676614e+02 8.8769239275791806e+03 2.4590954021189188e+02
17 1.0955176820986494e+06 -7.3097457868150948e+05 3.0732902700087230e+05
30 -8.8479117293965359e+00 3.9144652621120715e+00 -2.5741472917180555e+00
2 -7.6357102464059466e+01 1.1233035238477746e+03 -6.8826275473684859e+02
19 1.7252084357421222e+03 -1.1971214382248461e+03 9.6479329686047180e+01
24 -9.4115440774054568e+03 1.4868082917729369e+04 9.5344712883688553e+03
27 -2.0206241875051235e+03 8.9736344917421525e+02 2.7371544379914644e+02
6 -8.7269440254898427e+00 -4.2871068258170384e+00 -2.8071174977249303e+01
20 1.3147736477952498e+04 4.5528169367928713e+03 1.4550409304372299e+04
31 1.6062724190796675e+02 -3.5009702848199751e+01 1.5780906691469211e+01
5 4.6327746018426421e+02 -4.2009134275606988e+02 -2.3788165159758432e+03
28 1.2720985720833841e+02 1.6004798320652958e+02 1.3546485540637436e+03
32 -1.5462086679694039e+03 -9.9085693678647149e+03 -6.7979735229861799e+03
1 -6.8825417922686677e+02 -6.9446834170851020e+01 -8.7132365430256550e+02
14 3.2489354130384271e+01 -1.8199012589513091e+00 -1.2103425811994843e+01
23 9.7820842419642543e+02 -3.4289927091667496e+03 1.0679111325906679e+03
...

View File

@ -0,0 +1,90 @@
---
lammps_version: 15 Jun 2020
date_generated: Thu Jun 25 11:40:47 202
epsilon: 7.5e-12
prerequisites: ! |
pair eam/fs
pre_commands: ! |
variable units index real
post_commands: ! ""
input_file: in.metal
pair_style: eam/fs
pair_coeff: ! |
* * AlFe_mm.eam.fs Al Fe
extract: ! ""
natoms: 32
init_vdwl: -2496.58372622189
init_coul: 0
init_stress: ! |2-
2.3033019789741047e+03 2.1157417403923514e+03 2.0201355767290902e+03 1.3625967475024967e+02 -4.9118825128592029e+01 8.0062189596557349e+00
init_forces: ! |2
1 3.2793593861926894e+01 6.4571740367787598e+01 -2.1289279778598913e+00
2 -1.2829292312064029e+01 -5.4533055036423278e+01 1.8187434445669542e+01
3 -2.4856613953429456e+01 1.0514866674084597e+02 -2.3296287600437509e+01
4 5.3912586948208610e+00 -1.9207748493955110e+00 -3.0737420829610784e+01
5 2.2876420006755072e+01 1.3823836581860232e+02 2.7754672239203551e+01
6 3.2990987866655288e+01 4.7389376657311274e+01 4.1925550028130715e-01
7 -5.3127337737189976e+01 7.9068725922500050e+01 3.3313480295224882e+00
8 -3.3776815354713030e+01 -3.1883796291469537e+01 3.1197870995948911e+01
9 -1.6142958936642351e+01 -5.6081173595531077e+01 -3.9752773026105103e+01
10 -2.3444945461170079e+01 -8.6264628791048494e+01 -9.7382848626466640e+01
11 -3.7845977091330013e+01 -8.9150810223199585e+01 5.7663720237686718e+01
12 3.0195173959030388e+00 -8.0980830765493238e+01 1.3208578723692574e+01
13 1.4074145069219668e+00 1.6274921833661661e+01 -3.2622589971920675e+01
14 3.4107233289225746e+01 -9.9470010392150936e+00 3.5127602437573628e+01
15 -2.5283377148309391e+01 1.4403149632708308e+01 -4.5870071592016277e+00
16 1.1347792324200792e+02 -8.2148516354961487e+01 3.6846638005266399e+01
17 3.9601805292343890e+01 1.0338789002649486e+02 1.9982264609004446e+01
18 -7.0147350906383394e+01 -1.9416536628860054e+01 -3.1061364649276509e+01
19 -8.0113796208824880e+01 -3.6203470152188125e+01 1.7073669110420070e+01
20 1.9118534843395143e+01 1.8040139592039122e+01 -2.5670655740910352e+01
21 1.0678029830913370e+02 8.4131852942169118e+01 2.5233622309511127e+01
22 -6.1256398451879237e+00 -4.5897733307809965e+01 -7.6777005140719412e+00
23 3.5851086965813614e+01 7.2727642790340141e+01 -8.3728640107852527e+01
24 5.7040471090952735e+01 5.0540340852012491e+01 3.9578738566151387e+01
25 3.4502137563453971e+01 1.0646154765045129e+01 -2.2629894541123310e+01
26 -4.8073017653735285e+01 -1.0752340517338715e+02 1.1113490074292022e+02
27 1.1423747645119571e+01 -2.4217562070846903e+01 -1.6319043178767714e+01
28 -8.1060220093085604e+00 2.0590140270631622e+01 3.1642408010462596e+01
29 2.6452264513660189e+01 5.1030856603567926e+01 -4.1657860341522763e+00
30 -2.3924536059677859e+01 -2.6294734320754202e+01 -3.9690770192486717e+01
31 -2.4704253734618757e+00 -5.6516273903220871e+01 2.5013410902961631e+01
32 -1.1056658903666158e+02 -6.7209662311912936e+01 -3.1944424716033090e+01
run_vdwl: 40769.6664263014
run_coul: 0
run_stress: ! |2-
4.7822449917558428e+04 3.8552602066320171e+04 1.0546475946402764e+05 -4.7097209744561578e+03 -1.9235871974750171e+04 2.4588761490836405e+03
run_forces: ! |2
1 -1.9097605102340134e+04 2.7546194107357201e+03 8.3909985474391324e+03
2 -3.5418672604851995e+03 1.1917117809027379e+03 2.9638609715428606e+03
3 1.4645939207614488e+03 1.8470227268074846e+03 9.0546066503794027e+03
4 1.5171875398835888e+02 2.3348543217598845e+00 8.5754083947278403e+01
5 1.5255670556575355e+04 -9.9590105126572107e+03 -1.0489498857223289e+04
6 2.7818209314374612e+03 -8.6014157651635051e+03 -1.2889694687254105e+03
7 -8.8128660207662542e+03 1.1138472916664317e+04 -2.0399367408224349e+04
8 3.5529460324474094e+03 5.5566000158222214e+03 -1.8769853546433067e+04
9 4.8136177248632850e+02 -1.1761544007856573e+03 -2.7017533689432776e+02
10 1.6535310540000773e+02 1.3432168572003422e+02 1.1963005448873733e+02
11 -1.5594213178910303e+02 1.2778619884218003e+02 1.4189480288867410e+01
12 7.3411513010218300e+02 1.4480425185204228e+02 -4.6079278035527182e+02
13 -6.0663163395447373e+02 -4.8726527419793723e+02 7.3735693469161799e+02
14 -4.5176376406928503e+03 6.1391055620710058e+03 -4.1085739464480804e+02
15 1.1925775244422684e+03 1.1292242217644371e+03 -1.5125109545597138e+03
16 -7.2703161457054946e+01 8.3339390002686059e+02 1.9248938430089464e+02
17 -1.7348561999525100e+03 -7.2757358517488842e+02 -3.8426231743637675e+02
18 4.1035400691422291e+02 6.4564583234886231e+02 -1.4428957831120297e+03
19 1.9940148697028328e+03 -1.7448505231999620e+03 1.0608439981185611e+03
20 -1.2838394344544284e+02 -8.5097194257357614e+01 -4.9610165903643058e+01
21 3.8616135702960577e+01 1.0718282306571462e+01 -1.3278179744236820e+02
22 -2.4718543372782243e+01 -6.0165634334580901e+01 -7.0468964014220731e+01
23 9.0747440529556144e+01 8.5311078702801672e+02 -6.4721686266285906e+02
24 -7.7063686156537606e+03 -9.4345142528371957e+02 1.9053020187898885e+04
25 1.1857089833982384e+03 -1.5931029976786810e+03 6.4196001788860428e+02
26 1.2336392110879744e+03 -5.8839681071744899e+03 -1.3144430058575494e+04
27 -1.5957637891149948e+03 3.9143843166377701e+02 1.1708001522772088e+03
28 8.2009942698852374e+03 -4.3380266610733242e+03 3.2623123387198881e+04
29 3.1967940813541386e+03 2.8352472875132717e+03 1.8573222150564190e+04
30 5.4696070166386935e+03 4.6916524743124671e+02 -2.5807628896134785e+04
31 5.3597116724411387e+02 -5.7446986383635567e+02 7.3443567691364683e+02
32 -1.4126086707422027e+02 -3.0171449004871839e+01 -1.3497108559674118e+02
...

View File

@ -0,0 +1,91 @@
---
lammps_version: 15 Jun 2020
date_generated: Thu Jun 25 12:25:09 202
epsilon: 5e-12
prerequisites: ! |
pair eam
pre_commands: ! |
variable units index real
post_commands: ! ""
input_file: in.metal
pair_style: eam
pair_coeff: ! |
1 1 Al_jnp.eam
2 2 Cu_u3.eam
extract: ! ""
natoms: 32
init_vdwl: -8499.72465987996
init_coul: 0
init_stress: ! |-
-9.0512967456822462e+03 -1.0710884534079007e+04 -9.5331506234442222e+03 4.4739163983538219e+02 2.5624797371055561e+01 2.7908780729992691e+02
init_forces: ! |2
1 8.9249389277991696e+01 7.3995263010093637e+01 -7.5604348252794324e+01
2 3.5512459223271605e+01 1.2398579792103124e+02 3.6297316829891393e+01
3 2.2306866202164997e+01 -3.0312786796430260e+02 -2.0807932989160598e+01
4 -5.7820568539052488e+01 -1.2009744839886056e+02 -1.3585708084873534e+02
5 -6.5757546961524824e+01 1.7675629417686210e+02 -3.7208801848207692e+01
6 4.7109157331319356e+00 1.1965134426190438e+02 -1.3680059016506990e+01
7 -2.2409346630426118e+01 8.1370288045808721e+01 7.4449625791878475e+01
8 1.7379451791214294e+01 -1.2207398448858665e+02 -1.4391678298400700e+02
9 -1.3489005576125101e+02 -8.6392987530410579e+01 -9.0879621575062515e+01
10 -4.1563671140723542e+01 8.5339973622967136e+01 -8.9699430364130762e+01
11 8.1458057941736399e+00 -2.6121766393843103e+02 1.5492643601104581e+02
12 -1.0297805099599069e+02 -9.5172486574472472e+01 1.0819648894293765e+02
13 1.0313861845234526e+02 -8.8351137300014869e+01 -6.2073680865003409e+00
14 -6.3039130272573630e+01 1.7944087966396282e+02 5.7590563658541996e+01
15 4.2428201054682049e+00 1.3619512434927216e+02 -2.2867237122040885e+02
16 1.3483332744581298e+02 -5.2052236636380158e+01 6.8852636204178111e+01
17 6.3555360619967850e+01 1.1347628488179642e+02 6.7038345330162159e+01
18 -3.4161597721916095e+01 -4.0075734854314526e+01 -3.7031073502709120e+01
19 3.4139310149618382e+01 -2.8238015309403517e+02 1.1467202498923120e+01
20 -8.4437671164196360e+01 -1.1237913829595249e+02 1.2129005682228879e+02
21 -3.1150473702765758e+01 2.4466558525686946e+02 6.2302442269328033e+01
22 -8.1423238542844469e+00 -2.8290409159807524e+02 8.7726220588161485e+00
23 4.9046503898297907e+01 -2.2644433731837914e+01 -1.1694374612937432e+02
24 1.3937945191989905e+02 -8.8987379912017815e+01 1.6769570385333179e+02
25 1.9475811862357543e+02 1.6286504018802961e+02 -7.3347795242119290e+01
26 -7.1269892127955814e+01 -1.7809478750663267e+01 1.2294479367367137e+02
27 -6.8391617680507068e+01 -1.9982341830153047e+02 -1.5647303273515331e+02
28 1.1385695414507123e+02 1.5287346821313133e+02 1.0714748544581370e+02
29 -1.5588139712715383e+02 2.7338214923901506e+02 -7.3538964341222570e+00
30 -7.2869896720068823e+01 2.8621045994576667e+02 -7.7726624384066369e+01
31 -1.0966168562269243e+02 4.7983060114615256e+01 2.2592123146266931e+02
32 1.1016957264107833e+02 -8.2701371521240517e+01 -8.3482985240418913e+01
run_vdwl: 36279.0101522508
run_coul: 0
run_stress: ! |2-
6.8617284985816324e+04 5.8840338251294852e+04 4.9173412724151705e+04 -8.7320720548068912e+03 -1.4804674260124822e+04 1.4286081929042008e+04
run_forces: ! |2
1 -1.8801881199148622e+04 -2.2952295535468311e+03 7.7538322152248875e+03
2 -4.1204309984197471e+03 3.9974180085520034e+03 4.3473920721632103e+03
3 -5.3203316436746388e+02 -2.0904013776410811e+03 -2.1889617008630403e+03
4 4.2748949639632571e+02 -9.0574308491180966e+02 -3.1452289507637983e+02
5 9.6209046948319392e+03 -8.2581113904265112e+03 -1.0446350545430003e+04
6 8.9357703719184465e+03 -2.1627075238994030e+03 -2.7910760895159028e+03
7 -1.6771483557857286e+04 1.6311574435610137e+04 2.9013646076183518e+03
8 4.9281165530366775e+02 -1.9418868071717516e+03 -1.6251488823914694e+03
9 -5.8575452704647057e+02 6.4867039915392695e+02 -1.1994332775824771e+03
10 -7.5002177028330408e+00 1.3371970267938212e+02 1.7086029496424015e+02
11 -7.4112330774614770e+02 4.9496307880222747e+02 -2.7399350083367693e+02
12 9.4442081296446895e+02 5.5726294596568221e+02 -4.7445042822603352e+02
13 -2.9823453070251580e+03 -1.1243383556731744e+03 2.0393260589681713e+03
14 1.4690379110331942e+03 6.8718012562597205e+03 7.4104265907919626e+02
15 2.9352021540986340e+02 -6.8464019908249000e+01 -1.5697867591332192e+03
16 -1.1187452835505692e+03 -5.0942719099587237e+02 6.1184598184252911e+02
17 -1.7474509810876432e+03 -6.0457148035539185e+03 -1.6485264046696952e+03
18 4.4607104164218515e+02 3.4893057128796488e+02 -1.0683802675857635e+03
19 2.6846560299595676e+03 -1.9604404111237366e+03 7.5179155996129294e+00
20 3.1467440677843548e+01 -1.9394341540596807e+02 -1.5452870297451850e+02
21 -4.8572604737843960e+01 -5.2368368433832117e+01 5.2006926244007140e+01
22 -3.1057917866565361e+02 -3.6203364410569662e+02 -1.9818927476283253e+02
23 -3.2519516257159461e+02 1.7981634008567576e+03 -1.0689607287023916e+03
24 3.7024818762000746e+02 -1.0714406761271573e+03 -4.7575775136755749e+02
25 1.5037085122623180e+03 6.9844106766958621e+03 3.2093828527254896e+03
26 1.3948771623559989e+04 -1.2357848450183317e+04 -1.9266918517779788e+04
27 -2.3736463612225989e+03 1.7097162179598547e+03 9.9541308990791049e+02
28 8.2302550220349713e+03 -1.5285255401371217e+03 1.6767520845541083e+04
29 1.2644427071475491e+03 3.0966783186225307e+03 1.2562218506756633e+03
30 -6.1186918063631140e+02 3.2678985634373731e+02 3.1389427530946418e+03
31 3.6223572246865723e+02 -3.9937104153443983e+02 7.4861364047401173e+02
32 5.2799586554934969e+01 4.7896785990086791e+01 2.3701962771752182e+01
...

View File

@ -1,3 +1,4 @@
# DATE: 2020-06-25 UNITS: metal
# Pair potential beck for atom types 1 1: i,r,energy,force
beck_1_1

View File

@ -3,6 +3,11 @@ add_executable(test_atom_styles test_atom_styles.cpp)
target_link_libraries(test_atom_styles PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME AtomStyles COMMAND test_atom_styles WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_executable(test_pair_unit_convert test_pair_unit_convert.cpp)
target_link_libraries(test_pair_unit_convert PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME PairUnitConvert COMMAND test_pair_unit_convert WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(PairUnitConvert PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
add_executable(test_potential_file_reader test_potential_file_reader.cpp)
target_link_libraries(test_potential_file_reader PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME PotentialFileReader COMMAND test_potential_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

View File

@ -0,0 +1,820 @@
/* ----------------------------------------------------------------------
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.
------------------------------------------------------------------------- */
#include "atom.h"
#include "force.h"
#include "info.h"
#include "input.h"
#include "lammps.h"
#include "output.h"
#include "pair.h"
#include "thermo.h"
#include "utils.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cstdio>
#include <cstring>
#include <mpi.h>
// whether to print verbose output (i.e. not capturing LAMMPS screen output).
bool verbose = false;
using LAMMPS_NS::utils::split_words;
namespace LAMMPS_NS {
using ::testing::Eq;
// eV to kcal/mol conversion constant (CODATA 2018)
const double ev_convert = utils::get_conversion_factor(utils::ENERGY, utils::METAL2REAL);
// 1atm in bar
const double p_convert = 1.01325;
// relative error for comparing numbers
// cannot use smaller value due to lack of consistency
// of data in update.cpp. could be 1.0e-12
const double rel_error = 5.0e-7;
class PairUnitConvertTest : public ::testing::Test {
protected:
LAMMPS *lmp;
Info *info;
double fold[4][3];
void SetUp() override
{
const char *args[] = {"PairUnitConvertTest", "-log", "none", "-echo", "screen", "-nocite"};
char **argv = (char **)args;
int argc = sizeof(args) / sizeof(char *);
if (!verbose) ::testing::internal::CaptureStdout();
lmp = new LAMMPS(argc, argv, MPI_COMM_WORLD);
if (!verbose) ::testing::internal::GetCapturedStdout();
ASSERT_NE(lmp, nullptr);
if (!verbose) ::testing::internal::CaptureStdout();
info = new Info(lmp);
lmp->input->one("units metal");
lmp->input->one("dimension 3");
lmp->input->one("region box block -4 4 -4 4 -4 4");
lmp->input->one("create_box 2 box");
lmp->input->one("create_atoms 1 single -1.1 1.2 0.0 units box");
lmp->input->one("create_atoms 1 single -1.2 -1.1 0.0 units box");
lmp->input->one("create_atoms 2 single 0.9 1.0 0.0 units box");
lmp->input->one("create_atoms 2 single 1.0 -0.9 0.0 units box");
lmp->input->one("pair_style zero 4.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("mass * 1.0");
lmp->input->one("write_data test_pair_unit_convert.data nocoeff");
lmp->input->one("clear");
if (!verbose) ::testing::internal::GetCapturedStdout();
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete info;
delete lmp;
if (!verbose) ::testing::internal::GetCapturedStdout();
remove("test_pair_unit_convert.data");
}
};
TEST_F(PairUnitConvertTest, zero)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "zero")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style zero 6.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style zero 6.0");
lmp->input->one("pair_coeff * *");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, lj_cut)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "lj/cut")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style lj/cut 6.0");
lmp->input->one("pair_coeff * * 0.01014286346782117 2.0");
remove("test.table.metal");
lmp->input->one("pair_write 1 1 1000 r 0.1 6.0 test.table.metal lj_1_1");
lmp->input->one("pair_write 1 2 1000 r 0.1 6.0 test.table.metal lj_1_2");
lmp->input->one("pair_write 2 2 1000 r 0.1 6.0 test.table.metal lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style lj/cut 6.0");
lmp->input->one("pair_coeff * * 0.2339 2.0");
remove("test.table.real");
lmp->input->one("pair_write 1 1 1000 r 0.1 6.0 test.table.real lj_1_1");
lmp->input->one("pair_write 1 2 1000 r 0.1 6.0 test.table.real lj_1_2");
lmp->input->one("pair_write 2 2 1000 r 0.1 6.0 test.table.real lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, eam)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam");
lmp->input->one("pair_coeff * * Cu_u3.eam");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam");
lmp->input->one("pair_coeff * * Cu_u3.eam");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, eam_alloy)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam/alloy")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/alloy");
lmp->input->one("pair_coeff * * AlCu.eam.alloy Al Cu");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/alloy");
lmp->input->one("pair_coeff * * AlCu.eam.alloy Al Cu");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, eam_fs)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam/fs")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/fs");
lmp->input->one("pair_coeff * * FeP_mm.eam.fs Fe P");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/fs");
lmp->input->one("pair_coeff * * FeP_mm.eam.fs Fe P");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, eam_cd)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "eam/cd")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/cd");
lmp->input->one("pair_coeff * * FeCr.cdeam Cr Fe");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style eam/cd");
lmp->input->one("pair_coeff * * FeCr.cdeam Cr Fe");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, sw)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "sw")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style sw");
lmp->input->one("pair_coeff * * GaN.sw Ga N");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style sw");
lmp->input->one("pair_coeff * * GaN.sw Ga N");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, table_metal2real)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "table")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.metal lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.metal lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.metal lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.metal lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.metal lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.metal lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, table_real2metal)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "table")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.real lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.real lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.real lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style table linear 1000");
lmp->input->one("pair_coeff 1 1 test.table.real lj_1_1");
lmp->input->one("pair_coeff 1 2 test.table.real lj_1_2");
lmp->input->one("pair_coeff 2 2 test.table.real lj_2_2");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, 1.0/p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(1.0/ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(1.0/ev_convert * fold[i][j], f[i][j],
fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, tersoff)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, tersoff_mod)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/mod")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod");
lmp->input->one("pair_coeff * * Si.tersoff.mod Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod");
lmp->input->one("pair_coeff * * Si.tersoff.mod Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, tersoff_mod_c)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/mod/c")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod/c");
lmp->input->one("pair_coeff * * Si.tersoff.modc Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/mod/c");
lmp->input->one("pair_coeff * * Si.tersoff.modc Si Si");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, tersoff_table)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/table")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/table");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/table");
lmp->input->one("pair_coeff * * SiC.tersoff Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, tersoff_zbl)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/zbl")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, tersoff_zbl_omp)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "tersoff/zbl/omp")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("package omp 4");
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl/omp");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("package omp 4");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style tersoff/zbl/omp");
lmp->input->one("pair_coeff * * SiC.tersoff.zbl Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
TEST_F(PairUnitConvertTest, vashishta)
{
// check if the prerequisite pair style is available
if (!info->has_style("pair", "vashishta")) GTEST_SKIP();
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style vashishta");
lmp->input->one("pair_coeff * * SiC.vashishta Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
// copy pressure, energy, and force from first step
double pold;
lmp->output->thermo->evaluate_keyword("press", &pold);
double eold = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
double **f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
fold[i][j] = f[i][j];
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("clear");
lmp->input->one("units real");
lmp->input->one("read_data test_pair_unit_convert.data");
lmp->input->one("pair_style vashishta");
lmp->input->one("pair_coeff * * SiC.vashishta Si C");
lmp->input->one("run 0 post no");
if (!verbose) ::testing::internal::GetCapturedStdout();
double pnew;
lmp->output->thermo->evaluate_keyword("press", &pnew);
EXPECT_NEAR(pold, p_convert * pnew, fabs(pnew * rel_error));
double enew = lmp->force->pair->eng_vdwl + lmp->force->pair->eng_coul;
EXPECT_NEAR(ev_convert * eold, enew, fabs(enew * rel_error));
f = lmp->atom->f;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_NEAR(ev_convert * fold[i][j], f[i][j], fabs(f[i][j] * rel_error));
}
} // namespace LAMMPS_NS
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
::testing::InitGoogleMock(&argc, argv);
// handle arguments passed via environment variable
if (const char *var = getenv("TEST_ARGS")) {
std::vector<std::string> env = split_words(var);
for (auto arg : env) {
if (arg == "-v") {
verbose = true;
}
}
}
if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true;
int rv = RUN_ALL_TESTS();
MPI_Finalize();
remove("test.table.metal");
remove("test.table.real");
return rv;
}

View File

@ -23,6 +23,7 @@
#include "MANYBODY/pair_tersoff_mod_c.h"
#include "MANYBODY/pair_tersoff_zbl.h"
#include "MANYBODY/pair_vashishta.h"
#include "USER-MISC/pair_tersoff_table.h"
#include "input.h"
#include "lammps.h"
#include "potential_file_reader.h"
@ -50,6 +51,7 @@ const int LAMMPS_NS::PairGW::NPARAMS_PER_LINE;
const int LAMMPS_NS::PairGWZBL::NPARAMS_PER_LINE;
const int LAMMPS_NS::PairNb3bHarmonic::NPARAMS_PER_LINE;
const int LAMMPS_NS::PairVashishta::NPARAMS_PER_LINE;
const int LAMMPS_NS::PairTersoffTable::NPARAMS_PER_LINE;
class PotentialFileReaderTest : public ::testing::Test {
protected:
@ -74,7 +76,7 @@ protected:
}
};
TEST_F(PotentialFileReaderTest, Si)
TEST_F(PotentialFileReaderTest, Sw)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
@ -140,6 +142,17 @@ TEST_F(PotentialFileReaderTest, TersoffModC)
ASSERT_EQ(utils::count_words(line), PairTersoffMODC::NPARAMS_PER_LINE);
}
TEST_F(PotentialFileReaderTest, TersoffTable)
{
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
PotentialFileReader reader(lmp, "Si.tersoff", "TersoffTable");
if (!verbose) ::testing::internal::GetCapturedStdout();
auto line = reader.next_line(PairTersoffTable::NPARAMS_PER_LINE);
ASSERT_EQ(utils::count_words(line), PairTersoffTable::NPARAMS_PER_LINE);
}
TEST_F(PotentialFileReaderTest, TersoffZBL)
{
if (!verbose) ::testing::internal::CaptureStdout();
@ -195,6 +208,49 @@ TEST_F(PotentialFileReaderTest, Vashishta)
ASSERT_EQ(utils::count_words(line), PairVashishta::NPARAMS_PER_LINE);
}
TEST_F(PotentialFileReaderTest, UnitConvert)
{
PotentialFileReader *reader;
int unit_convert, flag;
if (!verbose) ::testing::internal::CaptureStdout();
lmp->input->one("units metal");
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber");
if (!verbose) ::testing::internal::GetCapturedStdout();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, 0);
delete reader;
if (!verbose) ::testing::internal::CaptureStdout();
flag = utils::get_supported_conversions(utils::UNKNOWN);
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag);
if (!verbose) ::testing::internal::GetCapturedStdout();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, 0);
delete reader;
if (!verbose) ::testing::internal::CaptureStdout();
flag = utils::get_supported_conversions(utils::ENERGY);
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag);
if (!verbose) ::testing::internal::GetCapturedStdout();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, 0);
delete reader;
if (!verbose) ::testing::internal::CaptureStdout();
flag = utils::get_supported_conversions(utils::ENERGY);
lmp->input->one("units real");
reader = new PotentialFileReader(lmp, "Si.sw", "Stillinger-Weber", flag);
if (!verbose) ::testing::internal::GetCapturedStdout();
unit_convert = reader->get_unit_convert();
ASSERT_EQ(unit_convert, utils::METAL2REAL);
delete reader;
}
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);

View File

@ -341,3 +341,25 @@ TEST(Utils, potential_file)
remove("ctest1.txt");
remove("ctest2.txt");
}
TEST(Utils, unit_conversion)
{
double factor;
int flag;
flag = utils::get_supported_conversions(utils::UNKNOWN);
ASSERT_EQ(flag, utils::NOCONVERT);
flag = utils::get_supported_conversions(utils::ENERGY);
ASSERT_EQ(flag, utils::METAL2REAL | utils::REAL2METAL);
factor = utils::get_conversion_factor(utils::UNKNOWN, 1 << 30 - 1);
ASSERT_DOUBLE_EQ(factor, 0.0);
factor = utils::get_conversion_factor(utils::UNKNOWN, utils::NOCONVERT);
ASSERT_DOUBLE_EQ(factor, 0.0);
factor = utils::get_conversion_factor(utils::ENERGY, utils::NOCONVERT);
ASSERT_DOUBLE_EQ(factor, 1.0);
factor = utils::get_conversion_factor(utils::ENERGY, utils::METAL2REAL);
ASSERT_DOUBLE_EQ(factor, 23.060549);
factor = utils::get_conversion_factor(utils::ENERGY, utils::REAL2METAL);
ASSERT_DOUBLE_EQ(factor, 1.0 / 23.060549);
}