Merge branch 'master' into examples

This commit is contained in:
Agilio Padua
2021-04-22 18:08:32 +02:00
57 changed files with 1472 additions and 887 deletions

View File

@ -800,9 +800,12 @@ if(BUILD_MPI)
endif() endif()
if(PKG_GPU) if(PKG_GPU)
message(STATUS "<<< GPU package settings >>> message(STATUS "<<< GPU package settings >>>
-- GPU API: ${GPU_API}") -- GPU API: ${GPU_API}")
if(GPU_API STREQUAL "CUDA") if(GPU_API STREQUAL "CUDA")
message(STATUS "CUDA Compiler: ${CUDA_NVCC_EXECUTABLE}")
message(STATUS "GPU default architecture: ${GPU_ARCH}") message(STATUS "GPU default architecture: ${GPU_ARCH}")
message(STATUS "GPU binning with CUDPP: ${CUDPP_OPT}")
message(STATUS "CUDA MPS support: ${CUDA_MPS_SUPPORT}")
elseif(GPU_API STREQUAL "HIP") elseif(GPU_API STREQUAL "HIP")
message(STATUS "HIP platform: ${HIP_PLATFORM}") message(STATUS "HIP platform: ${HIP_PLATFORM}")
message(STATUS "HIP architecture: ${HIP_ARCH}") message(STATUS "HIP architecture: ${HIP_ARCH}")
@ -812,7 +815,7 @@ if(PKG_GPU)
message(STATUS "HIP GPU sorting: off") message(STATUS "HIP GPU sorting: off")
endif() endif()
endif() endif()
message(STATUS "GPU precision: ${GPU_PREC}") message(STATUS "GPU precision: ${GPU_PREC}")
endif() endif()
if(PKG_KOKKOS) if(PKG_KOKKOS)
message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}") message(STATUS "Kokkos Arch: ${KOKKOS_ARCH}")

View File

@ -257,7 +257,7 @@ factor, similar to how the :doc:`fix balance shift <fix_balance>`
command operates. command operates.
The *dimstr* argument is a string of characters, each of which must be The *dimstr* argument is a string of characters, each of which must be
an "x" or "y" or "z". Eacn character can appear zero or one time, an "x" or "y" or "z". Each character can appear zero or one time,
since there is no advantage to balancing on a dimension more than since there is no advantage to balancing on a dimension more than
once. You should normally only list dimensions where you expect there once. You should normally only list dimensions where you expect there
to be a density variation in the particles. to be a density variation in the particles.
@ -285,7 +285,7 @@ plane gets closer to the target value.
After the balanced plane positions are determined, if any pair of After the balanced plane positions are determined, if any pair of
adjacent planes are closer together than the neighbor skin distance adjacent planes are closer together than the neighbor skin distance
(as specified by the :doc`neigh_modify <neigh_modify>` command), then (as specified by the :doc:`neigh_modify <neigh_modify>` command), then
the plane positions are shifted to separate them by at least this the plane positions are shifted to separate them by at least this
amount. This is to prevent particles being lost when dynamics are run amount. This is to prevent particles being lost when dynamics are run
with processor sub-domains that are too narrow in one or more with processor sub-domains that are too narrow in one or more

View File

@ -216,7 +216,7 @@ above. It changes the positions of cutting planes between processors
in an iterative fashion, seeking to reduce the imbalance factor. in an iterative fashion, seeking to reduce the imbalance factor.
The *dimstr* argument is a string of characters, each of which must be The *dimstr* argument is a string of characters, each of which must be
an "x" or "y" or "z". Eacn character can appear zero or one time, an "x" or "y" or "z". Each character can appear zero or one time,
since there is no advantage to balancing on a dimension more than since there is no advantage to balancing on a dimension more than
once. You should normally only list dimensions where you expect there once. You should normally only list dimensions where you expect there
to be a density variation in the particles. to be a density variation in the particles.

View File

@ -12,7 +12,7 @@ Syntax
* ID, group are documented in :doc:`fix <fix>` command * ID, group are documented in :doc:`fix <fix>` command
* precession/spin = style name of this fix command * precession/spin = style name of this fix command
* style = *zeeman* or *anisotropy* or *cubic* * style = *zeeman* or *anisotropy* or *cubic* or *stt*
.. parsed-literal:: .. parsed-literal::
@ -22,12 +22,12 @@ Syntax
*anisotropy* args = K x y z *anisotropy* args = K x y z
K = intensity of the magnetic anisotropy (in eV) K = intensity of the magnetic anisotropy (in eV)
x y z = vector direction of the anisotropy x y z = vector direction of the anisotropy
.. parsed-literal::
*cubic* args = K1 K2c n1x n1y n1x n2x n2y n2z n3x n3y n3z *cubic* args = K1 K2c n1x n1y n1x n2x n2y n2z n3x n3y n3z
K1 and K2c = intensity of the magnetic anisotropy (in eV) K1 and K2c = intensity of the magnetic anisotropy (in eV)
n1x to n3z = three direction vectors of the cubic anisotropy n1x to n3z = three direction vectors of the cubic anisotropy
*stt* args = J x y z
J = intensity of the spin-transfer torque field
x y z = vector direction of the field
Examples Examples
"""""""" """"""""
@ -125,6 +125,11 @@ axis along the :math:`(1 1 1)`-type cube diagonals). :math:`K_2^c >
diagonals. See chapter 2 of :ref:`(Skomski) <Skomski1>` for more diagonals. See chapter 2 of :ref:`(Skomski) <Skomski1>` for more
details on cubic anisotropies. details on cubic anisotropies.
Style *stt* is used to simulate the interaction between the spins and
a spin-transfer torque.
See equation (7) of :ref:`(Chirac) <Chirac1>` for more details about the
implemented spin-transfer torque term.
In all cases, the choice of :math:`(x y z)` only imposes the vector In all cases, the choice of :math:`(x y z)` only imposes the vector
directions for the forces. Only the direction of the vector is directions for the forces. Only the direction of the vector is
important; its length is ignored (the entered vectors are important; its length is ignored (the entered vectors are
@ -132,6 +137,16 @@ normalized).
Those styles can be combined within one single command line. Those styles can be combined within one single command line.
.. note::
The norm of all vectors defined with the precession/spin command
have to be non-zero. For example, defining
"fix 1 all precession/spin zeeman 0.1 0.0 0.0 0.0" would result
in an error message.
Since those vector components are used to compute the inverse of the
field (or anisotropy) vector norm, setting a zero-vector would result
in a division by zero.
---------- ----------
Restart, fix_modify, output, run start/stop, minimize info Restart, fix_modify, output, run start/stop, minimize info
@ -162,11 +177,6 @@ is only enabled if LAMMPS was built with this package, and if the
atom_style "spin" was declared. See the :doc:`Build package atom_style "spin" was declared. See the :doc:`Build package
<Build_package>` doc page for more info. <Build_package>` doc page for more info.
The *precession/spin* style can only be declared once. If more than
one precession type (for example combining an anisotropy and a Zeeman
interactions) has to be declared, they have to be chained in the same
command line (as shown in the examples above).
Related commands Related commands
"""""""""""""""" """"""""""""""""
@ -184,3 +194,9 @@ none
**(Skomski)** Skomski, R. (2008). Simple models of magnetism. **(Skomski)** Skomski, R. (2008). Simple models of magnetism.
Oxford University Press. Oxford University Press.
.. _Chirac1:
**(Chirac)** Chirac, Théophile, et al. Ultrafast antiferromagnetic
switching in NiO induced by spin transfer torques.
Physical Review B 102.13 (2020): 134415.

View File

@ -452,6 +452,9 @@ the same or else LAMMPS will generate an error.
Pair style *hybrid/scaled* currently only works for non-accelerated Pair style *hybrid/scaled* currently only works for non-accelerated
pair styles and pair styles from the OPT package. pair styles and pair styles from the OPT package.
When using pair styles from the GPU package they must not be listed
multiple times. LAMMPS will detect this and abort.
Related commands Related commands
"""""""""""""""" """"""""""""""""

View File

@ -764,7 +764,6 @@ Dyre
Dzyaloshinskii Dzyaloshinskii
Eaa Eaa
Eaat Eaat
Eacn
eam eam
eangle eangle
earg earg

View File

@ -45,3 +45,14 @@ directory.
results (computed by the python script). results (computed by the python script).
Note: This example is a reworked version of a test problem Note: This example is a reworked version of a test problem
provided by Martin Kroger (ETHZ). provided by Martin Kroger (ETHZ).
- validation_nve:
simulates a small assembly of magnetic atoms (54). The atoms are
coupled by an exchange interaction and a mechanical potential
(EAM here).
This example represents an NVE run: the total energy of the
system is preserved, whereas the spin and lattice energy
reservoirs are exchanging energy.
Run as: ./run-test-nve.sh
Output: res_lammps.dat contains the data. The results are displayed
by nve_spin_lattice.pdf.

View File

@ -0,0 +1,25 @@
#!/bin/bash
# test 1: damping and exchange
cd validation_damped_exchange/
./run-test-exchange.sh
rm dump.data res_lammps.dat res_llg.dat
cd ..
# test 2: damping and Zeeman
cd validation_damped_precession/
./run-test-prec.sh
rm res_lammps.dat res_llg.dat
cd ..
# test 3: langevin, damping and Zeeman
cd validation_langevin_precession/
./run-test-prec.sh
rm average_spin test-prec-spin.in res_lammps.dat res_langevin.dat
cd ..
# test 4: NVE run, test Etot preservation
cd validation_nve/
./run-test-nve.sh
rm nve_spin_lattice.pdf res_lammps.dat
cd ..

View File

@ -31,8 +31,8 @@ neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin 200.0 200.0 1.0 48279 fix 2 all langevin 200.0 200.0 0.1 48279
fix 3 all langevin/spin 0.0 0.00001 321 fix 3 all langevin/spin 0.0 0.0 321
fix 4 all nve/spin lattice moving fix 4 all nve/spin lattice moving
timestep 0.001 timestep 0.001

View File

@ -22,16 +22,19 @@ mass 1 55.845
set group all spin 2.2 0.0 0.0 1.0 set group all spin 2.2 0.0 0.0 1.0
velocity all create 0 4928459 rot yes dist gaussian velocity all create 0 4928459 rot yes dist gaussian
pair_style hybrid/overlay eam/alloy spin/exchange 3.5 # pair_style hybrid/overlay eam/alloy spin/exchange 3.5
pair_style hybrid/overlay eam/alloy spin/exchange 4.0 spin/neel 4.0
pair_coeff * * eam/alloy Fe_Mishin2006.eam.alloy Fe pair_coeff * * eam/alloy Fe_Mishin2006.eam.alloy Fe
pair_coeff * * spin/exchange exchange 3.4 0.1 0.2171 1.841 pair_coeff * * spin/exchange exchange 3.4 0.1 0.2171 1.841
pair_coeff * * spin/neel neel 4.0 0.02 0.0 1.841 0.0 0.0 1.0
neighbor 0.1 bin neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 200.0 0.01 321 fix 2 all langevin 0.0 0.0 0.0 48279
fix 3 all nve/spin lattice moving fix 3 all langevin/spin 200.0 0.01 321
fix 4 all nve/spin lattice moving
timestep 0.001 timestep 0.001
# compute and output options # compute and output options

View File

@ -150,7 +150,7 @@ int CHARMMT::loop(const int eflag, const int vflag) {
&_cut_coul_innersq, &this->_threads_per_atom); &_cut_coul_innersq, &this->_threads_per_atom);
} else { } else {
this->k_pair.set_size(GX,BX); this->k_pair.set_size(GX,BX);
this->k_pair.run(&this->atom->x, &ljd, &sp_lj, this->k_pair.run(&this->atom->x, &lj1, &_lj_types, &sp_lj,
&this->nbor->dev_nbor, this->_nbor_data, &this->nbor->dev_nbor, this->_nbor_data,
&this->ans->force, &this->ans->engv, &eflag, &this->ans->force, &this->ans->engv, &eflag,
&vflag, &ainum, &nbor_pitch, &this->atom->q, &vflag, &ainum, &nbor_pitch, &this->atom->q,

View File

@ -29,7 +29,8 @@ _texture(q_tex, int2);
#endif #endif
__kernel void k_charmm(const __global numtyp4 *restrict x_, __kernel void k_charmm(const __global numtyp4 *restrict x_,
const __global numtyp2 *restrict ljd, const __global numtyp4 *restrict lj1,
const int lj_types,
const __global numtyp *restrict sp_lj, const __global numtyp *restrict sp_lj,
const __global int *dev_nbor, const __global int *dev_nbor,
const __global int *dev_packed, const __global int *dev_packed,
@ -88,20 +89,14 @@ __kernel void k_charmm(const __global numtyp4 *restrict x_,
numtyp delz = ix.z-jx.z; numtyp delz = ix.z-jx.z;
numtyp rsq = delx*delx+dely*dely+delz*delz; numtyp rsq = delx*delx+dely*dely+delz*delz;
int mtype=itype*lj_types+jtype;
if (rsq<cut_bothsq) { if (rsq<cut_bothsq) {
numtyp r2inv=ucl_recip(rsq); numtyp r2inv=ucl_recip(rsq);
numtyp forcecoul, force_lj, force, switch1; numtyp forcecoul, force_lj, force, r6inv, switch1;
numtyp lj3, lj4;
if (rsq < cut_ljsq) { if (rsq < cut_ljsq) {
numtyp eps = ucl_sqrt(ljd[itype].x*ljd[jtype].x); r6inv = r2inv*r2inv*r2inv;
numtyp sig6 = (numtyp)0.5 * (ljd[itype].y+ljd[jtype].y); force_lj = factor_lj*r6inv*(lj1[mtype].x*r6inv-lj1[mtype].y);
numtyp sig_r_6 = sig6*sig6*r2inv;
sig_r_6 = sig_r_6*sig_r_6*sig_r_6;
lj4 = (numtyp)4.0*eps*sig_r_6;
lj3 = lj4*sig_r_6;
force_lj = factor_lj*((numtyp)12.0 * lj3 - (numtyp)6.0 * lj4);
if (rsq > cut_lj_innersq) { if (rsq > cut_lj_innersq) {
switch1 = (cut_ljsq-rsq); switch1 = (cut_ljsq-rsq);
numtyp switch2 = (numtyp)12.0*rsq*switch1*(rsq-cut_lj_innersq)* numtyp switch2 = (numtyp)12.0*rsq*switch1*(rsq-cut_lj_innersq)*
@ -109,7 +104,7 @@ __kernel void k_charmm(const __global numtyp4 *restrict x_,
switch1 *= switch1; switch1 *= switch1;
switch1 *= (cut_ljsq+(numtyp)2.0*rsq-(numtyp)3.0*cut_lj_innersq)* switch1 *= (cut_ljsq+(numtyp)2.0*rsq-(numtyp)3.0*cut_lj_innersq)*
denom_lj; denom_lj;
switch2 *= lj3-lj4; switch2 *= r6inv*(lj1[mtype].z*r6inv-lj1[mtype].w);
force_lj = force_lj*switch1+switch2; force_lj = force_lj*switch1+switch2;
} }
} else } else
@ -137,7 +132,7 @@ __kernel void k_charmm(const __global numtyp4 *restrict x_,
if (EVFLAG && eflag) { if (EVFLAG && eflag) {
e_coul += forcecoul; e_coul += forcecoul;
if (rsq < cut_ljsq) { if (rsq < cut_ljsq) {
numtyp e=lj3-lj4; numtyp e=r6inv*(lj1[mtype].z*r6inv-lj1[mtype].w);
if (rsq > cut_lj_innersq) if (rsq > cut_lj_innersq)
e *= switch1; e *= switch1;
energy+=factor_lj*e; energy+=factor_lj*e;

View File

@ -108,10 +108,7 @@ int TersoffT::init(const int ntypes, const int nlocal, const int nall, const int
_nparams = nparams; _nparams = nparams;
_nelements = nelements; _nelements = nelements;
UCL_H_Vec<numtyp> host_write(ntypes*ntypes,*(this->ucl_device), _cutsq_max=0.0;
UCL_READ_WRITE);
host_write.zero();
cutsq_pair.alloc(ntypes*ntypes,*(this->ucl_device),UCL_READ_ONLY);
for (int ii=1; ii<ntypes; ii++) { for (int ii=1; ii<ntypes; ii++) {
const int i=host_map[ii]; const int i=host_map[ii];
for (int jj=1; jj<ntypes; jj++) { for (int jj=1; jj<ntypes; jj++) {
@ -120,12 +117,10 @@ int TersoffT::init(const int ntypes, const int nlocal, const int nall, const int
const int k=host_map[kk]; const int k=host_map[kk];
if (i<0 || j<0 || k<0) continue; if (i<0 || j<0 || k<0) continue;
const int ijkparam = host_elem2param[i][j][k]; const int ijkparam = host_elem2param[i][j][k];
if (host_cutsq[ijkparam]>host_write[ii*ntypes+jj]) if (host_cutsq[ijkparam]>_cutsq_max) _cutsq_max=host_cutsq[ijkparam];
host_write[ii*ntypes+jj]=host_cutsq[ijkparam];
} }
} }
} }
ucl_copy(cutsq_pair,host_write,ntypes*ntypes);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
UCL_H_Vec<numtyp4> dview(nparams,*(this->ucl_device), UCL_H_Vec<numtyp4> dview(nparams,*(this->ucl_device),
@ -235,7 +230,6 @@ void TersoffT::clear() {
ts3.clear(); ts3.clear();
ts4.clear(); ts4.clear();
ts5.clear(); ts5.clear();
cutsq_pair.clear();
map.clear(); map.clear();
elem2param.clear(); elem2param.clear();
_zetaij.clear(); _zetaij.clear();
@ -286,7 +280,7 @@ int TersoffT::loop(const int eflag, const int vflag, const int evatom,
int BX=this->block_pair(); int BX=this->block_pair();
int GX=static_cast<int>(ceil(static_cast<double>(ainum)/BX)); int GX=static_cast<int>(ceil(static_cast<double>(ainum)/BX));
this->k_short_nbor.set_size(GX,BX); this->k_short_nbor.set_size(GX,BX);
this->k_short_nbor.run(&this->atom->x, &cutsq_pair, &_ntypes, this->k_short_nbor.run(&this->atom->x, &_cutsq_max, &_ntypes,
&this->nbor->dev_nbor, &this->nbor->dev_packed, &this->nbor->dev_nbor, &this->nbor->dev_packed,
&ainum, &nbor_pitch, &this->_threads_per_atom); &ainum, &nbor_pitch, &this->_threads_per_atom);

View File

@ -226,17 +226,13 @@ _texture_2d( pos_tex,int4);
#endif #endif
__kernel void k_tersoff_short_nbor(const __global numtyp4 *restrict x_, __kernel void k_tersoff_short_nbor(const __global numtyp4 *restrict x_,
const __global numtyp *restrict cutsq_pair, const numtyp cutsq, const int ntypes,
const int ntypes, __global int * dev_nbor, __global int * dev_nbor,
const __global int * dev_packed, const __global int * dev_packed,
const int inum, const int nbor_pitch, const int inum, const int nbor_pitch,
const int t_per_atom_in) { const int t_per_atom_in) {
const int ii=GLOBAL_ID_X; const int ii=GLOBAL_ID_X;
#ifdef ONETYPE
const numtyp cutsq=cutsq_pair[ONETYPE];
#endif
if (ii<inum) { if (ii<inum) {
const int i=dev_packed[ii]; const int i=dev_packed[ii];
int nbor=ii+nbor_pitch; int nbor=ii+nbor_pitch;
@ -245,9 +241,6 @@ __kernel void k_tersoff_short_nbor(const __global numtyp4 *restrict x_,
const int nbor_end=nbor+fast_mul(numj,nbor_pitch); const int nbor_end=nbor+fast_mul(numj,nbor_pitch);
numtyp4 ix; fetch4(ix,i,pos_tex); //x_[i]; numtyp4 ix; fetch4(ix,i,pos_tex); //x_[i];
#ifndef ONETYPE
const int itype=ix.w*ntypes;
#endif
int newj=0; int newj=0;
__global int *out_list=dev_nbor+2*nbor_pitch+ii*t_per_atom; __global int *out_list=dev_nbor+2*nbor_pitch+ii*t_per_atom;
@ -258,11 +251,6 @@ __kernel void k_tersoff_short_nbor(const __global numtyp4 *restrict x_,
int j = sj & NEIGHMASK; int j = sj & NEIGHMASK;
numtyp4 jx; fetch4(jx,j,pos_tex); //x_[j]; numtyp4 jx; fetch4(jx,j,pos_tex); //x_[j];
#ifndef ONETYPE
const int mtype=jx.w+itype;
const numtyp cutsq=cutsq_pair[mtype];
#endif
// Compute r12 // Compute r12
numtyp delx = ix.x-jx.x; numtyp delx = ix.x-jx.x;
numtyp dely = ix.y-jx.y; numtyp dely = ix.y-jx.y;

View File

@ -73,7 +73,7 @@ class Tersoff : public BaseThree<numtyp, acctyp> {
/// ts5.x = beta, ts5.y = powern, ts5.z = lam2, ts5.w = bigb /// ts5.x = beta, ts5.y = powern, ts5.z = lam2, ts5.w = bigb
UCL_D_Vec<numtyp4> ts5; UCL_D_Vec<numtyp4> ts5;
UCL_D_Vec<numtyp> cutsq_pair; numtyp _cutsq_max;
UCL_D_Vec<int> elem2param; UCL_D_Vec<int> elem2param;
UCL_D_Vec<int> map; UCL_D_Vec<int> map;

View File

@ -142,7 +142,10 @@ ucl_inline numtyp ters_fa_d(const numtyp r,
numtyp *ans_d) numtyp *ans_d)
{ {
#ifndef ONETYPE #ifndef ONETYPE
if (r > param_bigr + param_bigd) return (numtyp)0.0; if (r > param_bigr + param_bigd) {
*ans_d = (numtyp)0.0;
return (numtyp)0.0;
}
#endif #endif
numtyp dfc; numtyp dfc;
const numtyp fc=ters_fc_d(r,param_bigr,param_bigd,&dfc); const numtyp fc=ters_fc_d(r,param_bigr,param_bigd,&dfc);

View File

@ -105,10 +105,7 @@ int TersoffMT::init(const int ntypes, const int nlocal, const int nall, const in
_nparams = nparams; _nparams = nparams;
_nelements = nelements; _nelements = nelements;
UCL_H_Vec<numtyp> host_write(ntypes*ntypes,*(this->ucl_device), _cutsq_max=0.0;
UCL_READ_WRITE);
host_write.zero();
cutsq_pair.alloc(ntypes*ntypes,*(this->ucl_device),UCL_READ_ONLY);
for (int ii=1; ii<ntypes; ii++) { for (int ii=1; ii<ntypes; ii++) {
const int i=host_map[ii]; const int i=host_map[ii];
for (int jj=1; jj<ntypes; jj++) { for (int jj=1; jj<ntypes; jj++) {
@ -117,12 +114,10 @@ int TersoffMT::init(const int ntypes, const int nlocal, const int nall, const in
const int k=host_map[kk]; const int k=host_map[kk];
if (i<0 || j<0 || k<0) continue; if (i<0 || j<0 || k<0) continue;
const int ijkparam = host_elem2param[i][j][k]; const int ijkparam = host_elem2param[i][j][k];
if (host_cutsq[ijkparam]>host_write[ii*ntypes+jj]) if (host_cutsq[ijkparam]>_cutsq_max) _cutsq_max=host_cutsq[ijkparam];
host_write[ii*ntypes+jj]=host_cutsq[ijkparam];
} }
} }
} }
ucl_copy(cutsq_pair,host_write,ntypes*ntypes);
UCL_H_Vec<numtyp4> dview(nparams,*(this->ucl_device), UCL_H_Vec<numtyp4> dview(nparams,*(this->ucl_device),
UCL_WRITE_ONLY); UCL_WRITE_ONLY);
@ -229,7 +224,6 @@ void TersoffMT::clear() {
ts3.clear(); ts3.clear();
ts4.clear(); ts4.clear();
ts5.clear(); ts5.clear();
cutsq_pair.clear();
map.clear(); map.clear();
elem2param.clear(); elem2param.clear();
_zetaij.clear(); _zetaij.clear();
@ -275,7 +269,7 @@ int TersoffMT::loop(const int eflag, const int vflag, const int evatom,
int BX=this->block_pair(); int BX=this->block_pair();
int GX=static_cast<int>(ceil(static_cast<double>(ainum)/BX)); int GX=static_cast<int>(ceil(static_cast<double>(ainum)/BX));
this->k_short_nbor.set_size(GX,BX); this->k_short_nbor.set_size(GX,BX);
this->k_short_nbor.run(&this->atom->x, &cutsq_pair, &_ntypes, this->k_short_nbor.run(&this->atom->x, &_cutsq_max, &_ntypes,
&this->nbor->dev_nbor, &this->nbor->dev_packed, &this->nbor->dev_nbor, &this->nbor->dev_packed,
&ainum, &nbor_pitch, &this->_threads_per_atom); &ainum, &nbor_pitch, &this->_threads_per_atom);

View File

@ -220,17 +220,13 @@ _texture_2d( pos_tex,int4);
#endif #endif
__kernel void k_tersoff_mod_short_nbor(const __global numtyp4 *restrict x_, __kernel void k_tersoff_mod_short_nbor(const __global numtyp4 *restrict x_,
const __global numtyp *restrict cutsq_pair, const numtyp cutsq, const int ntypes,
const int ntypes, __global int * dev_nbor, __global int * dev_nbor,
const __global int * dev_packed, const __global int * dev_packed,
const int inum, const int nbor_pitch, const int inum, const int nbor_pitch,
const int t_per_atom) { const int t_per_atom) {
const int ii=GLOBAL_ID_X; const int ii=GLOBAL_ID_X;
#ifdef ONETYPE
const numtyp cutsq=cutsq_pair[ONETYPE];
#endif
if (ii<inum) { if (ii<inum) {
const int i=dev_packed[ii]; const int i=dev_packed[ii];
int nbor=ii+nbor_pitch; int nbor=ii+nbor_pitch;
@ -239,9 +235,6 @@ __kernel void k_tersoff_mod_short_nbor(const __global numtyp4 *restrict x_,
const int nbor_end=nbor+fast_mul(numj,nbor_pitch); const int nbor_end=nbor+fast_mul(numj,nbor_pitch);
numtyp4 ix; fetch4(ix,i,pos_tex); //x_[i]; numtyp4 ix; fetch4(ix,i,pos_tex); //x_[i];
#ifndef ONETYPE
const int itype=ix.w*ntypes;
#endif
int newj=0; int newj=0;
__global int *out_list=dev_nbor+2*nbor_pitch+ii*t_per_atom; __global int *out_list=dev_nbor+2*nbor_pitch+ii*t_per_atom;
@ -252,11 +245,6 @@ __kernel void k_tersoff_mod_short_nbor(const __global numtyp4 *restrict x_,
int j = sj & NEIGHMASK; int j = sj & NEIGHMASK;
numtyp4 jx; fetch4(jx,j,pos_tex); //x_[j]; numtyp4 jx; fetch4(jx,j,pos_tex); //x_[j];
#ifndef ONETYPE
const int mtype=jx.w+itype;
const numtyp cutsq=cutsq_pair[mtype];
#endif
// Compute r12 // Compute r12
numtyp delx = ix.x-jx.x; numtyp delx = ix.x-jx.x;
numtyp dely = ix.y-jx.y; numtyp dely = ix.y-jx.y;

View File

@ -76,7 +76,7 @@ class TersoffMod : public BaseThree<numtyp, acctyp> {
/// ts5.x = c5, ts5.y = h /// ts5.x = c5, ts5.y = h
UCL_D_Vec<numtyp4> ts5; UCL_D_Vec<numtyp4> ts5;
UCL_D_Vec<numtyp> cutsq_pair; numtyp _cutsq_max;
UCL_D_Vec<int> elem2param; UCL_D_Vec<int> elem2param;
UCL_D_Vec<int> map; UCL_D_Vec<int> map;

View File

@ -112,10 +112,7 @@ int TersoffZT::init(const int ntypes, const int nlocal, const int nall,
_nparams = nparams; _nparams = nparams;
_nelements = nelements; _nelements = nelements;
UCL_H_Vec<numtyp> host_write(ntypes*ntypes,*(this->ucl_device), _cutsq_max=0.0;
UCL_READ_WRITE);
host_write.zero();
cutsq_pair.alloc(ntypes*ntypes,*(this->ucl_device),UCL_READ_ONLY);
for (int ii=1; ii<ntypes; ii++) { for (int ii=1; ii<ntypes; ii++) {
const int i=host_map[ii]; const int i=host_map[ii];
for (int jj=1; jj<ntypes; jj++) { for (int jj=1; jj<ntypes; jj++) {
@ -124,12 +121,10 @@ int TersoffZT::init(const int ntypes, const int nlocal, const int nall,
const int k=host_map[kk]; const int k=host_map[kk];
if (i<0 || j<0 || k<0) continue; if (i<0 || j<0 || k<0) continue;
const int ijkparam = host_elem2param[i][j][k]; const int ijkparam = host_elem2param[i][j][k];
if (host_cutsq[ijkparam]>host_write[ii*ntypes+jj]) if (host_cutsq[ijkparam]>_cutsq_max) _cutsq_max=host_cutsq[ijkparam];
host_write[ii*ntypes+jj]=host_cutsq[ijkparam];
} }
} }
} }
ucl_copy(cutsq_pair,host_write,ntypes*ntypes);
UCL_H_Vec<numtyp4> dview(nparams,*(this->ucl_device), UCL_H_Vec<numtyp4> dview(nparams,*(this->ucl_device),
UCL_WRITE_ONLY); UCL_WRITE_ONLY);
@ -253,7 +248,6 @@ void TersoffZT::clear() {
ts4.clear(); ts4.clear();
ts5.clear(); ts5.clear();
ts6.clear(); ts6.clear();
cutsq_pair.clear();
map.clear(); map.clear();
elem2param.clear(); elem2param.clear();
_zetaij.clear(); _zetaij.clear();
@ -299,7 +293,7 @@ int TersoffZT::loop(const int eflag, const int vflag, const int evatom,
int BX=this->block_pair(); int BX=this->block_pair();
int GX=static_cast<int>(ceil(static_cast<double>(ainum)/BX)); int GX=static_cast<int>(ceil(static_cast<double>(ainum)/BX));
this->k_short_nbor.set_size(GX,BX); this->k_short_nbor.set_size(GX,BX);
this->k_short_nbor.run(&this->atom->x, &cutsq_pair, &_ntypes, this->k_short_nbor.run(&this->atom->x, &_cutsq_max, &_ntypes,
&this->nbor->dev_nbor, &this->nbor->dev_packed, &this->nbor->dev_nbor, &this->nbor->dev_packed,
&ainum, &nbor_pitch, &this->_threads_per_atom); &ainum, &nbor_pitch, &this->_threads_per_atom);

View File

@ -238,17 +238,13 @@ _texture( ts6_tex,int4);
#endif #endif
__kernel void k_tersoff_zbl_short_nbor(const __global numtyp4 *restrict x_, __kernel void k_tersoff_zbl_short_nbor(const __global numtyp4 *restrict x_,
const __global numtyp *restrict cutsq_pair, const numtyp cutsq, const int ntypes,
const int ntypes, __global int * dev_nbor, __global int * dev_nbor,
const __global int * dev_packed, const __global int * dev_packed,
const int inum, const int nbor_pitch, const int inum, const int nbor_pitch,
const int t_per_atom) { const int t_per_atom) {
const int ii=GLOBAL_ID_X; const int ii=GLOBAL_ID_X;
#ifdef ONETYPE
const numtyp cutsq=cutsq_pair[ONETYPE];
#endif
if (ii<inum) { if (ii<inum) {
const int i=dev_packed[ii]; const int i=dev_packed[ii];
int nbor=ii+nbor_pitch; int nbor=ii+nbor_pitch;
@ -257,9 +253,6 @@ __kernel void k_tersoff_zbl_short_nbor(const __global numtyp4 *restrict x_,
const int nbor_end=nbor+fast_mul(numj,nbor_pitch); const int nbor_end=nbor+fast_mul(numj,nbor_pitch);
numtyp4 ix; fetch4(ix,i,pos_tex); //x_[i]; numtyp4 ix; fetch4(ix,i,pos_tex); //x_[i];
#ifndef ONETYPE
const int itype=ix.w*ntypes;
#endif
int newj=0; int newj=0;
__global int *out_list=dev_nbor+2*nbor_pitch+ii*t_per_atom; __global int *out_list=dev_nbor+2*nbor_pitch+ii*t_per_atom;
@ -270,11 +263,6 @@ __kernel void k_tersoff_zbl_short_nbor(const __global numtyp4 *restrict x_,
int j = sj & NEIGHMASK; int j = sj & NEIGHMASK;
numtyp4 jx; fetch4(jx,j,pos_tex); //x_[j]; numtyp4 jx; fetch4(jx,j,pos_tex); //x_[j];
#ifndef ONETYPE
const int mtype=jx.w+itype;
const numtyp cutsq=cutsq_pair[mtype];
#endif
// Compute r12 // Compute r12
numtyp delx = ix.x-jx.x; numtyp delx = ix.x-jx.x;
numtyp dely = ix.y-jx.y; numtyp dely = ix.y-jx.y;

View File

@ -80,7 +80,7 @@ class TersoffZBL : public BaseThree<numtyp, acctyp> {
/// ts6.x = Z_i, ts6.y = Z_j, ts6.z = ZBLcut, ts6.w = ZBLexpscale /// ts6.x = Z_i, ts6.y = Z_j, ts6.z = ZBLcut, ts6.w = ZBLexpscale
UCL_D_Vec<numtyp4> ts6; UCL_D_Vec<numtyp4> ts6;
UCL_D_Vec<numtyp> cutsq_pair; numtyp _cutsq_max;
UCL_D_Vec<int> elem2param; UCL_D_Vec<int> elem2param;
UCL_D_Vec<int> map; UCL_D_Vec<int> map;

View File

@ -1038,6 +1038,11 @@ typedef tdual_virial_array::t_host_const_randomread t_virial_array_randomread;
// Spin types // Spin types
//2d X_FLOAT array n*4 //2d X_FLOAT array n*4
#ifdef LMP_KOKKOS_NO_LEGACY
typedef Kokkos::DualView<X_FLOAT*[4], Kokkos::LayoutLeft, LMPDeviceType> tdual_float_1d_4;
#else
typedef Kokkos::DualView<X_FLOAT*[4], Kokkos::LayoutRight, LMPDeviceType> tdual_float_1d_4;
#endif
typedef tdual_float_1d_4::t_host t_sp_array; typedef tdual_float_1d_4::t_host t_sp_array;
typedef tdual_float_1d_4::t_host_const t_sp_array_const; typedef tdual_float_1d_4::t_host_const t_sp_array_const;
typedef tdual_float_1d_4::t_host_um t_sp_array_um; typedef tdual_float_1d_4::t_host_um t_sp_array_um;

View File

@ -69,7 +69,6 @@
void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan) void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
{ {
int i,total,length,offset,num;
FFT_SCALAR norm; FFT_SCALAR norm;
#if defined(FFT_FFTW3) #if defined(FFT_FFTW3)
FFT_SCALAR *out_ptr; FFT_SCALAR *out_ptr;
@ -99,9 +98,6 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
// 1d FFTs along fast axis // 1d FFTs along fast axis
total = plan->total1;
length = plan->length1;
#if defined(FFT_MKL) #if defined(FFT_MKL)
if (flag == 1) if (flag == 1)
DftiComputeForward(plan->handle_fast,data); DftiComputeForward(plan->handle_fast,data);
@ -114,11 +110,14 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
theplan=plan->plan_fast_backward; theplan=plan->plan_fast_backward;
FFTW_API(execute_dft)(theplan,data,data); FFTW_API(execute_dft)(theplan,data,data);
#else #else
int total = plan->total1;
int length = plan->length1;
if (flag == 1) if (flag == 1)
for (offset = 0; offset < total; offset += length) for (int offset = 0; offset < total; offset += length)
kiss_fft(plan->cfg_fast_forward,&data[offset],&data[offset]); kiss_fft(plan->cfg_fast_forward,&data[offset],&data[offset]);
else else
for (offset = 0; offset < total; offset += length) for (int offset = 0; offset < total; offset += length)
kiss_fft(plan->cfg_fast_backward,&data[offset],&data[offset]); kiss_fft(plan->cfg_fast_backward,&data[offset],&data[offset]);
#endif #endif
@ -133,9 +132,6 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
// 1d FFTs along mid axis // 1d FFTs along mid axis
total = plan->total2;
length = plan->length2;
#if defined(FFT_MKL) #if defined(FFT_MKL)
if (flag == 1) if (flag == 1)
DftiComputeForward(plan->handle_mid,data); DftiComputeForward(plan->handle_mid,data);
@ -148,11 +144,14 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
theplan=plan->plan_mid_backward; theplan=plan->plan_mid_backward;
FFTW_API(execute_dft)(theplan,data,data); FFTW_API(execute_dft)(theplan,data,data);
#else #else
total = plan->total2;
length = plan->length2;
if (flag == 1) if (flag == 1)
for (offset = 0; offset < total; offset += length) for (int offset = 0; offset < total; offset += length)
kiss_fft(plan->cfg_mid_forward,&data[offset],&data[offset]); kiss_fft(plan->cfg_mid_forward,&data[offset],&data[offset]);
else else
for (offset = 0; offset < total; offset += length) for (int offset = 0; offset < total; offset += length)
kiss_fft(plan->cfg_mid_backward,&data[offset],&data[offset]); kiss_fft(plan->cfg_mid_backward,&data[offset],&data[offset]);
#endif #endif
@ -167,9 +166,6 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
// 1d FFTs along slow axis // 1d FFTs along slow axis
total = plan->total3;
length = plan->length3;
#if defined(FFT_MKL) #if defined(FFT_MKL)
if (flag == 1) if (flag == 1)
DftiComputeForward(plan->handle_slow,data); DftiComputeForward(plan->handle_slow,data);
@ -182,11 +178,14 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
theplan=plan->plan_slow_backward; theplan=plan->plan_slow_backward;
FFTW_API(execute_dft)(theplan,data,data); FFTW_API(execute_dft)(theplan,data,data);
#else #else
total = plan->total3;
length = plan->length3;
if (flag == 1) if (flag == 1)
for (offset = 0; offset < total; offset += length) for (int offset = 0; offset < total; offset += length)
kiss_fft(plan->cfg_slow_forward,&data[offset],&data[offset]); kiss_fft(plan->cfg_slow_forward,&data[offset],&data[offset]);
else else
for (offset = 0; offset < total; offset += length) for (int offset = 0; offset < total; offset += length)
kiss_fft(plan->cfg_slow_backward,&data[offset],&data[offset]); kiss_fft(plan->cfg_slow_backward,&data[offset],&data[offset]);
#endif #endif
@ -201,11 +200,11 @@ void fft_3d(FFT_DATA *in, FFT_DATA *out, int flag, struct fft_plan_3d *plan)
if (flag == -1 && plan->scaled) { if (flag == -1 && plan->scaled) {
norm = plan->norm; norm = plan->norm;
num = plan->normnum; const int num = plan->normnum;
#if defined(FFT_FFTW3) #if defined(FFT_FFTW3)
out_ptr = (FFT_SCALAR *)out; out_ptr = (FFT_SCALAR *)out;
#endif #endif
for (i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
#if defined(FFT_FFTW3) #if defined(FFT_FFTW3)
*(out_ptr++) *= norm; *(out_ptr++) *= norm;
*(out_ptr++) *= norm; *(out_ptr++) *= norm;

View File

@ -24,9 +24,11 @@
#include "fix_langevin_spin.h" #include "fix_langevin_spin.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include "atom.h"
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "group.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "modify.h" #include "modify.h"
@ -42,7 +44,7 @@ using namespace MathConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixLangevinSpin::FixLangevinSpin(LAMMPS *lmp, int narg, char **arg) : FixLangevinSpin::FixLangevinSpin(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), id_temp(nullptr), random(nullptr) Fix(lmp, narg, arg), random(nullptr)
{ {
if (narg != 6) error->all(FLERR,"Illegal langevin/spin command"); if (narg != 6) error->all(FLERR,"Illegal langevin/spin command");
@ -106,10 +108,8 @@ void FixLangevinSpin::init()
double hbar = force->hplanck/MY_2PI; // eV/(rad.THz) double hbar = force->hplanck/MY_2PI; // eV/(rad.THz)
double kb = force->boltz; // eV/K double kb = force->boltz; // eV/K
// D = (MY_2PI*alpha_t*gil_factor*kb*temp);
D = (alpha_t*gil_factor*kb*temp); D = (alpha_t*gil_factor*kb*temp);
// D = (12.0/MY_2PI)*(MY_2PI*alpha_t*gil_factor*kb*temp);
D /= (hbar*dts); D /= (hbar*dts);
sigma = sqrt(2.0*D); sigma = sqrt(2.0*D);
} }
@ -142,7 +142,7 @@ void FixLangevinSpin::add_tdamping(double spi[3], double fmi[3])
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixLangevinSpin::add_temperature(double fmi[3]) void FixLangevinSpin::add_temperature(int i, double spi[3], double fmi[3])
{ {
// double rx = sigma*(2.0*random->uniform() - 1.0); // double rx = sigma*(2.0*random->uniform() - 1.0);
// double ry = sigma*(2.0*random->uniform() - 1.0); // double ry = sigma*(2.0*random->uniform() - 1.0);
@ -150,6 +150,7 @@ void FixLangevinSpin::add_temperature(double fmi[3])
double rx = sigma*random->gaussian(); double rx = sigma*random->gaussian();
double ry = sigma*random->gaussian(); double ry = sigma*random->gaussian();
double rz = sigma*random->gaussian(); double rz = sigma*random->gaussian();
double hbar = force->hplanck/MY_2PI;
// adding the random field // adding the random field
@ -163,3 +164,14 @@ void FixLangevinSpin::add_temperature(double fmi[3])
fmi[1] *= gil_factor; fmi[1] *= gil_factor;
fmi[2] *= gil_factor; fmi[2] *= gil_factor;
} }
/* ---------------------------------------------------------------------- */
void FixLangevinSpin::compute_single_langevin(int i, double spi[3], double fmi[3])
{
int *mask = atom->mask;
if (mask[i] & groupbit) {
if (tdamp_flag) add_tdamping(spi,fmi);
if (temp_flag) add_temperature(i,spi,fmi);
}
}

View File

@ -26,7 +26,7 @@ namespace LAMMPS_NS {
class FixLangevinSpin : public Fix { class FixLangevinSpin : public Fix {
public: public:
int tdamp_flag,ldamp_flag,temp_flag; // damping and temperature flags int tdamp_flag,temp_flag; // damping and temperature flags
FixLangevinSpin(class LAMMPS *, int, char **); FixLangevinSpin(class LAMMPS *, int, char **);
virtual ~FixLangevinSpin(); virtual ~FixLangevinSpin();
@ -34,7 +34,8 @@ class FixLangevinSpin : public Fix {
void init(); void init();
void setup(int); void setup(int);
void add_tdamping(double *, double *); // add transverse damping void add_tdamping(double *, double *); // add transverse damping
void add_temperature(double *); // add temperature void add_temperature(int, double *, double *);
void compute_single_langevin(int, double *, double *);
protected: protected:
double alpha_t; // transverse mag. damping double alpha_t; // transverse mag. damping
@ -43,9 +44,6 @@ class FixLangevinSpin : public Fix {
double D,sigma; // bath intensity var. double D,sigma; // bath intensity var.
double gil_factor; // gilbert's prefactor double gil_factor; // gilbert's prefactor
char *id_temp;
class Compute *temperature;
int nlevels_respa; int nlevels_respa;
class RanMars *random; class RanMars *random;
int seed; int seed;

View File

@ -60,7 +60,8 @@ enum{NONE};
FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) : FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), Fix(lmp, narg, arg),
pair(nullptr), spin_pairs(nullptr), pair(nullptr), spin_pairs(nullptr), locklangevinspin(nullptr),
locksetforcespin(nullptr), lockprecessionspin(nullptr),
rsec(nullptr), stack_head(nullptr), stack_foot(nullptr), rsec(nullptr), stack_head(nullptr), stack_foot(nullptr),
backward_stacks(nullptr), forward_stacks(nullptr) backward_stacks(nullptr), forward_stacks(nullptr)
{ {
@ -75,6 +76,9 @@ FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
npairs = 0; npairs = 0;
npairspin = 0; npairspin = 0;
// test nprec
nprecspin = nlangspin = nsetspin = 0;
// checking if map array or hash is defined // checking if map array or hash is defined
if (atom->map_style == Atom::MAP_NONE) if (atom->map_style == Atom::MAP_NONE)
@ -125,7 +129,6 @@ FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
maglangevin_flag = 0; maglangevin_flag = 0;
tdamp_flag = temp_flag = 0; tdamp_flag = temp_flag = 0;
setforce_spin_flag = 0; setforce_spin_flag = 0;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -138,6 +141,8 @@ FixNVESpin::~FixNVESpin()
memory->destroy(forward_stacks); memory->destroy(forward_stacks);
memory->destroy(backward_stacks); memory->destroy(backward_stacks);
delete [] spin_pairs; delete [] spin_pairs;
delete [] locklangevinspin;
delete [] lockprecessionspin;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -189,20 +194,20 @@ void FixNVESpin::init()
// loop 2: fill vector with ptrs to Pair/Spin styles // loop 2: fill vector with ptrs to Pair/Spin styles
int count = 0; int count1 = 0;
if (npairspin == 1) { if (npairspin == 1) {
count = 1; count1 = 1;
spin_pairs[0] = (PairSpin *) force->pair_match("spin",0,0); spin_pairs[0] = (PairSpin *) force->pair_match("spin",0,0);
} else if (npairspin > 1) { } else if (npairspin > 1) {
for (int i = 0; i<npairs; i++) { for (int i = 0; i<npairs; i++) {
if (force->pair_match("spin",0,i)) { if (force->pair_match("spin",0,i)) {
spin_pairs[count] = (PairSpin *) force->pair_match("spin",0,i); spin_pairs[count1] = (PairSpin *) force->pair_match("spin",0,i);
count++; count1++;
} }
} }
} }
if (count != npairspin) if (count1 != npairspin)
error->all(FLERR,"Incorrect number of spin pairs"); error->all(FLERR,"Incorrect number of spin pairs");
// set pair/spin and long/spin flags // set pair/spin and long/spin flags
@ -215,30 +220,71 @@ void FixNVESpin::init()
} }
} }
// ptrs FixPrecessionSpin classes // set ptrs for fix precession/spin styles
// loop 1: obtain # of fix precession/spin styles
int iforce; int iforce;
for (iforce = 0; iforce < modify->nfix; iforce++) { for (iforce = 0; iforce < modify->nfix; iforce++) {
if (strstr(modify->fix[iforce]->style,"precession/spin")) { if (strstr(modify->fix[iforce]->style,"precession/spin")) {
precession_spin_flag = 1; nprecspin++;
lockprecessionspin = (FixPrecessionSpin *) modify->fix[iforce];
} }
} }
// ptrs on the FixLangevinSpin class // init length of vector of ptrs to precession/spin styles
if (nprecspin > 0) {
lockprecessionspin = new FixPrecessionSpin*[nprecspin];
}
// loop 2: fill vector with ptrs to precession/spin styles
int count2 = 0;
if (nprecspin > 0) {
for (iforce = 0; iforce < modify->nfix; iforce++) {
if (strstr(modify->fix[iforce]->style,"precession/spin")) {
precession_spin_flag = 1;
lockprecessionspin[count2] = (FixPrecessionSpin *) modify->fix[iforce];
count2++;
}
}
}
if (count2 != nprecspin)
error->all(FLERR,"Incorrect number of fix precession/spin");
// set ptrs for fix langevin/spin styles
// loop 1: obtain # of fix langevin/spin styles
for (iforce = 0; iforce < modify->nfix; iforce++) { for (iforce = 0; iforce < modify->nfix; iforce++) {
if (strstr(modify->fix[iforce]->style,"langevin/spin")) { if (strstr(modify->fix[iforce]->style,"langevin/spin")) {
maglangevin_flag = 1; nlangspin++;
locklangevinspin = (FixLangevinSpin *) modify->fix[iforce];
} }
} }
if (maglangevin_flag) { // init length of vector of ptrs to precession/spin styles
if (locklangevinspin->tdamp_flag == 1) tdamp_flag = 1;
if (locklangevinspin->temp_flag == 1) temp_flag = 1; if (nlangspin > 0) {
locklangevinspin = new FixLangevinSpin*[nprecspin];
} }
// loop 2: fill vector with ptrs to precession/spin styles
count2 = 0;
if (nlangspin > 0) {
for (iforce = 0; iforce < modify->nfix; iforce++) {
if (strstr(modify->fix[iforce]->style,"langevin/spin")) {
maglangevin_flag = 1;
locklangevinspin[count2] = (FixLangevinSpin *) modify->fix[iforce];
count2++;
}
}
}
if (count2 != nlangspin)
error->all(FLERR,"Incorrect number of fix precession/spin");
// ptrs FixSetForceSpin classes // ptrs FixSetForceSpin classes
for (iforce = 0; iforce < modify->nfix; iforce++) { for (iforce = 0; iforce < modify->nfix; iforce++) {
@ -471,17 +517,16 @@ void FixNVESpin::ComputeInteractionsSpin(int i)
// update magnetic precession interactions // update magnetic precession interactions
if (precession_spin_flag) { if (precession_spin_flag) {
lockprecessionspin->compute_single_precession(i,spi,fmi); for (int k = 0; k < nprecspin; k++) {
lockprecessionspin[k]->compute_single_precession(i,spi,fmi);
}
} }
// update langevin damping and random force // update langevin damping and random force
if (maglangevin_flag) { // mag. langevin if (maglangevin_flag) { // mag. langevin
if (tdamp_flag) { // transverse damping for (int k = 0; k < nlangspin; k++) {
locklangevinspin->add_tdamping(spi,fmi); locklangevinspin[k]->compute_single_langevin(i,spi,fmi);
}
if (temp_flag) { // spin temperature
locklangevinspin->add_temperature(fmi);
} }
} }
@ -496,7 +541,6 @@ void FixNVESpin::ComputeInteractionsSpin(int i)
fm[i][0] = fmi[0]; fm[i][0] = fmi[0];
fm[i][1] = fmi[1]; fm[i][1] = fmi[1];
fm[i][2] = fmi[2]; fm[i][2] = fmi[2];
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -61,11 +61,20 @@ friend class PairSpin;
int tdamp_flag, temp_flag; int tdamp_flag, temp_flag;
int setforce_spin_flag; int setforce_spin_flag;
// pointers to magnetic fixes // pointers to fix langevin/spin styles
class FixPrecessionSpin *lockprecessionspin; int nlangspin;
class FixLangevinSpin *locklangevinspin; class FixLangevinSpin **locklangevinspin;
class FixSetForceSpin *locksetforcespin;
// pointers to fix setforce/spin styles
int nsetspin;
class FixSetForceSpin *locksetforcespin; // to be done
// pointers to fix precession/spin styles
int nprecspin;
class FixPrecessionSpin **lockprecessionspin;
// pointers to magnetic pair styles // pointers to magnetic pair styles

View File

@ -67,6 +67,9 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) :
H_field = 0.0; H_field = 0.0;
nhx = nhy = nhz = 0.0; nhx = nhy = nhz = 0.0;
hx = hy = hz = 0.0; hx = hy = hz = 0.0;
stt_field = 0.0;
nsttx = nstty = nsttz = 0.0;
sttx = stty = sttz = 0.0;
Ka = 0.0; Ka = 0.0;
nax = nay = naz = 0.0; nax = nay = naz = 0.0;
Kax = Kay = Kaz = 0.0; Kax = Kay = Kaz = 0.0;
@ -74,8 +77,11 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) :
nc1x = nc1y = nc1z = 0.0; nc1x = nc1y = nc1z = 0.0;
nc2x = nc2y = nc2z = 0.0; nc2x = nc2y = nc2z = 0.0;
nc3x = nc3y = nc3z = 0.0; nc3x = nc3y = nc3z = 0.0;
K6 = 0.0;
n6x = n6y = n6z = 0.0;
m6x = m6y = m6z = 0.0;
zeeman_flag = aniso_flag = cubic_flag = 0; zeeman_flag = stt_flag = aniso_flag = cubic_flag = hexaniso_flag = 0;
int iarg = 3; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
@ -87,6 +93,14 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) :
nhy = utils::numeric(FLERR,arg[iarg+3],false,lmp); nhy = utils::numeric(FLERR,arg[iarg+3],false,lmp);
nhz = utils::numeric(FLERR,arg[iarg+4],false,lmp); nhz = utils::numeric(FLERR,arg[iarg+4],false,lmp);
iarg += 5; iarg += 5;
} else if (strcmp(arg[iarg],"stt") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix precession/spin command");
stt_flag = 1;
stt_field = utils::numeric(FLERR,arg[iarg+1],false,lmp);
nsttx = utils::numeric(FLERR,arg[iarg+2],false,lmp);
nstty = utils::numeric(FLERR,arg[iarg+3],false,lmp);
nsttz = utils::numeric(FLERR,arg[iarg+4],false,lmp);
iarg += 5;
} else if (strcmp(arg[iarg],"anisotropy") == 0) { } else if (strcmp(arg[iarg],"anisotropy") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal fix precession/spin command"); if (iarg+4 > narg) error->all(FLERR,"Illegal fix precession/spin command");
aniso_flag = 1; aniso_flag = 1;
@ -110,41 +124,111 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) :
nc3y = utils::numeric(FLERR,arg[iarg+10],false,lmp); nc3y = utils::numeric(FLERR,arg[iarg+10],false,lmp);
nc3z = utils::numeric(FLERR,arg[iarg+11],false,lmp); nc3z = utils::numeric(FLERR,arg[iarg+11],false,lmp);
iarg += 12; iarg += 12;
} else if (strcmp(arg[iarg],"hexaniso") == 0) {
if (iarg+7 > narg) error->all(FLERR,"Illegal fix precession/spin command");
hexaniso_flag = 1;
K6 = utils::numeric(FLERR,arg[iarg+1],false,lmp);
n6x = utils::numeric(FLERR,arg[iarg+2],false,lmp);
n6y = utils::numeric(FLERR,arg[iarg+3],false,lmp);
n6z = utils::numeric(FLERR,arg[iarg+4],false,lmp);
m6x = utils::numeric(FLERR,arg[iarg+5],false,lmp);
m6y = utils::numeric(FLERR,arg[iarg+6],false,lmp);
m6z = utils::numeric(FLERR,arg[iarg+7],false,lmp);
iarg += 8;
} else error->all(FLERR,"Illegal precession/spin command"); } else error->all(FLERR,"Illegal precession/spin command");
} }
// normalize vectors // normalize vectors
double inorm; double norm2,inorm;
if (zeeman_flag) { if (zeeman_flag) {
inorm = 1.0/sqrt(nhx*nhx + nhy*nhy + nhz*nhz); norm2 = nhx*nhx + nhy*nhy + nhz*nhz;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
nhx *= inorm; nhx *= inorm;
nhy *= inorm; nhy *= inorm;
nhz *= inorm; nhz *= inorm;
} }
if (stt_flag) {
norm2 = nsttx*nsttx + nstty*nstty + nsttz*nsttz;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
nsttx *= inorm;
nstty *= inorm;
nsttz *= inorm;
}
if (aniso_flag) { if (aniso_flag) {
inorm = 1.0/sqrt(nax*nax + nay*nay + naz*naz); norm2 = nax*nax + nay*nay + naz*naz;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
nax *= inorm; nax *= inorm;
nay *= inorm; nay *= inorm;
naz *= inorm; naz *= inorm;
} }
if (cubic_flag) { if (cubic_flag) {
inorm = 1.0/sqrt(nc1x*nc1x + nc1y*nc1y + nc1z*nc1z); norm2 = nc1x*nc1x + nc1y*nc1y + nc1z*nc1z;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
nc1x *= inorm; nc1x *= inorm;
nc1y *= inorm; nc1y *= inorm;
nc1z *= inorm; nc1z *= inorm;
inorm = 1.0/sqrt(nc2x*nc2x + nc2y*nc2y + nc2z*nc2z);
norm2 = nc2x*nc2x + nc2y*nc2y + nc2z*nc2z;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
nc2x *= inorm; nc2x *= inorm;
nc2y *= inorm; nc2y *= inorm;
nc2z *= inorm; nc2z *= inorm;
inorm = 1.0/sqrt(nc3x*nc3x + nc3y*nc3y + nc3z*nc3z);
norm2 = nc3x*nc3x + nc3y*nc3y + nc3z*nc3z;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
nc3x *= inorm; nc3x *= inorm;
nc3y *= inorm; nc3y *= inorm;
nc3z *= inorm; nc3z *= inorm;
} }
if (hexaniso_flag) {
norm2 = n6x*n6x + n6y*n6y + n6z*n6z;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
n6x *= inorm;
n6y *= inorm;
n6z *= inorm;
norm2 = m6x*m6x + m6y*m6y + m6z*m6z;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
m6x *= inorm;
m6y *= inorm;
m6z *= inorm;
l6x = (n6z*m6y-n6y*m6z);
l6y = (n6x*m6z-n6z*m6x);
l6z = (n6y*m6x-n6x*m6y);
norm2 = l6x*l6x + l6y*l6y + l6z*l6z;
if (norm2 == 0.0)
error->all(FLERR,"Illegal precession/spin command");
inorm = 1.0/sqrt(norm2);
l6x *= inorm;
l6y *= inorm;
l6z *= inorm;
m6x = (l6z*n6y-l6y*n6z);
m6y = (l6x*n6z-l6z*n6x);
m6z = (l6y*n6x-l6x*n6y);
}
degree2rad = MY_PI/180.0; degree2rad = MY_PI/180.0;
time_origin = update->ntimestep; time_origin = update->ntimestep;
@ -185,6 +269,7 @@ void FixPrecessionSpin::init()
Kah = Ka/hbar; Kah = Ka/hbar;
k1ch = k1c/hbar; k1ch = k1c/hbar;
k2ch = k2c/hbar; k2ch = k2c/hbar;
K6h = K6/hbar;
if (utils::strmatch(update->integrate_style,"^respa")) { if (utils::strmatch(update->integrate_style,"^respa")) {
ilevel_respa = ((Respa *) update->integrate)->nlevels-1; ilevel_respa = ((Respa *) update->integrate)->nlevels-1;
@ -199,15 +284,6 @@ void FixPrecessionSpin::init()
error->all(FLERR,"Illegal precession/spin command"); error->all(FLERR,"Illegal precession/spin command");
} }
// check that fix precession/spin is only declared once
int iprec = 0;
for (int iforce = 0; iforce < modify->nfix; iforce++)
if (strstr(modify->fix[iforce]->style,"precession/spin")) iprec++;
if (iprec > 1)
error->all(FLERR,"precession/spin command can only be declared once");
varflag = CONSTANT; varflag = CONSTANT;
if (magfieldstyle != CONSTANT) varflag = EQUAL; if (magfieldstyle != CONSTANT) varflag = EQUAL;
@ -283,16 +359,26 @@ void FixPrecessionSpin::post_force(int /* vflag */)
epreci -= compute_zeeman_energy(spi); epreci -= compute_zeeman_energy(spi);
} }
if (stt_flag) { // compute Spin Transfer Torque
compute_stt(spi,fmi);
epreci -= compute_stt_energy(spi);
}
if (aniso_flag) { // compute magnetic anisotropy if (aniso_flag) { // compute magnetic anisotropy
compute_anisotropy(spi,fmi); compute_anisotropy(spi,fmi);
epreci -= compute_anisotropy_energy(spi); epreci -= compute_anisotropy_energy(spi);
} }
if (cubic_flag) { // compute cubic anisotropy if (cubic_flag) { // compute cubic anisotropy
compute_cubic(spi,fmi); compute_cubic(spi,fmi);
epreci -= compute_cubic_energy(spi); epreci -= compute_cubic_energy(spi);
} }
if (hexaniso_flag) { // compute hexagonal anisotropy
compute_hexaniso(spi,fmi);
epreci -= compute_hexaniso_energy(spi);
}
emag[i] += epreci; emag[i] += epreci;
eprec += epreci; eprec += epreci;
fm[i][0] += fmi[0]; fm[i][0] += fmi[0];
@ -309,12 +395,16 @@ void FixPrecessionSpin::compute_single_precession(int i, double spi[3], double f
int *mask = atom->mask; int *mask = atom->mask;
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (zeeman_flag) compute_zeeman(i,fmi); if (zeeman_flag) compute_zeeman(i,fmi);
if (stt_flag) compute_stt(spi,fmi);
if (aniso_flag) compute_anisotropy(spi,fmi); if (aniso_flag) compute_anisotropy(spi,fmi);
if (cubic_flag) compute_cubic(spi,fmi); if (cubic_flag) compute_cubic(spi,fmi);
if (hexaniso_flag) compute_hexaniso(spi,fmi);
} }
} }
/* ---------------------------------------------------------------------- */ /* ----------------------------------------------------------------------
Zeeman
------------------------------------------------------------------------- */
void FixPrecessionSpin::compute_zeeman(int i, double fmi[3]) void FixPrecessionSpin::compute_zeeman(int i, double fmi[3])
{ {
@ -334,8 +424,32 @@ double FixPrecessionSpin::compute_zeeman_energy(double spi[4])
return energy; return energy;
} }
/* ----------------------------------------------------------------------
STT
------------------------------------------------------------------------- */
void FixPrecessionSpin::compute_stt(double spi[3], double fmi[3])
{
double sx = spi[0];
double sy = spi[1];
double sz = spi[2];
fmi[0] += 1.0*stt_field*( sy*nsttz-sz*nstty);
fmi[1] += 1.0*stt_field*(-sx*nsttz+sz*nsttx);
fmi[2] += 1.0*stt_field*( sx*nstty-sy*nsttx);
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
double FixPrecessionSpin::compute_stt_energy(double spi[3])
{
double energy = 0.0; // Non-conservative force
return energy;
}
/* ----------------------------------------------------------------------
compute uniaxial anisotropy interaction for spin i
------------------------------------------------------------------------- */
void FixPrecessionSpin::compute_anisotropy(double spi[3], double fmi[3]) void FixPrecessionSpin::compute_anisotropy(double spi[3], double fmi[3])
{ {
double scalar = nax*spi[0] + nay*spi[1] + naz*spi[2]; double scalar = nax*spi[0] + nay*spi[1] + naz*spi[2];
@ -393,9 +507,7 @@ void FixPrecessionSpin::compute_cubic(double spi[3], double fmi[3])
fmi[2] += (fourz + sixz); fmi[2] += (fourz + sixz);
} }
/* ---------------------------------------------------------------------- /* ---------------------------------------------------------------------- */
compute cubic aniso energy of spin i
------------------------------------------------------------------------- */
double FixPrecessionSpin::compute_cubic_energy(double spi[3]) double FixPrecessionSpin::compute_cubic_energy(double spi[3])
{ {
@ -412,6 +524,62 @@ double FixPrecessionSpin::compute_cubic_energy(double spi[3])
return energy; return energy;
} }
/* ----------------------------------------------------------------------
compute hexagonal anisotropy interaction for spin i
------------------------------------------------------------------------- */
void FixPrecessionSpin::compute_hexaniso(double spi[3], double fmi[3])
{
double s_x,s_y,s_z;
double pf, phi, ssint2;
// changing to the axes' frame
s_x = l6x*spi[0]+l6y*spi[1]+l6z*spi[2];
s_y = m6x*spi[0]+m6y*spi[1]+m6z*spi[2];
s_z = n6x*spi[0]+n6y*spi[1]+n6z*spi[2];
// hexagonal anisotropy in the axes' frame
phi = atan2(s_y,s_x);
ssint2 = s_x*s_x + s_y*s_y; // s^2sin^2(theta)
pf = 6.0 * K6h * ssint2*ssint2*sqrt(ssint2); // 6*K_6*s^5*sin^5(theta)
double fm_x = pf*cos(5*phi);
double fm_y = -pf*sin(5*phi);
double fm_z = 0;
// back to the lab's frame
fmi[0] += fm_x*l6x+fm_y*m6x+fm_z*n6x;
fmi[1] += fm_x*l6y+fm_y*m6y+fm_z*n6y;
fmi[2] += fm_x*l6z+fm_y*m6z+fm_z*n6z;
}
/* ----------------------------------------------------------------------
compute hexagonal aniso energy of spin i
------------------------------------------------------------------------- */
double FixPrecessionSpin::compute_hexaniso_energy(double spi[3])
{
double energy = 0.0;
double s_x,s_y,s_z, phi,ssint2;
// changing to the axes' frame
s_x = l6x*spi[0]+l6y*spi[1]+l6z*spi[2];
s_y = m6x*spi[0]+m6y*spi[1]+m6z*spi[2];
s_z = n6x*spi[0]+n6y*spi[1]+n6z*spi[2];
// hexagonal anisotropy in the axes' frame
phi = atan2(s_y,s_z);
ssint2 = s_x*s_x + s_y*s_y;
energy = K6 * ssint2*ssint2*ssint2*cos(6*phi);
return 2.0*energy;
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixPrecessionSpin::set_magneticprecession() void FixPrecessionSpin::set_magneticprecession()
@ -421,6 +589,13 @@ void FixPrecessionSpin::set_magneticprecession()
hy = H_field*nhy; hy = H_field*nhy;
hz = H_field*nhz; hz = H_field*nhz;
} }
if (stt_flag) {
sttx = stt_field*nsttx;
stty = stt_field*nstty;
sttz = stt_field*nsttz;
}
if (aniso_flag) { if (aniso_flag) {
Kax = 2.0*Kah*nax; Kax = 2.0*Kah*nax;
Kay = 2.0*Kah*nay; Kay = 2.0*Kah*nay;

View File

@ -39,7 +39,7 @@ class FixPrecessionSpin : public Fix {
void min_post_force(int); void min_post_force(int);
double compute_scalar(); double compute_scalar();
int zeeman_flag, aniso_flag, cubic_flag; int zeeman_flag, stt_flag, aniso_flag, cubic_flag, hexaniso_flag;
void compute_single_precession(int, double *, double *); void compute_single_precession(int, double *, double *);
// zeeman calculations // zeeman calculations
@ -47,6 +47,11 @@ class FixPrecessionSpin : public Fix {
void compute_zeeman(int, double *); void compute_zeeman(int, double *);
double compute_zeeman_energy(double *); double compute_zeeman_energy(double *);
// stt calculations
void compute_stt(double *, double *);
double compute_stt_energy(double *);
// uniaxial aniso calculations // uniaxial aniso calculations
void compute_anisotropy(double *, double *); void compute_anisotropy(double *, double *);
@ -57,6 +62,11 @@ class FixPrecessionSpin : public Fix {
void compute_cubic(double *, double *); void compute_cubic(double *, double *);
double compute_cubic_energy(double *); double compute_cubic_energy(double *);
// hexagonal aniso calculations
void compute_hexaniso(double *, double *);
double compute_hexaniso_energy(double *);
// storing magnetic energies // storing magnetic energies
int nlocal_max; // max nlocal (for list size) int nlocal_max; // max nlocal (for list size)
@ -83,6 +93,12 @@ class FixPrecessionSpin : public Fix {
double nhx, nhy, nhz; double nhx, nhy, nhz;
double hx, hy, hz; // temp. force variables double hx, hy, hz; // temp. force variables
// STT intensity and direction
double stt_field;
double nsttx, nstty, nsttz;
double sttx, stty, sttz;
// magnetic anisotropy intensity and direction // magnetic anisotropy intensity and direction
double Ka; // aniso const. in eV double Ka; // aniso const. in eV
@ -98,6 +114,13 @@ class FixPrecessionSpin : public Fix {
double nc2x,nc2y,nc2z; double nc2x,nc2y,nc2z;
double nc3x,nc3y,nc3z; double nc3x,nc3y,nc3z;
// hexagonal anisotropy
double K6; // hexagonal aniso const. in eV
double K6h; // hexagonal aniso const. in rad.THz
double n6x,n6y,n6z; // main axis
double m6x,m6y,m6z; // secondary (perpendicular) axis
double l6x,l6y,l6z; // =(m x n)
void set_magneticprecession(); void set_magneticprecession();
}; };

View File

@ -71,21 +71,6 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp)
default_create = "id type mask image x v"; default_create = "id type mask image x v";
default_data_atom = ""; default_data_atom = "";
default_data_vel = ""; default_data_vel = "";
// initializations
init_method(&mgrow);
init_method(&mcopy);
init_method(&mcomm);
init_method(&mcomm_vel);
init_method(&mreverse);
init_method(&mborder);
init_method(&mborder_vel);
init_method(&mexchange);
init_method(&mrestart);
init_method(&mcreate);
init_method(&mdata_atom);
init_method(&mdata_vel);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -129,19 +114,6 @@ AtomVec::~AtomVec()
} }
} }
destroy_method(&mgrow);
destroy_method(&mcopy);
destroy_method(&mcomm);
destroy_method(&mcomm_vel);
destroy_method(&mreverse);
destroy_method(&mborder);
destroy_method(&mborder_vel);
destroy_method(&mexchange);
destroy_method(&mrestart);
destroy_method(&mcreate);
destroy_method(&mdata_atom);
destroy_method(&mdata_vel);
delete [] threads; delete [] threads;
} }
@ -2395,18 +2367,18 @@ void AtomVec::setup_fields()
// populate field-based data struct for each method to use // populate field-based data struct for each method to use
create_method(ngrow,&mgrow); init_method(ngrow,&mgrow);
create_method(ncopy,&mcopy); init_method(ncopy,&mcopy);
create_method(ncomm,&mcomm); init_method(ncomm,&mcomm);
create_method(ncomm_vel,&mcomm_vel); init_method(ncomm_vel,&mcomm_vel);
create_method(nreverse,&mreverse); init_method(nreverse,&mreverse);
create_method(nborder,&mborder); init_method(nborder,&mborder);
create_method(nborder_vel,&mborder_vel); init_method(nborder_vel,&mborder_vel);
create_method(nexchange,&mexchange); init_method(nexchange,&mexchange);
create_method(nrestart,&mrestart); init_method(nrestart,&mrestart);
create_method(ncreate,&mcreate); init_method(ncreate,&mcreate);
create_method(ndata_atom,&mdata_atom); init_method(ndata_atom,&mdata_atom);
create_method(ndata_vel,&mdata_vel); init_method(ndata_vel,&mdata_vel);
// create threads data struct for grow and memory_usage to use // create threads data struct for grow and memory_usage to use
@ -2480,7 +2452,6 @@ void AtomVec::setup_fields()
int AtomVec::process_fields(char *str, const char *default_str, Method *method) int AtomVec::process_fields(char *str, const char *default_str, Method *method)
{ {
if (str == nullptr) { if (str == nullptr) {
method->index = nullptr;
return 0; return 0;
} }
@ -2496,17 +2467,19 @@ int AtomVec::process_fields(char *str, const char *default_str, Method *method)
Atom::PerAtom *peratom = atom->peratom; Atom::PerAtom *peratom = atom->peratom;
int nperatom = atom->nperatom; int nperatom = atom->nperatom;
int *index; // allocate memory in method
method->resize(nfield);
std::vector<int> & index = method->index;
int match; int match;
if (nfield) index = new int[nfield];
for (int i = 0; i < nfield; i++) { for (int i = 0; i < nfield; i++) {
const char * field = words[i].c_str(); const std::string & field = words[i];
// find field in master Atom::peratom list // find field in master Atom::peratom list
for (match = 0; match < nperatom; match++) for (match = 0; match < nperatom; match++)
if (strcmp(field, peratom[match].name) == 0) break; if (field == peratom[match].name) break;
if (match == nperatom) if (match == nperatom)
error->all(FLERR,fmt::format("Peratom field {} not recognized", field)); error->all(FLERR,fmt::format("Peratom field {} not recognized", field));
index[i] = match; index[i] = match;
@ -2520,38 +2493,19 @@ int AtomVec::process_fields(char *str, const char *default_str, Method *method)
// error if field is in default str // error if field is in default str
for (match = 0; match < ndef; match++) for (match = 0; match < ndef; match++)
if (strcmp(field, def_words[match].c_str()) == 0) if (field == def_words[match])
error->all(FLERR,fmt::format("Peratom field {} is a default", field)); error->all(FLERR,fmt::format("Peratom field {} is a default", field));
} }
if (nfield) method->index = index;
else method->index = nullptr;
return nfield; return nfield;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
create a method data structs for processing fields init method data structs for processing fields
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVec::create_method(int nfield, Method *method) void AtomVec::init_method(int nfield, Method *method)
{ {
if (nfield > 0) {
method->pdata = new void*[nfield];
method->datatype = new int[nfield];
method->cols = new int[nfield];
method->maxcols = new int*[nfield];
method->collength = new int[nfield];
method->plength = new void*[nfield];
} else {
method->pdata = nullptr;
method->datatype = nullptr;
method->cols = nullptr;
method->maxcols = nullptr;
method->collength = nullptr;
method->plength = nullptr;
return;
}
for (int i = 0; i < nfield; i++) { for (int i = 0; i < nfield; i++) {
Atom::PerAtom *field = &atom->peratom[method->index[i]]; Atom::PerAtom *field = &atom->peratom[method->index[i]];
method->pdata[i] = (void *) field->address; method->pdata[i] = (void *) field->address;
@ -2566,31 +2520,15 @@ void AtomVec::create_method(int nfield, Method *method)
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
free memory in a method data structs Method class members
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void AtomVec::init_method(Method *method) void AtomVec::Method::resize(int nfield) {
{ pdata.resize(nfield);
method->pdata = nullptr; datatype.resize(nfield);
method->datatype = nullptr; cols.resize(nfield);
method->cols = nullptr; maxcols.resize(nfield);
method->maxcols = nullptr; collength.resize(nfield);
method->collength = nullptr; plength.resize(nfield);
method->plength = nullptr; index.resize(nfield);
method->index = nullptr;
}
/* ----------------------------------------------------------------------
free memory in a method data structs
------------------------------------------------------------------------- */
void AtomVec::destroy_method(Method *method)
{
delete [] method->pdata;
delete [] method->datatype;
delete [] method->cols;
delete [] method->maxcols;
delete [] method->collength;
delete [] method->plength;
delete [] method->index;
} }

View File

@ -191,13 +191,15 @@ class AtomVec : protected Pointers {
const char *default_create,*default_data_atom,*default_data_vel; const char *default_create,*default_data_atom,*default_data_vel;
struct Method { struct Method {
void **pdata; std::vector<void *> pdata;
int *datatype; std::vector<int> datatype;
int *cols; std::vector<int> cols;
int **maxcols; std::vector<int*> maxcols;
int *collength; std::vector<int> collength;
void **plength; std::vector<void *> plength;
int *index; std::vector<int> index;
void resize(int nfield);
}; };
Method mgrow,mcopy; Method mgrow,mcopy;
@ -219,9 +221,7 @@ class AtomVec : protected Pointers {
int grow_nmax_bonus(int); int grow_nmax_bonus(int);
void setup_fields(); void setup_fields();
int process_fields(char *, const char *, Method *); int process_fields(char *, const char *, Method *);
void create_method(int, Method *); void init_method(int, Method *);
void init_method(Method *);
void destroy_method(Method *);
}; };
} }

View File

@ -237,15 +237,12 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
else if (strcmp(arg[iarg+1],"y") == 0) idim = 1; else if (strcmp(arg[iarg+1],"y") == 0) idim = 1;
else if (strcmp(arg[iarg+1],"z") == 0) idim = 2; else if (strcmp(arg[iarg+1],"z") == 0) idim = 2;
else error->all(FLERR,"Illegal compute chunk/atom command"); else error->all(FLERR,"Illegal compute chunk/atom command");
minflag[idim] = COORD;
if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER; if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER;
else minflag[idim] = COORD; else minvalue[idim] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (minflag[idim] == COORD) maxflag[idim] = COORD;
minvalue[idim] = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER; if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER;
else maxflag[idim] = COORD; else maxvalue[idim] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (maxflag[idim] == COORD)
maxvalue[idim] = utils::numeric(FLERR,arg[iarg+3],false,lmp);
else error->all(FLERR,"Illegal compute chunk/atom command");
iarg += 4; iarg += 4;
} else if (strcmp(arg[iarg],"units") == 0) { } else if (strcmp(arg[iarg],"units") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command");

View File

@ -36,8 +36,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 1024
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
Force::Force(LAMMPS *lmp) : Pointers(lmp) Force::Force(LAMMPS *lmp) : Pointers(lmp)

View File

@ -30,11 +30,13 @@
#include "region.h" #include "region.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "variable.h" #include "variable.h"
#include "exceptions.h"
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#include <map> #include <map>
#include <utility> #include <utility>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -151,12 +153,14 @@ void Group::assign(int narg, char **arg)
// add a new group if igroup = -1 // add a new group if igroup = -1
int igroup = find(arg[0]); int igroup = find(arg[0]);
bool created = false;
if (igroup == -1) { if (igroup == -1) {
if (ngroup == MAX_GROUP) error->all(FLERR,"Too many groups"); if (ngroup == MAX_GROUP) error->all(FLERR,"Too many groups");
igroup = find_unused(); igroup = find_unused();
names[igroup] = utils::strdup(arg[0]); names[igroup] = utils::strdup(arg[0]);
ngroup++; ngroup++;
created = true;
} }
double **x = atom->x; double **x = atom->x;
@ -164,355 +168,360 @@ void Group::assign(int narg, char **arg)
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
int bit = bitmask[igroup]; int bit = bitmask[igroup];
// style = region try {
// add to group if atom is in region // style = region
// add to group if atom is in region
if (strcmp(arg[1],"region") == 0) { if (strcmp(arg[1],"region") == 0) {
if (narg != 3) error->all(FLERR,"Illegal group command"); if (narg != 3) error->all(FLERR,"Illegal group command");
int iregion = domain->find_region(arg[2]); int iregion = domain->find_region(arg[2]);
if (iregion == -1) error->all(FLERR,"Group region ID does not exist"); if (iregion == -1) error->all(FLERR,"Group region ID does not exist");
domain->regions[iregion]->init(); domain->regions[iregion]->init();
domain->regions[iregion]->prematch(); domain->regions[iregion]->prematch();
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
mask[i] |= bit; mask[i] |= bit;
// create an empty group // create an empty group
} else if (strcmp(arg[1],"empty") == 0) { } else if (strcmp(arg[1],"empty") == 0) {
if (narg != 2) error->all(FLERR,"Illegal group command"); if (narg != 2) error->all(FLERR,"Illegal group command");
// nothing else to do here // nothing else to do here
// style = type, molecule, id // style = type, molecule, id
// add to group if atom matches type/molecule/id or condition // add to group if atom matches type/molecule/id or condition
} else if (strcmp(arg[1],"type") == 0 || strcmp(arg[1],"molecule") == 0 || } else if (strcmp(arg[1],"type") == 0 || strcmp(arg[1],"molecule") == 0 ||
strcmp(arg[1],"id") == 0) { strcmp(arg[1],"id") == 0) {
if (narg < 3) error->all(FLERR,"Illegal group command"); if (narg < 3) error->all(FLERR,"Illegal group command");
int category=NONE; int category=NONE;
if (strcmp(arg[1],"type") == 0) category = TYPE; if (strcmp(arg[1],"type") == 0) category = TYPE;
else if (strcmp(arg[1],"molecule") == 0) category = MOLECULE; else if (strcmp(arg[1],"molecule") == 0) category = MOLECULE;
else if (strcmp(arg[1],"id") == 0) category = ID; else if (strcmp(arg[1],"id") == 0) category = ID;
if ((category == MOLECULE) && (!atom->molecule_flag)) if ((category == MOLECULE) && (!atom->molecule_flag))
error->all(FLERR,"Group command requires atom attribute molecule");
if ((category == ID) && (!atom->tag_enable))
error->all(FLERR,"Group command requires atom IDs");
// args = logical condition
if (narg > 3 &&
(strcmp(arg[2],"<") == 0 || strcmp(arg[2],">") == 0 ||
strcmp(arg[2],"<=") == 0 || strcmp(arg[2],">=") == 0 ||
strcmp(arg[2],"==") == 0 || strcmp(arg[2],"!=") == 0 ||
strcmp(arg[2],"<>") == 0)) {
int condition = -1;
if (strcmp(arg[2],"<") == 0) condition = LT;
else if (strcmp(arg[2],"<=") == 0) condition = LE;
else if (strcmp(arg[2],">") == 0) condition = GT;
else if (strcmp(arg[2],">=") == 0) condition = GE;
else if (strcmp(arg[2],"==") == 0) condition = EQ;
else if (strcmp(arg[2],"!=") == 0) condition = NEQ;
else if (strcmp(arg[2],"<>") == 0) condition = BETWEEN;
else error->all(FLERR,"Illegal group command");
tagint bound1,bound2;
bound1 = utils::tnumeric(FLERR,arg[3],false,lmp);
bound2 = -1;
if (condition == BETWEEN) {
if (narg != 5) error->all(FLERR,"Illegal group command");
bound2 = utils::tnumeric(FLERR,arg[4],false,lmp);
} else if (narg != 4) error->all(FLERR,"Illegal group command");
int *attribute = nullptr;
tagint *tattribute = nullptr;
if (category == TYPE) attribute = atom->type;
else if (category == MOLECULE) tattribute = atom->molecule;
else if (category == ID) tattribute = atom->tag;
// add to group if meets condition
if (attribute) {
if (condition == LT) {
for (i = 0; i < nlocal; i++)
if (attribute[i] < bound1) mask[i] |= bit;
} else if (condition == LE) {
for (i = 0; i < nlocal; i++)
if (attribute[i] <= bound1) mask[i] |= bit;
} else if (condition == GT) {
for (i = 0; i < nlocal; i++)
if (attribute[i] > bound1) mask[i] |= bit;
} else if (condition == GE) {
for (i = 0; i < nlocal; i++)
if (attribute[i] >= bound1) mask[i] |= bit;
} else if (condition == EQ) {
for (i = 0; i < nlocal; i++)
if (attribute[i] == bound1) mask[i] |= bit;
} else if (condition == NEQ) {
for (i = 0; i < nlocal; i++)
if (attribute[i] != bound1) mask[i] |= bit;
} else if (condition == BETWEEN) {
for (i = 0; i < nlocal; i++)
if (attribute[i] >= bound1 && attribute[i] <= bound2)
mask[i] |= bit;
}
} else {
if (condition == LT) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] < bound1) mask[i] |= bit;
} else if (condition == LE) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] <= bound1) mask[i] |= bit;
} else if (condition == GT) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] > bound1) mask[i] |= bit;
} else if (condition == GE) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] >= bound1) mask[i] |= bit;
} else if (condition == EQ) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] == bound1) mask[i] |= bit;
} else if (condition == NEQ) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] != bound1) mask[i] |= bit;
} else if (condition == BETWEEN) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] >= bound1 && tattribute[i] <= bound2)
mask[i] |= bit;
}
}
// args = list of values
} else {
int *attribute = nullptr;
tagint *tattribute = nullptr;
if (category == TYPE) attribute = atom->type;
else if (category == MOLECULE) tattribute = atom->molecule;
else if (category == ID) tattribute = atom->tag;
tagint start,stop,delta;
for (int iarg = 2; iarg < narg; iarg++) {
delta = 1;
try {
ValueTokenizer values(arg[iarg],":");
start = values.next_tagint();
if (utils::strmatch(arg[iarg],"^-?\\d+$")) {
stop = start;
} else if (utils::strmatch(arg[iarg],"^-?\\d+:-?\\d+$")) {
stop = values.next_tagint();
} else if (utils::strmatch(arg[iarg],"^-?\\d+:-?\\d+:\\d+$")) {
stop = values.next_tagint();
delta = values.next_tagint();
} else throw TokenizerException("Syntax error","");
} catch (TokenizerException &e) {
error->all(FLERR,fmt::format("Incorrect range string "
"'{}': {}",arg[iarg],e.what()));
}
if (delta < 1)
error->all(FLERR,"Illegal range increment value");
// add to group if attribute matches value or sequence
if (attribute) {
for (i = 0; i < nlocal; i++)
if (attribute[i] >= start && attribute[i] <= stop &&
(attribute[i]-start) % delta == 0) mask[i] |= bit;
} else {
for (i = 0; i < nlocal; i++)
if (tattribute[i] >= start && tattribute[i] <= stop &&
(tattribute[i]-start) % delta == 0) mask[i] |= bit;
}
}
}
// style = variable
// add to group if atom-atyle variable is non-zero
} else if (strcmp(arg[1],"variable") == 0) {
int ivar = input->variable->find(arg[2]);
if (ivar < 0) error->all(FLERR,"Variable name for group does not exist");
if (!input->variable->atomstyle(ivar))
error->all(FLERR,"Variable for group is invalid style");
double *aflag;
// aflag = evaluation of per-atom variable
memory->create(aflag,nlocal,"group:aflag");
input->variable->compute_atom(ivar,0,aflag,1,0);
// add to group if per-atom variable evaluated to non-zero
for (i = 0; i < nlocal; i++)
if (aflag[i] != 0.0) mask[i] |= bit;
memory->destroy(aflag);
// style = include
} else if (strcmp(arg[1],"include") == 0) {
if (narg != 3) error->all(FLERR,"Illegal group command");
if (strcmp(arg[2],"molecule") == 0) {
if (!atom->molecule_flag)
error->all(FLERR,"Group command requires atom attribute molecule"); error->all(FLERR,"Group command requires atom attribute molecule");
add_molecules(igroup,bit); if ((category == ID) && (!atom->tag_enable))
error->all(FLERR,"Group command requires atom IDs");
// args = logical condition
if (narg > 3 &&
(strcmp(arg[2],"<") == 0 || strcmp(arg[2],">") == 0 ||
strcmp(arg[2],"<=") == 0 || strcmp(arg[2],">=") == 0 ||
strcmp(arg[2],"==") == 0 || strcmp(arg[2],"!=") == 0 ||
strcmp(arg[2],"<>") == 0)) {
int condition = -1;
if (strcmp(arg[2],"<") == 0) condition = LT;
else if (strcmp(arg[2],"<=") == 0) condition = LE;
else if (strcmp(arg[2],">") == 0) condition = GT;
else if (strcmp(arg[2],">=") == 0) condition = GE;
else if (strcmp(arg[2],"==") == 0) condition = EQ;
else if (strcmp(arg[2],"!=") == 0) condition = NEQ;
else if (strcmp(arg[2],"<>") == 0) condition = BETWEEN;
else error->all(FLERR,"Illegal group command");
tagint bound1,bound2;
bound1 = utils::tnumeric(FLERR,arg[3],false,lmp);
bound2 = -1;
if (condition == BETWEEN) {
if (narg != 5) error->all(FLERR,"Illegal group command");
bound2 = utils::tnumeric(FLERR,arg[4],false,lmp);
} else if (narg != 4) error->all(FLERR,"Illegal group command");
int *attribute = nullptr;
tagint *tattribute = nullptr;
if (category == TYPE) attribute = atom->type;
else if (category == MOLECULE) tattribute = atom->molecule;
else if (category == ID) tattribute = atom->tag;
// add to group if meets condition
if (attribute) {
if (condition == LT) {
for (i = 0; i < nlocal; i++)
if (attribute[i] < bound1) mask[i] |= bit;
} else if (condition == LE) {
for (i = 0; i < nlocal; i++)
if (attribute[i] <= bound1) mask[i] |= bit;
} else if (condition == GT) {
for (i = 0; i < nlocal; i++)
if (attribute[i] > bound1) mask[i] |= bit;
} else if (condition == GE) {
for (i = 0; i < nlocal; i++)
if (attribute[i] >= bound1) mask[i] |= bit;
} else if (condition == EQ) {
for (i = 0; i < nlocal; i++)
if (attribute[i] == bound1) mask[i] |= bit;
} else if (condition == NEQ) {
for (i = 0; i < nlocal; i++)
if (attribute[i] != bound1) mask[i] |= bit;
} else if (condition == BETWEEN) {
for (i = 0; i < nlocal; i++)
if (attribute[i] >= bound1 && attribute[i] <= bound2)
mask[i] |= bit;
}
} else {
if (condition == LT) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] < bound1) mask[i] |= bit;
} else if (condition == LE) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] <= bound1) mask[i] |= bit;
} else if (condition == GT) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] > bound1) mask[i] |= bit;
} else if (condition == GE) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] >= bound1) mask[i] |= bit;
} else if (condition == EQ) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] == bound1) mask[i] |= bit;
} else if (condition == NEQ) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] != bound1) mask[i] |= bit;
} else if (condition == BETWEEN) {
for (i = 0; i < nlocal; i++)
if (tattribute[i] >= bound1 && tattribute[i] <= bound2)
mask[i] |= bit;
}
}
// args = list of values
} else {
int *attribute = nullptr;
tagint *tattribute = nullptr;
if (category == TYPE) attribute = atom->type;
else if (category == MOLECULE) tattribute = atom->molecule;
else if (category == ID) tattribute = atom->tag;
tagint start,stop,delta;
for (int iarg = 2; iarg < narg; iarg++) {
delta = 1;
try {
ValueTokenizer values(arg[iarg],":");
start = values.next_tagint();
if (utils::strmatch(arg[iarg],"^-?\\d+$")) {
stop = start;
} else if (utils::strmatch(arg[iarg],"^-?\\d+:-?\\d+$")) {
stop = values.next_tagint();
} else if (utils::strmatch(arg[iarg],"^-?\\d+:-?\\d+:\\d+$")) {
stop = values.next_tagint();
delta = values.next_tagint();
} else throw TokenizerException("Syntax error","");
} catch (TokenizerException &e) {
error->all(FLERR,fmt::format("Incorrect range string "
"'{}': {}",arg[iarg],e.what()));
}
if (delta < 1)
error->all(FLERR,"Illegal range increment value");
// add to group if attribute matches value or sequence
if (attribute) {
for (i = 0; i < nlocal; i++)
if (attribute[i] >= start && attribute[i] <= stop &&
(attribute[i]-start) % delta == 0) mask[i] |= bit;
} else {
for (i = 0; i < nlocal; i++)
if (tattribute[i] >= start && tattribute[i] <= stop &&
(tattribute[i]-start) % delta == 0) mask[i] |= bit;
}
}
}
// style = variable
// add to group if atom-atyle variable is non-zero
} else if (strcmp(arg[1],"variable") == 0) {
int ivar = input->variable->find(arg[2]);
if (ivar < 0) error->all(FLERR,"Variable name for group does not exist");
if (!input->variable->atomstyle(ivar))
error->all(FLERR,"Variable for group is invalid style");
double *aflag;
// aflag = evaluation of per-atom variable
memory->create(aflag,nlocal,"group:aflag");
input->variable->compute_atom(ivar,0,aflag,1,0);
// add to group if per-atom variable evaluated to non-zero
for (i = 0; i < nlocal; i++)
if (aflag[i] != 0.0) mask[i] |= bit;
memory->destroy(aflag);
// style = include
} else if (strcmp(arg[1],"include") == 0) {
if (narg != 3) error->all(FLERR,"Illegal group command");
if (strcmp(arg[2],"molecule") == 0) {
if (!atom->molecule_flag)
error->all(FLERR,"Group command requires atom attribute molecule");
add_molecules(igroup,bit);
} else error->all(FLERR,"Illegal group command");
// style = subtract
} else if (strcmp(arg[1],"subtract") == 0) {
if (narg < 4) error->all(FLERR,"Illegal group command");
int length = narg-2;
std::vector<int> list(length);
int jgroup;
for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist");
if (dynamic[jgroup])
error->all(FLERR,"Cannot subtract groups using a dynamic group");
list[iarg-2] = jgroup;
}
// add to group if in 1st group in list
int otherbit = bitmask[list[0]];
for (i = 0; i < nlocal; i++)
if (mask[i] & otherbit) mask[i] |= bit;
// remove atoms if they are in any of the other groups
// AND with inverse mask removes the atom from group
int inverse = inversemask[igroup];
for (int ilist = 1; ilist < length; ilist++) {
otherbit = bitmask[list[ilist]];
for (i = 0; i < nlocal; i++)
if (mask[i] & otherbit) mask[i] &= inverse;
}
// style = union
} else if (strcmp(arg[1],"union") == 0) {
if (narg < 3) error->all(FLERR,"Illegal group command");
int length = narg-2;
std::vector<int> list(length);
int jgroup;
for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist");
if (dynamic[jgroup])
error->all(FLERR,"Cannot union groups using a dynamic group");
list[iarg-2] = jgroup;
}
// add to group if in any other group in list
int otherbit;
for (int ilist = 0; ilist < length; ilist++) {
otherbit = bitmask[list[ilist]];
for (i = 0; i < nlocal; i++)
if (mask[i] & otherbit) mask[i] |= bit;
}
// style = intersect
} else if (strcmp(arg[1],"intersect") == 0) {
if (narg < 4) error->all(FLERR,"Illegal group command");
int length = narg-2;
std::vector<int> list(length);
int jgroup;
for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist");
if (dynamic[jgroup])
error->all(FLERR,"Cannot intersect groups using a dynamic group");
list[iarg-2] = jgroup;
}
// add to group if in all groups in list
int otherbit,ok,ilist;
for (i = 0; i < nlocal; i++) {
ok = 1;
for (ilist = 0; ilist < length; ilist++) {
otherbit = bitmask[list[ilist]];
if ((mask[i] & otherbit) == 0) ok = 0;
}
if (ok) mask[i] |= bit;
}
// style = dynamic
// create a new FixGroup to dynamically determine atoms in group
} else if (strcmp(arg[1],"dynamic") == 0) {
if (narg < 4) error->all(FLERR,"Illegal group command");
if (strcmp(arg[0],arg[2]) == 0)
error->all(FLERR,"Group dynamic cannot reference itself");
if (find(arg[2]) < 0)
error->all(FLERR,"Group dynamic parent group does not exist");
if (igroup == 0) error->all(FLERR,"Group all cannot be made dynamic");
// if group is already dynamic, delete existing FixGroup
if (dynamic[igroup])
modify->delete_fix(std::string("GROUP_") + names[igroup]);
dynamic[igroup] = 1;
std::string fixcmd = "GROUP_";
fixcmd += fmt::format("{} {} GROUP",names[igroup],arg[2]);
for (int i = 3; i < narg; i++) fixcmd += std::string(" ") + arg[i];
modify->add_fix(fixcmd);
// style = static
// remove dynamic FixGroup if necessary
} else if (strcmp(arg[1],"static") == 0) {
if (narg != 2) error->all(FLERR,"Illegal group command");
if (dynamic[igroup])
modify->delete_fix(std::string("GROUP_") + names[igroup]);
dynamic[igroup] = 0;
// not a valid group style
} else error->all(FLERR,"Illegal group command"); } else error->all(FLERR,"Illegal group command");
// style = subtract } catch (LAMMPSException & e) {
// undo created group in case of an error
} else if (strcmp(arg[1],"subtract") == 0) { if (created) {
delete [] names[igroup];
if (narg < 4) error->all(FLERR,"Illegal group command"); names[igroup] = nullptr;
ngroup--;
int length = narg-2;
int *list = new int[length];
int jgroup;
for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist");
if (dynamic[jgroup])
error->all(FLERR,"Cannot subtract groups using a dynamic group");
list[iarg-2] = jgroup;
} }
throw e;
// add to group if in 1st group in list }
int otherbit = bitmask[list[0]];
for (i = 0; i < nlocal; i++)
if (mask[i] & otherbit) mask[i] |= bit;
// remove atoms if they are in any of the other groups
// AND with inverse mask removes the atom from group
int inverse = inversemask[igroup];
for (int ilist = 1; ilist < length; ilist++) {
otherbit = bitmask[list[ilist]];
for (i = 0; i < nlocal; i++)
if (mask[i] & otherbit) mask[i] &= inverse;
}
delete [] list;
// style = union
} else if (strcmp(arg[1],"union") == 0) {
if (narg < 3) error->all(FLERR,"Illegal group command");
int length = narg-2;
int *list = new int[length];
int jgroup;
for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist");
if (dynamic[jgroup])
error->all(FLERR,"Cannot union groups using a dynamic group");
list[iarg-2] = jgroup;
}
// add to group if in any other group in list
int otherbit;
for (int ilist = 0; ilist < length; ilist++) {
otherbit = bitmask[list[ilist]];
for (i = 0; i < nlocal; i++)
if (mask[i] & otherbit) mask[i] |= bit;
}
delete [] list;
// style = intersect
} else if (strcmp(arg[1],"intersect") == 0) {
if (narg < 4) error->all(FLERR,"Illegal group command");
int length = narg-2;
int *list = new int[length];
int jgroup;
for (int iarg = 2; iarg < narg; iarg++) {
jgroup = find(arg[iarg]);
if (jgroup == -1) error->all(FLERR,"Group ID does not exist");
if (dynamic[jgroup])
error->all(FLERR,"Cannot intersect groups using a dynamic group");
list[iarg-2] = jgroup;
}
// add to group if in all groups in list
int otherbit,ok,ilist;
for (i = 0; i < nlocal; i++) {
ok = 1;
for (ilist = 0; ilist < length; ilist++) {
otherbit = bitmask[list[ilist]];
if ((mask[i] & otherbit) == 0) ok = 0;
}
if (ok) mask[i] |= bit;
}
delete [] list;
// style = dynamic
// create a new FixGroup to dynamically determine atoms in group
} else if (strcmp(arg[1],"dynamic") == 0) {
if (narg < 4) error->all(FLERR,"Illegal group command");
if (strcmp(arg[0],arg[2]) == 0)
error->all(FLERR,"Group dynamic cannot reference itself");
if (find(arg[2]) < 0)
error->all(FLERR,"Group dynamic parent group does not exist");
if (igroup == 0) error->all(FLERR,"Group all cannot be made dynamic");
// if group is already dynamic, delete existing FixGroup
if (dynamic[igroup])
modify->delete_fix(std::string("GROUP_") + names[igroup]);
dynamic[igroup] = 1;
std::string fixcmd = "GROUP_";
fixcmd += fmt::format("{} {} GROUP",names[igroup],arg[2]);
for (int i = 3; i < narg; i++) fixcmd += std::string(" ") + arg[i];
modify->add_fix(fixcmd);
// style = static
// remove dynamic FixGroup if necessary
} else if (strcmp(arg[1],"static") == 0) {
if (narg != 2) error->all(FLERR,"Illegal group command");
if (dynamic[igroup])
modify->delete_fix(std::string("GROUP_") + names[igroup]);
dynamic[igroup] = 0;
// not a valid group style
} else error->all(FLERR,"Illegal group command");
// print stats for changed group // print stats for changed group
@ -539,13 +548,12 @@ void Group::assign(int narg, char **arg)
void Group::assign(const std::string &groupcmd) void Group::assign(const std::string &groupcmd)
{ {
auto args = utils::split_words(groupcmd); auto args = utils::split_words(groupcmd);
char **newarg = new char*[args.size()]; std::vector<char*> newarg(args.size());
int i=0; int i=0;
for (const auto &arg : args) { for (const auto &arg : args) {
newarg[i++] = (char *)arg.c_str(); newarg[i++] = (char *)arg.c_str();
} }
assign(args.size(),newarg); assign(args.size(),newarg.data());
delete[] newarg;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -964,13 +964,12 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
void Modify::add_fix(const std::string &fixcmd, int trysuffix) void Modify::add_fix(const std::string &fixcmd, int trysuffix)
{ {
auto args = utils::split_words(fixcmd); auto args = utils::split_words(fixcmd);
char **newarg = new char*[args.size()]; std::vector<char *> newarg(args.size());
int i=0; int i = 0;
for (const auto &arg : args) { for (const auto &arg : args) {
newarg[i++] = (char *)arg.c_str(); newarg[i++] = (char *)arg.c_str();
} }
add_fix(args.size(),newarg,trysuffix); add_fix(args.size(),newarg.data(),trysuffix);
delete[] newarg;
} }

View File

@ -36,7 +36,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
#define MAXLINE 1024
#define DELTA 4 #define DELTA 4
#define PGDELTA 1 #define PGDELTA 1
#define MAXNEIGH 24 #define MAXNEIGH 24

View File

@ -547,6 +547,15 @@ void PairHybrid::init_style()
if (used == 0) error->all(FLERR,"Pair hybrid sub-style is not used"); if (used == 0) error->all(FLERR,"Pair hybrid sub-style is not used");
} }
// The GPU library uses global data for each pair style, so the
// same style must not be used multiple times
for (istyle = 0; istyle < nstyles; istyle++) {
bool is_gpu = (((PairHybrid *)styles[istyle])->suffix_flag & Suffix::GPU);
if (multiple[istyle] && is_gpu)
error->all(FLERR,"GPU package styles must not be used multiple times");
}
// check if special_lj/special_coul overrides are compatible // check if special_lj/special_coul overrides are compatible
for (istyle = 0; istyle < nstyles; istyle++) { for (istyle = 0; istyle < nstyles; istyle++) {

View File

@ -27,8 +27,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define MAXLINE 2048
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
Run::Run(LAMMPS *lmp) : Command(lmp) {} Run::Run(LAMMPS *lmp) : Command(lmp) {}

View File

@ -412,7 +412,7 @@ void Variable::set(int narg, char **arg)
if (style[ivar] != EQUAL) if (style[ivar] != EQUAL)
error->all(FLERR,"Cannot redefine variable as a different style"); error->all(FLERR,"Cannot redefine variable as a different style");
delete [] data[ivar][0]; delete [] data[ivar][0];
copy(1,&arg[2],data[ivar]); data[ivar][0] = utils::strdup(arg[2]);
replaceflag = 1; replaceflag = 1;
} else { } else {
if (nvar == maxvar) grow(); if (nvar == maxvar) grow();
@ -421,7 +421,7 @@ void Variable::set(int narg, char **arg)
which[nvar] = 0; which[nvar] = 0;
pad[nvar] = 0; pad[nvar] = 0;
data[nvar] = new char*[num[nvar]]; data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]); data[nvar][0] = utils::strdup(arg[2]);
data[nvar][1] = new char[VALUELENGTH]; data[nvar][1] = new char[VALUELENGTH];
strcpy(data[nvar][1],"(undefined)"); strcpy(data[nvar][1],"(undefined)");
} }
@ -438,7 +438,7 @@ void Variable::set(int narg, char **arg)
if (style[ivar] != ATOM) if (style[ivar] != ATOM)
error->all(FLERR,"Cannot redefine variable as a different style"); error->all(FLERR,"Cannot redefine variable as a different style");
delete [] data[ivar][0]; delete [] data[ivar][0];
copy(1,&arg[2],data[ivar]); data[ivar][0] = utils::strdup(arg[2]);
replaceflag = 1; replaceflag = 1;
} else { } else {
if (nvar == maxvar) grow(); if (nvar == maxvar) grow();
@ -447,7 +447,7 @@ void Variable::set(int narg, char **arg)
which[nvar] = 0; which[nvar] = 0;
pad[nvar] = 0; pad[nvar] = 0;
data[nvar] = new char*[num[nvar]]; data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]); data[nvar][0] = utils::strdup(arg[2]);
} }
// VECTOR // VECTOR
@ -462,7 +462,7 @@ void Variable::set(int narg, char **arg)
if (style[ivar] != VECTOR) if (style[ivar] != VECTOR)
error->all(FLERR,"Cannot redefine variable as a different style"); error->all(FLERR,"Cannot redefine variable as a different style");
delete [] data[ivar][0]; delete [] data[ivar][0];
copy(1,&arg[2],data[ivar]); data[ivar][0] = utils::strdup(arg[2]);
replaceflag = 1; replaceflag = 1;
} else { } else {
if (nvar == maxvar) grow(); if (nvar == maxvar) grow();
@ -471,7 +471,7 @@ void Variable::set(int narg, char **arg)
which[nvar] = 0; which[nvar] = 0;
pad[nvar] = 0; pad[nvar] = 0;
data[nvar] = new char*[num[nvar]]; data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]); data[nvar][0] = utils::strdup(arg[2]);
} }
// PYTHON // PYTHON
@ -488,7 +488,7 @@ void Variable::set(int narg, char **arg)
if (style[ivar] != PYTHON) if (style[ivar] != PYTHON)
error->all(FLERR,"Cannot redefine variable as a different style"); error->all(FLERR,"Cannot redefine variable as a different style");
delete [] data[ivar][0]; delete [] data[ivar][0];
copy(1,&arg[2],data[ivar]); data[ivar][0] = utils::strdup(arg[2]);
replaceflag = 1; replaceflag = 1;
} else { } else {
if (nvar == maxvar) grow(); if (nvar == maxvar) grow();
@ -497,7 +497,7 @@ void Variable::set(int narg, char **arg)
which[nvar] = 1; which[nvar] = 1;
pad[nvar] = 0; pad[nvar] = 0;
data[nvar] = new char*[num[nvar]]; data[nvar] = new char*[num[nvar]];
copy(1,&arg[2],data[nvar]); data[nvar][0] = utils::strdup(arg[2]);
data[nvar][1] = new char[VALUELENGTH]; data[nvar][1] = new char[VALUELENGTH];
strcpy(data[nvar][1],"(undefined)"); strcpy(data[nvar][1],"(undefined)");
} }

View File

@ -7,6 +7,7 @@ add_test(NAME RunLammps
COMMAND $<TARGET_FILE:lmp> -log none -echo none -in in.empty COMMAND $<TARGET_FILE:lmp> -log none -echo none -in in.empty
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(RunLammps PROPERTIES set_tests_properties(RunLammps PROPERTIES
ENVIRONMENT "TSAN_OPTIONS='ignore_noninstrumented_modules=1'"
PASS_REGULAR_EXPRESSION "^LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]\\)") PASS_REGULAR_EXPRESSION "^LAMMPS \\([0-9]+ [A-Za-z]+ 2[0-9][0-9][0-9]\\)")
if(BUILD_MPI) if(BUILD_MPI)

View File

@ -56,3 +56,10 @@ add_executable(test_reset_ids test_reset_ids.cpp)
target_compile_definitions(test_reset_ids PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}) target_compile_definitions(test_reset_ids PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_reset_ids PRIVATE lammps GTest::GMock GTest::GTest) target_link_libraries(test_reset_ids PRIVATE lammps GTest::GMock GTest::GTest)
add_test(NAME ResetIDs COMMAND test_reset_ids WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_test(NAME ResetIDs COMMAND test_reset_ids WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(BUILD_MPI)
add_executable(test_mpi_load_balancing test_mpi_load_balancing.cpp)
target_link_libraries(test_mpi_load_balancing PRIVATE lammps GTest::GTest GTest::GMock)
target_compile_definitions(test_mpi_load_balancing PRIVATE ${TEST_CONFIG_DEFS})
add_mpi_test(NAME MPILoadBalancing NUM_PROCS 4 COMMAND $<TARGET_FILE:test_mpi_load_balancing>)
endif()

View File

@ -297,7 +297,7 @@ TEST_F(GroupTest, Dynamic)
command("group grow delete"); command("group grow delete");
command("variable ramp equal step"); command("variable ramp equal step");
END_HIDE_OUTPUT(); END_HIDE_OUTPUT();
ASSERT_EQ(group->ngroup, 4); ASSERT_EQ(group->ngroup, 3);
TEST_FAILURE(".*ERROR: Group dynamic cannot reference itself.*", TEST_FAILURE(".*ERROR: Group dynamic cannot reference itself.*",
command("group half dynamic half region top");); command("group half dynamic half region top"););

View File

@ -0,0 +1,257 @@
// unit tests for checking LAMMPS MPI load balancing
#define LAMMPS_LIB_MPI 1
#include "lammps.h"
#include "atom.h"
#include "comm.h"
#include "domain.h"
#include "neighbor.h"
#include "input.h"
#include "timer.h"
#include "info.h"
#include <string>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "../testing/test_mpi_main.h"
using ::testing::ExitedWithCode;
using ::testing::HasSubstr;
using ::testing::StartsWith;
using ::testing::StrEq;
namespace LAMMPS_NS
{
class MPILoadBalanceTest : public ::testing::Test {
public:
void command(const std::string &line) { lmp->input->one(line); }
protected:
const char *testbinary = "LAMMPSTest";
LAMMPS *lmp;
void SetUp() override
{
const char *args[] = {testbinary, "-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);
InitSystem();
if (!verbose) ::testing::internal::GetCapturedStdout();
}
virtual void InitSystem()
{
command("boundary f f f");
command("units lj");
command("atom_style atomic");
command("atom_modify map yes");
command("region box block 0 20 0 20 0 20");
command("create_box 1 box");
command("mass 1 1.0");
command("pair_style lj/cut 2.5");
command("pair_coeff 1 1 1.0 1.0 2.5");
command("neighbor 0.3 bin");
command("neigh_modify every 20 delay 0 check no");
}
void TearDown() override
{
if (!verbose) ::testing::internal::CaptureStdout();
delete lmp;
lmp = nullptr;
if (!verbose) ::testing::internal::GetCapturedStdout();
}
};
TEST_F(MPILoadBalanceTest, grid_yz)
{
command("create_atoms 1 single 0 0 0");
command("create_atoms 1 single 0 0 5");
command("create_atoms 1 single 0 5 0");
command("create_atoms 1 single 0 5 5");
command("create_atoms 1 single 5 0 0");
command("create_atoms 1 single 5 0 5");
command("create_atoms 1 single 5 5 0");
command("create_atoms 1 single 5 5 5");
ASSERT_EQ(lmp->atom->natoms, 8);
ASSERT_EQ(lmp->comm->nprocs, 4);
// initial state
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
command("balance 1 x uniform y 0.125 z uniform");
// state after balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 4);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 4);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
command("balance 1 x uniform y 0.125 z 0.125");
// state after second balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
}
}
TEST_F(MPILoadBalanceTest, rcb)
{
command("comm_style tiled");
command("create_atoms 1 single 0 0 0");
command("create_atoms 1 single 0 0 5");
command("create_atoms 1 single 0 5 0");
command("create_atoms 1 single 0 5 5");
command("create_atoms 1 single 5 0 0");
command("create_atoms 1 single 5 0 5");
command("create_atoms 1 single 5 5 0");
command("create_atoms 1 single 5 5 5");
// initial state
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
command("balance 1 rcb");
// state after balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 2);
break;
}
// box dimensions should have minimal size
double dx = lmp->domain->subhi[0] - lmp->domain->sublo[0];
double dy = lmp->domain->subhi[1] - lmp->domain->sublo[1];
double dz = lmp->domain->subhi[2] - lmp->domain->sublo[2];
ASSERT_GT(dx, lmp->neighbor->skin);
ASSERT_GT(dy, lmp->neighbor->skin);
ASSERT_GT(dz, lmp->neighbor->skin);
}
TEST_F(MPILoadBalanceTest, rcb_min_size)
{
GTEST_SKIP();
// TODO minimum domain size is not enforced right now
// skipping for now to allow other MPI tests to get merged
command("comm_style tiled");
command("create_atoms 1 single 0 0 0");
command("create_atoms 1 single 0 0 0.25");
command("create_atoms 1 single 0 0.25 0");
command("create_atoms 1 single 0 0.25 0.25");
command("create_atoms 1 single 0.25 0 0");
command("create_atoms 1 single 0.25 0 0.25");
command("create_atoms 1 single 0.25 0.25 0");
command("create_atoms 1 single 0.25 0.25 0.25");
// initial state
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
// this should fail and not change the boxes
// or keep them at a minimum size
command("balance 1 rcb");
// state after balance command
switch(lmp->comm->me) {
case 0:
ASSERT_EQ(lmp->atom->nlocal, 8);
break;
case 1:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 2:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
case 3:
ASSERT_EQ(lmp->atom->nlocal, 0);
break;
}
// box dimensions should have minimal size
double dx = lmp->domain->subhi[0] - lmp->domain->sublo[0];
double dy = lmp->domain->subhi[1] - lmp->domain->sublo[1];
double dz = lmp->domain->subhi[2] - lmp->domain->sublo[2];
ASSERT_GT(dx, lmp->neighbor->skin);
ASSERT_GT(dy, lmp->neighbor->skin);
ASSERT_GT(dz, lmp->neighbor->skin);
}
}

View File

@ -1,6 +1,6 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 8 Apr 2021
date_generated: Fri Feb 26 23:09:02 2021 date_generated: Mon Apr 19 08:49:08 2021
epsilon: 1e-11 epsilon: 1e-11
prerequisites: ! | prerequisites: ! |
pair eam/fs pair eam/fs
@ -13,7 +13,7 @@ pair_coeff: ! |
2 2 eam Ni_u3.eam 2 2 eam Ni_u3.eam
extract: ! "" extract: ! ""
natoms: 32 natoms: 32
init_vdwl: 0.713225916338978 init_vdwl: 0.7132259163389776
init_coul: 0 init_coul: 0
init_stress: ! |2- init_stress: ! |2-
2.6556151567263032e+02 2.6660724159085703e+02 2.4812081237895359e+02 6.0264893464561915e+00 -6.6027371615114303e+00 -1.4187579099120772e+01 2.6556151567263032e+02 2.6660724159085703e+02 2.4812081237895359e+02 6.0264893464561915e+00 -6.6027371615114303e+00 -1.4187579099120772e+01
@ -50,7 +50,7 @@ init_forces: ! |2
30 -8.7442364632334701e-01 -8.5922993943854902e+00 -3.1671240722317777e+00 30 -8.7442364632334701e-01 -8.5922993943854902e+00 -3.1671240722317777e+00
31 3.1880080741982892e+00 -5.0021160844369490e+00 -2.7083467494366831e-01 31 3.1880080741982892e+00 -5.0021160844369490e+00 -2.7083467494366831e-01
32 -1.5986786450380142e+01 -5.5759911113046883e+00 -1.5504124024744577e+00 32 -1.5986786450380142e+01 -5.5759911113046883e+00 -1.5504124024744577e+00
run_vdwl: 0.669352105052575 run_vdwl: 0.6693521050525746
run_coul: 0 run_coul: 0
run_stress: ! |2- run_stress: ! |2-
2.6541041873586806e+02 2.6644256162479292e+02 2.4793398704069506e+02 5.9903981717659827e+00 -6.6045526000630410e+00 -1.4160943794248436e+01 2.6541041873586806e+02 2.6644256162479292e+02 2.4793398704069506e+02 5.9903981717659827e+00 -6.6045526000630410e+00 -1.4160943794248436e+01

View File

@ -1,6 +1,6 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 8 Apr 2021
date_generated: Fri Feb 26 23:09:03 2021 date_generated: Mon Apr 19 08:49:08 2021
epsilon: 5e-12 epsilon: 5e-12
prerequisites: ! | prerequisites: ! |
pair eam/fs pair eam/fs
@ -13,7 +13,7 @@ pair_coeff: ! |
* * eam/fs AlFe_mm.eam.fs NULL Al * * eam/fs AlFe_mm.eam.fs NULL Al
extract: ! "" extract: ! ""
natoms: 32 natoms: 32
init_vdwl: 15.6583494469006 init_vdwl: 15.658349446900637
init_coul: 0 init_coul: 0
init_stress: ! |2- init_stress: ! |2-
3.1757662346015599e+02 3.1488042003987044e+02 2.9518192213010605e+02 8.0970202601485379e+00 -4.6038792816319125e+00 -1.1521259274290610e+01 3.1757662346015599e+02 3.1488042003987044e+02 2.9518192213010605e+02 8.0970202601485379e+00 -4.6038792816319125e+00 -1.1521259274290610e+01
@ -50,7 +50,7 @@ init_forces: ! |2
30 -2.0584055270338175e+00 -5.2207163606526530e+00 -4.6304543222177532e+00 30 -2.0584055270338175e+00 -5.2207163606526530e+00 -4.6304543222177532e+00
31 1.2014109675977875e+00 -6.5554529419137078e+00 2.1453874832093329e+00 31 1.2014109675977875e+00 -6.5554529419137078e+00 2.1453874832093329e+00
32 -1.5986786450380142e+01 -5.5759911113046883e+00 -1.5504124024744577e+00 32 -1.5986786450380142e+01 -5.5759911113046883e+00 -1.5504124024744577e+00
run_vdwl: 15.6055369596825 run_vdwl: 15.605536959682482
run_coul: 0 run_coul: 0
run_stress: ! |2- run_stress: ! |2-
3.1739734448741643e+02 3.1467775824072135e+02 2.9494960877836593e+02 8.0575431550134713e+00 -4.6069278562709943e+00 -1.1484582135772436e+01 3.1739734448741643e+02 3.1467775824072135e+02 2.9494960877836593e+02 8.0575431550134713e+00 -4.6069278562709943e+00 -1.1484582135772436e+01

View File

@ -2,7 +2,6 @@
lammps_version: 10 Feb 2021 lammps_version: 10 Feb 2021
date_generated: Fri Feb 26 23:09:20 2021 date_generated: Fri Feb 26 23:09:20 2021
epsilon: 5e-13 epsilon: 5e-13
skip_tests: gpu
prerequisites: ! | prerequisites: ! |
pair tersoff pair tersoff
pre_commands: ! | pre_commands: ! |

View File

@ -1,8 +1,7 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 10 Feb 2021
date_generated: Fri Feb 26 23:09:20 2021 date_generated: Fri Feb 26 23:09:20 2021
epsilon: 5e-11 epsilon: 5e-9
skip_tests: gpu
prerequisites: ! | prerequisites: ! |
pair tersoff/zbl pair tersoff/zbl
pre_commands: ! | pre_commands: ! |

View File

@ -1,8 +1,7 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 8 Apr 2021
date_generated: Fri Feb 26 23:08:45 2021 date_generated: Mon Apr 19 08:49:07 2021
epsilon: 5e-14 epsilon: 7.5e-14
skip_tests: gpu
prerequisites: ! | prerequisites: ! |
atom full atom full
pair lj/cut pair lj/cut
@ -17,86 +16,85 @@ pair_coeff: ! |
1 2 lj/cut 0.01 1.75 8 1 2 lj/cut 0.01 1.75 8
1 3 lj/cut 0.02 2.85 8 1 3 lj/cut 0.02 2.85 8
1 4 lj/cut 0.0173205 2.8 8 1 4 lj/cut 0.0173205 2.8 8
1 5 lj/cut 0.0173205 2.8 8
2 2 lj/cut 0.005 1 8 2 2 lj/cut 0.005 1 8
2 3 lj/cut 0.01 2.1 8 2 3 lj/cut 0.01 2.1 8
2 4 lj/cut 0.005 0.5 8 2 4 lj/cut 0.005 0.5 8
2 5 lj/cut 0.00866025 2.05 8 2 5 lj/cut 0.00866025 2.05 8
3 3 lj/cut 0.02 3.2 8 3 3 lj/cut 0.02 3.2 8
3 4 lj/cut 0.0173205 3.15 8
3 5 lj/cut 0.0173205 3.15 8 3 5 lj/cut 0.0173205 3.15 8
4 4 lj/cut 0.015 3.1 8 4 4 lj/cut 0.015 3.1 8
4 5 lj/cut 0.015 3.1 8 4 5 lj/cut 0.015 3.1 8
5 5 lj/cut 0.015 3.1 8 5 5 lj/cut 0.015 3.1 8
* * coul/cut * * coul/cut
3 3 none
extract: ! "" extract: ! ""
natoms: 29 natoms: 29
init_vdwl: 749.237031537357 init_vdwl: 745.8729165577952
init_coul: -127.494586297384 init_coul: -138.51281549901438
init_stress: ! |2- init_stress: ! |2-
2.1525607963688685e+03 2.1557327421151899e+03 4.6078904881742919e+03 -7.6038602729615206e+02 1.6844266627640316e+01 6.6957549356541904e+02 2.1433945387773583e+03 2.1438418525427405e+03 4.5749493230631624e+03 -7.5161300805564053e+02 2.2812993218099149e+00 6.7751226426357493e+02
init_forces: ! |2 init_forces: ! |2
1 -2.1092656751925425e+01 2.6988675971196511e+02 3.3315496490210148e+02 1 -1.9649291084632637e+01 2.6691357149380127e+02 3.3265232188338541e+02
2 1.5859534558925552e+02 1.2807631885753918e+02 -1.8817306436807144e+02 2 1.5859534558925552e+02 1.2807631885753918e+02 -1.8817306436807144e+02
3 -1.3530454720678361e+02 -3.8712939850050407e+02 -1.4565941679363837e+02 3 -1.3530567831970495e+02 -3.8712983044177196e+02 -1.4566129338928388e+02
4 -7.8195539840070643e+00 2.1451967639963558e+00 -5.9041143405612999e+00 4 -7.8195539840070643e+00 2.1451967639963558e+00 -5.9041143405612999e+00
5 -2.9163954623584245e+00 -3.3469203159528891e+00 1.2074681739853981e+01 5 -2.9163954623584245e+00 -3.3469203159528891e+00 1.2074681739853981e+01
6 -8.2989063447195736e+02 9.6019318342576571e+02 1.1479359629470548e+03 6 -8.2989098462283039e+02 9.6019325436904921e+02 1.1479348548947717e+03
7 5.7874538635311936e+01 -3.3533985555183068e+02 -1.7140659049826711e+03 7 6.6019203897045301e+01 -3.4002739206175022e+02 -1.6963964881803979e+03
8 1.4280513303191131e+02 -1.0509295075299345e+02 4.0233495763755388e+02 8 1.3359110241269076e+02 -9.8018932606492385e+01 3.8583797257557939e+02
9 8.0984846358566287e+01 7.9600519879262990e+01 3.5197302607961126e+02 9 8.0984846358566287e+01 7.9600519879262990e+01 3.5197302607961126e+02
10 5.3089511229361369e+02 -6.0998478582862322e+02 -1.8376190026890427e+02 10 5.3089359350918085e+02 -6.0998285656765029e+02 -1.8376081267141316e+02
11 -3.3416993160125812e+00 -4.7792759715873308e+00 -1.0199030124309976e+01 11 -3.3416993160125812e+00 -4.7792759715873308e+00 -1.0199030124309976e+01
12 2.0837574127335213e+01 9.8678992274266921e+00 -6.6547856883058829e+00 12 2.0835873540321462e+01 9.8712254444709888e+00 -6.6533607886298407e+00
13 7.7163253261199216e+00 -3.2213746930547997e+00 -1.5767800864580894e-01 13 7.7163253261199216e+00 -3.2213746930547997e+00 -1.5767800864580894e-01
14 -4.6138299494911639e+00 1.1336312962250332e+00 -8.7660603717255832e+00 14 -4.6138299494911639e+00 1.1336312962250332e+00 -8.7660603717255832e+00
15 1.6301594996052212e-02 8.3212544078493291e+00 2.0473863128880430e+00 15 1.6301594996052212e-02 8.3212544078493291e+00 2.0473863128880430e+00
16 4.6221152690976908e+02 -3.3124444344467344e+02 -1.1865036959698600e+03 16 4.6221076301291345e+02 -3.3124285139751140e+02 -1.1865012258764175e+03
17 -4.5568726200724092e+02 3.2159231068141992e+02 1.1980747895060381e+03 17 -4.5606960458862824e+02 3.2217194951510470e+02 1.1974188947377352e+03
18 1.2559081069243214e+00 6.6417071126352401e+00 -9.8829024661057083e+00 18 1.2642503785059469e+00 6.6487748605328285e+00 -9.8967964193854954e+00
19 1.6184514948299680e+00 -1.6594104323923884e+00 5.6561121961572223e+00 19 1.6184514948299680e+00 -1.6594104323923884e+00 5.6561121961572223e+00
20 -3.4526823962510336e+00 -3.1794201827804485e+00 4.2593058942069533e+00 20 -3.4526823962510336e+00 -3.1794201827804485e+00 4.2593058942069533e+00
21 -6.9075184494915916e+01 -8.0130885501011278e+01 2.1539206802020570e+02 21 -6.9068952751967188e+01 -8.0138116375988346e+01 2.1538477896980064e+02
22 -1.0659100672969126e+02 -2.5122518903211912e+01 -1.6283765584018167e+02 22 -1.0659100672969126e+02 -2.5122518903211912e+01 -1.6283765584018167e+02
23 1.7515797811309091e+02 1.0400246780074602e+02 -5.2024018223038112e+01 23 1.7515797811309091e+02 1.0400246780074602e+02 -5.2024018223038112e+01
24 3.4171625917777114e+01 -2.0194713552213176e+02 1.0982444762500101e+02 24 3.4173068949839667e+01 -2.0194449586908348e+02 1.0982812303394964e+02
25 -1.4493448920889654e+02 2.0799041369281703e+01 -1.2091050237305346e+02 25 -1.4493448920889654e+02 2.0799041369281703e+01 -1.2091050237305346e+02
26 1.0983611557367320e+02 1.8026252731144598e+02 1.2199612526237862e+01 26 1.0983611557367320e+02 1.8026252731144598e+02 1.2199612526237862e+01
27 4.8962849172262665e+01 -2.1594262411895852e+02 8.6423873663236122e+01 27 4.8960638929347951e+01 -2.1594451942422438e+02 8.6425489362011916e+01
28 -1.7556665080686602e+02 7.2243004627719102e+01 -1.1798867746650107e+02 28 -1.7556665080686602e+02 7.2243004627719102e+01 -1.1798867746650107e+02
29 1.2734696054095977e+02 1.4335517724642804e+02 3.2138218235426962e+01 29 1.2734696054095977e+02 1.4335517724642804e+02 3.2138218235426962e+01
run_vdwl: 719.583657033589 run_vdwl: 716.3802195867241
run_coul: -127.40544584254 run_coul: -138.41949137400766
run_stress: ! |2- run_stress: ! |2-
2.1066855251881925e+03 2.1118463017620702e+03 4.3411898896739367e+03 -7.3939094916433964e+02 3.4004309224046892e+01 6.3091802194682043e+02 2.0979303990927456e+03 2.1001765345686881e+03 4.3095704231054315e+03 -7.3090278796437826e+02 1.9971774954468970e+01 6.3854079301261561e+02
run_forces: ! |2 run_forces: ! |2
1 -1.8063372896871861e+01 2.6678105157873705e+02 3.2402996659149238e+02 1 -1.6610877533029917e+01 2.6383021332799052e+02 3.2353483319348879e+02
2 1.5330358878115447e+02 1.2380492572678898e+02 -1.8151333240574237e+02 2 1.5330154436698174e+02 1.2380568506592064e+02 -1.8151165007810525e+02
3 -1.3354888440944052e+02 -3.7931758440809585e+02 -1.4288689214683646e+02 3 -1.3355888938990938e+02 -3.7933844699879148e+02 -1.4289670293816388e+02
4 -7.7881294728555828e+00 2.1395223669670709e+00 -5.8946911982403414e+00 4 -7.7881120826204668e+00 2.1395098313701606e+00 -5.8946811108039316e+00
5 -2.9015406841040750e+00 -3.3190775902304690e+00 1.2028378254388521e+01 5 -2.9015331574965137e+00 -3.3190957550906650e+00 1.2028358182322860e+01
6 -8.0488833369818803e+02 9.1802981835006187e+02 1.0244099127408372e+03 6 -8.0526764288323773e+02 9.1843645125221315e+02 1.0247463799396066e+03
7 5.5465440662485150e+01 -3.1049131627300432e+02 -1.5711945284966396e+03 7 6.3415313059583099e+01 -3.1516725367592539e+02 -1.5545584841600896e+03
8 1.3295629283853211e+02 -9.6566834572636509e+01 3.9097872808487460e+02 8 1.2443895440675962e+02 -8.9966546620018491e+01 3.7528288654519253e+02
9 7.8594917874857543e+01 7.6787239820699739e+01 3.4114513928465578e+02 9 7.8562021792928846e+01 7.6737772485099740e+01 3.4097956793351517e+02
10 5.2093084326233679e+02 -5.9871672888830824e+02 -1.8144904320802175e+02 10 5.2084083656240523e+02 -5.9861234059469723e+02 -1.8138805681750645e+02
11 -3.3489474910616370e+00 -4.7299066233626039e+00 -1.0148722292306179e+01 11 -3.3489824667518393e+00 -4.7298446901938807e+00 -1.0148711690275450e+01
12 2.0817110693939330e+01 9.8621648346024777e+00 -6.7801624810903709e+00 12 2.0815589888478105e+01 9.8654168641522730e+00 -6.7785848461804141e+00
13 7.6705047254095406e+00 -3.1868508087899996e+00 -1.5820764985177732e-01 13 7.6704892224392722e+00 -3.1868449584865046e+00 -1.5821377982473980e-01
14 -4.5784791310044675e+00 1.1138053855319887e+00 -8.6502065778611730e+00 14 -4.5785422362324342e+00 1.1138107530543817e+00 -8.6501509346025998e+00
15 -2.0858645012343142e-03 8.3343285345071436e+00 2.0653788728248101e+00 15 -2.1389037192471316e-03 8.3343251445103643e+00 2.0653551218031234e+00
16 4.3381526742384807e+02 -3.1216388880293573e+02 -1.1109931745334770e+03 16 4.3381854759590340e+02 -3.1216576452973555e+02 -1.1109981398263690e+03
17 -4.2715774864577224e+02 3.0231264864237801e+02 1.1227484174344033e+03 17 -4.2754398440828430e+02 3.0289566960675381e+02 1.1220989215843697e+03
18 1.2031503133104606e+00 6.6109154581424221e+00 -9.8172457746610178e+00 18 1.2114513551044401e+00 6.6180216089215458e+00 -9.8312525087926925e+00
19 1.6542029696015907e+00 -1.6435312394752812e+00 5.6634735276627497e+00 19 1.6542558848822984e+00 -1.6435031778340830e+00 5.6635143081937196e+00
20 -3.4397850729417945e+00 -3.1640002526012512e+00 4.1983600861482540e+00 20 -3.4397798875877807e+00 -3.1640142907323199e+00 4.1983853511543821e+00
21 -6.8065111490654829e+01 -7.8373161130023504e+01 2.1145341222255522e+02 21 -6.8058847895033125e+01 -7.8380439852912886e+01 2.1144611822725810e+02
22 -1.0497862711706458e+02 -2.4878742273401844e+01 -1.5988817620288421e+02 22 -1.0497864675042641e+02 -2.4878735013483009e+01 -1.5988818740798348e+02
23 1.7253257365878264e+02 1.0200250230245655e+02 -5.1030905034776815e+01 23 1.7253258234009186e+02 1.0200252121753527e+02 -5.1030908277968685e+01
24 3.5759299481226734e+01 -2.0057859782619599e+02 1.1032111627497152e+02 24 3.5760727178399790e+01 -2.0057598226072813e+02 1.1032480117076591e+02
25 -1.4570195714964908e+02 2.0679748005808605e+01 -1.2162175868970056e+02 25 -1.4570194437506802e+02 2.0679739580300286e+01 -1.2162176434722556e+02
26 1.0901403460528100e+02 1.7901644500696690e+02 1.2412674623332103e+01 26 1.0901404321356092e+02 1.7901646282634897e+02 1.2412667553028452e+01
27 4.8035883250870448e+01 -2.1205445789284894e+02 8.4315888267103702e+01 27 4.8033700837518651e+01 -2.1205635024551196e+02 8.4317526475629421e+01
28 -1.7229323056476886e+02 7.0823266235363889e+01 -1.1557273097021344e+02 28 -1.7229323238986416e+02 7.0823275743089638e+01 -1.1557274387241809e+02
29 1.2500312314724302e+02 1.4088629633289813e+02 3.1828931397054006e+01 29 1.2500309665422407e+02 1.4088628735688107e+02 3.1828917009980870e+01
... ...

View File

@ -1,6 +1,6 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 8 Apr 2021
date_generated: Fri Feb 26 23:08:45 2021 date_generated: Mon Apr 19 08:49:07 2021
epsilon: 5e-14 epsilon: 5e-14
skip_tests: gpu intel omp skip_tests: gpu intel omp
prerequisites: ! | prerequisites: ! |
@ -31,74 +31,75 @@ pair_coeff: ! |
5 5 lj/cut 0.015 3.1 8 5 5 lj/cut 0.015 3.1 8
* * coul/cut 1 * * coul/cut 1
* * coul/cut 2 * * coul/cut 2
2 3 none
extract: ! "" extract: ! ""
natoms: 29 natoms: 29
init_vdwl: 749.237031537357 init_vdwl: 695.3728483503972
init_coul: -127.494586297384 init_coul: 118.95803822933868
init_stress: ! |2- init_stress: ! |2-
2.1525607963688685e+03 2.1557327421151899e+03 4.6078904881742919e+03 -7.6038602729615206e+02 1.6844266627640316e+01 6.6957549356541904e+02 2.1020038760662910e+03 2.1696900014167491e+03 4.2400143530641753e+03 -8.4820804228720078e+02 3.1662186032408862e+01 6.7609982605789560e+02
init_forces: ! |2 init_forces: ! |2
1 -2.1092656751925425e+01 2.6988675971196511e+02 3.3315496490210148e+02 1 1.2395744433084418e+02 4.0360040310773837e+02 1.4710329775938777e+02
2 1.5859534558925552e+02 1.2807631885753918e+02 -1.8817306436807144e+02 2 2.0403866219573294e+00 3.7427015227202860e+00 -5.2095053499948687e+00
3 -1.3530454720678361e+02 -3.8712939850050407e+02 -1.4565941679363837e+02 3 -1.3530454720678361e+02 -3.8712939850050407e+02 -1.4565941679363837e+02
4 -7.8195539840070643e+00 2.1451967639963558e+00 -5.9041143405612999e+00 4 -8.8457203481064290e+00 2.0775655304814062e+00 -6.4577920902830810e+00
5 -2.9163954623584245e+00 -3.3469203159528891e+00 1.2074681739853981e+01 5 -3.8621595793596168e+00 -3.4155992315339034e+00 1.2662823025931699e+01
6 -8.2989063447195736e+02 9.6019318342576571e+02 1.1479359629470548e+03 6 -8.2989063447195713e+02 9.6019318342576582e+02 1.1479359629470543e+03
7 5.7874538635311936e+01 -3.3533985555183068e+02 -1.7140659049826711e+03 7 5.7874538635311936e+01 -3.3533985555183062e+02 -1.7140659049826709e+03
8 1.4280513303191131e+02 -1.0509295075299345e+02 4.0233495763755388e+02 8 2.1951760889665016e+02 -2.7745841022748479e+01 7.5004437999744698e+02
9 8.0984846358566287e+01 7.9600519879262990e+01 3.5197302607961126e+02 9 5.2714873038389127e+00 -8.4861250407806690e+00 6.9224510478542918e+00
10 5.3089511229361369e+02 -6.0998478582862322e+02 -1.8376190026890427e+02 10 5.3089511229361347e+02 -6.0998478582862344e+02 -1.8376190026890421e+02
11 -3.3416993160125812e+00 -4.7792759715873308e+00 -1.0199030124309976e+01 11 -2.8872927401613704e+00 -5.8162507264509147e+00 -1.0845838127234256e+01
12 2.0837574127335213e+01 9.8678992274266921e+00 -6.6547856883058829e+00 12 2.0837574127335216e+01 9.8678992274266957e+00 -6.6547856883058802e+00
13 7.7163253261199216e+00 -3.2213746930547997e+00 -1.5767800864580894e-01 13 8.7535743331999196e+00 -3.5826004829028451e+00 -5.0574000969376898e-01
14 -4.6138299494911639e+00 1.1336312962250332e+00 -8.7660603717255832e+00 14 -3.5497769084795245e+00 7.9766504428704821e-01 -1.0037637362299094e+01
15 1.6301594996052212e-02 8.3212544078493291e+00 2.0473863128880430e+00 15 1.9984402152167433e+00 8.5838951595651096e+00 1.4145761197403108e+00
16 4.6221152690976908e+02 -3.3124444344467344e+02 -1.1865036959698600e+03 16 4.6221152690976896e+02 -3.3124444344467344e+02 -1.1865036959698600e+03
17 -4.5568726200724092e+02 3.2159231068141992e+02 1.1980747895060381e+03 17 -4.5568726200724080e+02 3.2159231068141997e+02 1.1980747895060381e+03
18 1.2559081069243214e+00 6.6417071126352401e+00 -9.8829024661057083e+00 18 1.2559081069243216e+00 6.6417071126352401e+00 -9.8829024661057083e+00
19 1.6184514948299680e+00 -1.6594104323923884e+00 5.6561121961572223e+00 19 3.1958200177362119e+00 3.7689524813885311e-01 4.2824321381874042e-01
20 -3.4526823962510336e+00 -3.1794201827804485e+00 4.2593058942069533e+00 20 -1.2082334569560751e+00 -9.0511517312734613e-01 9.8083091385568755e-01
21 -6.9075184494915916e+01 -8.0130885501011278e+01 2.1539206802020570e+02 21 -6.9075184494915916e+01 -8.0130885501011278e+01 2.1539206802020570e+02
22 -1.0659100672969126e+02 -2.5122518903211912e+01 -1.6283765584018167e+02 22 -1.0570319068625072e+02 -2.6153578761410891e+01 -1.6388724340449593e+02
23 1.7515797811309091e+02 1.0400246780074602e+02 -5.2024018223038112e+01 23 1.7632012115728725e+02 1.0321660965756321e+02 -5.2838552485947986e+01
24 3.4171625917777114e+01 -2.0194713552213176e+02 1.0982444762500101e+02 24 3.4171625917777135e+01 -2.0194713552213176e+02 1.0982444762500104e+02
25 -1.4493448920889654e+02 2.0799041369281703e+01 -1.2091050237305346e+02 25 -1.4171132869700503e+02 2.4473995934890809e+01 -1.1380863842227539e+02
26 1.0983611557367320e+02 1.8026252731144598e+02 1.2199612526237862e+01 26 1.1207773375764390e+02 1.8255009969585140e+02 1.5493459542368809e+01
27 4.8962849172262665e+01 -2.1594262411895852e+02 8.6423873663236122e+01 27 4.8962849172262672e+01 -2.1594262411895849e+02 8.6423873663236122e+01
28 -1.7556665080686602e+02 7.2243004627719102e+01 -1.1798867746650107e+02 28 -1.7737980202409483e+02 6.9833302792655687e+01 -1.1687995083239473e+02
29 1.2734696054095977e+02 1.4335517724642804e+02 3.2138218235426962e+01 29 1.2576338082394257e+02 1.4027600476554844e+02 3.4298300872164091e+01
run_vdwl: 719.583657033589 run_vdwl: 666.6114372300175
run_coul: -127.40544584254 run_coul: 119.0349803664172
run_stress: ! |2- run_stress: ! |2-
2.1066855251881925e+03 2.1118463017620702e+03 4.3411898896739367e+03 -7.3939094916433964e+02 3.4004309224046892e+01 6.3091802194682043e+02 2.0554653461439952e+03 2.1240816159348624e+03 3.9864296321079441e+03 -8.2113807711720642e+02 4.5860921368817714e+01 6.3795624388863928e+02
run_forces: ! |2 run_forces: ! |2
1 -1.8063372896871861e+01 2.6678105157873705e+02 3.2402996659149238e+02 1 1.2147752778287347e+02 3.9534374510798301e+02 1.4413605468707195e+02
2 1.5330358878115447e+02 1.2380492572678898e+02 -1.8151333240574237e+02 2 2.0399930128993224e+00 3.7557805682682748e+00 -5.2058063128492336e+00
3 -1.3354888440944052e+02 -3.7931758440809585e+02 -1.4288689214683646e+02 3 -1.3333096721751764e+02 -3.7844737951764535e+02 -1.4238961467845959e+02
4 -7.7881294728555828e+00 2.1395223669670709e+00 -5.8946911982403414e+00 4 -8.8134959904656007e+00 2.0713309772867512e+00 -6.4488585600230390e+00
5 -2.9015406841040750e+00 -3.3190775902304690e+00 1.2028378254388521e+01 5 -3.8477726201647444e+00 -3.3895758075040905e+00 1.2617145909886416e+01
6 -8.0488833369818803e+02 9.1802981835006187e+02 1.0244099127408372e+03 6 -8.0167356407303771e+02 9.1511139207343115e+02 1.0260272560535318e+03
7 5.5465440662485150e+01 -3.1049131627300432e+02 -1.5711945284966396e+03 7 5.5505611657656395e+01 -3.1051895449278589e+02 -1.5710947343097826e+03
8 1.3295629283853211e+02 -9.6566834572636509e+01 3.9097872808487460e+02 8 2.0529374503578478e+02 -2.0214215494247814e+01 7.2625230302681450e+02
9 7.8594917874857543e+01 7.6787239820699739e+01 3.4114513928465578e+02 9 5.2759827822743706e+00 -8.5029606929125237e+00 6.9437749095564918e+00
10 5.2093084326233679e+02 -5.9871672888830824e+02 -1.8144904320802175e+02 10 5.1965622207475565e+02 -5.9755369618722887e+02 -1.8157960265809501e+02
11 -3.3489474910616370e+00 -4.7299066233626039e+00 -1.0148722292306179e+01 11 -2.8945778423069450e+00 -5.7662137070620867e+00 -1.0795655996511190e+01
12 2.0817110693939330e+01 9.8621648346024777e+00 -6.7801624810903709e+00 12 2.0805414458419623e+01 9.8601745071951186e+00 -6.7782082590913761e+00
13 7.6705047254095406e+00 -3.1868508087899996e+00 -1.5820764985177732e-01 13 8.7071353977142216e+00 -3.5468381013374746e+00 -5.0622413568933977e-01
14 -4.5784791310044675e+00 1.1138053855319887e+00 -8.6502065778611730e+00 14 -3.5154376369702902e+00 7.7780954572734984e-01 -9.9213826027447922e+00
15 -2.0858645012343142e-03 8.3343285345071436e+00 2.0653788728248101e+00 15 1.9841048852047882e+00 8.5994997942103542e+00 1.4318674533257378e+00
16 4.3381526742384807e+02 -3.1216388880293573e+02 -1.1109931745334770e+03 16 4.3381844145946962e+02 -3.1216471119732176e+02 -1.1109885080754987e+03
17 -4.2715774864577224e+02 3.0231264864237801e+02 1.1227484174344033e+03 17 -4.2715530816964593e+02 3.0229606646197493e+02 1.1227416717947804e+03
18 1.2031503133104606e+00 6.6109154581424221e+00 -9.8172457746610178e+00 18 1.2084471423281700e+00 6.6044276302722391e+00 -9.8277754487894136e+00
19 1.6542029696015907e+00 -1.6435312394752812e+00 5.6634735276627497e+00 19 3.2313284340457584e+00 3.9423765207539685e-01 4.3538203547548804e-01
20 -3.4397850729417945e+00 -3.1640002526012512e+00 4.1983600861482540e+00 20 -1.1969830459758257e+00 -8.8960771143457151e-01 9.2526061301410900e-01
21 -6.8065111490654829e+01 -7.8373161130023504e+01 2.1145341222255522e+02 21 -6.8060732684000939e+01 -7.8361174093266939e+01 2.1144116321844479e+02
22 -1.0497862711706458e+02 -2.4878742273401844e+01 -1.5988817620288421e+02 22 -1.0408301224632098e+02 -2.5910595170511762e+01 -1.6092979318531198e+02
23 1.7253257365878264e+02 1.0200250230245655e+02 -5.1030905034776815e+01 23 1.7368084263289987e+02 1.0120586644080414e+02 -5.1841492516928824e+01
24 3.5759299481226734e+01 -2.0057859782619599e+02 1.1032111627497152e+02 24 3.5901478353702402e+01 -2.0053113579605662e+02 1.1040539818330446e+02
25 -1.4570195714964908e+02 2.0679748005808605e+01 -1.2162175868970056e+02 25 -1.4257916099779564e+02 2.4374225442971877e+01 -1.1459703108843671e+02
26 1.0901403460528100e+02 1.7901644500696690e+02 1.2412674623332103e+01 26 1.1121725716987784e+02 1.8123540984908496e+02 1.5706480723289609e+01
27 4.8035883250870448e+01 -2.1205445789284894e+02 8.4315888267103702e+01 27 4.7997433858479745e+01 -2.1209575374436324e+02 8.4297950741699410e+01
28 -1.7229323056476886e+02 7.0823266235363889e+01 -1.1557273097021344e+02 28 -1.7410976565710496e+02 6.8409754929264125e+01 -1.1446187451410728e+02
29 1.2500312314724302e+02 1.4088629633289813e+02 3.1828931397054006e+01 29 1.2345981204292134e+02 1.3785309073312925e+02 3.4004852992123624e+01
... ...

View File

@ -1,99 +1,99 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 8 Apr 2021
date_generated: Fri Feb 26 23:08:45 2021 date_generated: Mon Apr 19 08:49:07 2021
epsilon: 5e-14 epsilon: 5e-14
skip_tests: gpu
prerequisites: ! | prerequisites: ! |
atom full atom full
pair lj/cut pair lj/cut
pair lj96/cut
pre_commands: ! "" pre_commands: ! ""
post_commands: ! "" post_commands: ! ""
input_file: in.fourmol input_file: in.fourmol
pair_style: hybrid lj/cut 8.0 lj/cut 8.0 pair_style: hybrid lj/cut 8.0 lj96/cut 8.0
pair_coeff: ! | pair_coeff: ! |
1 1 lj/cut 1 0.02 2.5 8 1 1 lj/cut 0.02 2.5 8
1 2 lj/cut 1 0.01 1.75 8 1 2 lj/cut 0.01 1.75 8
1 3 lj/cut 1 0.02 2.85 8 1 3 lj/cut 0.02 2.85 8
1 4 lj/cut 1 0.0173205 2.8 8 1 4 lj/cut 0.0173205 2.8 8
1 5 lj/cut 1 0.0173205 2.8 8 1 5 none
2 2 lj/cut 1 0.005 1 8 2 2 lj/cut 0.005 1 8
2 3 lj/cut 1 0.01 2.1 8 2 3 lj/cut 0.01 2.1 8
2 4 lj/cut 2 0.005 0.5 8 2 4 lj96/cut 0.005 0.5 8
2 5 lj/cut 2 0.00866025 2.05 8 2 5 lj96/cut 0.00866025 2.05 8
3 3 lj/cut 2 0.02 3.2 8 3 3 lj96/cut 0.02 3.2 8
3 4 lj/cut 2 0.0173205 3.15 8 3 4 lj96/cut 0.0173205 3.15 8
3 5 lj/cut 2 0.0173205 3.15 8 3 5 lj96/cut 0.0173205 3.15 8
4 4 lj/cut 2 0.015 3.1 8 4 4 lj96/cut 0.015 3.1 8
4 5 lj/cut 2 0.015 3.1 8 4 5 none
5 5 lj/cut 2 0.015 3.1 8 5 5 lj96/cut 0.015 3.1 8
extract: ! "" extract: ! ""
natoms: 29 natoms: 29
init_vdwl: 749.237031537357 init_vdwl: 652.4450882982227
init_coul: 0 init_coul: 0
init_stress: ! |2- init_stress: ! |2-
2.1793853434038251e+03 2.1988955172192786e+03 4.6653977523326275e+03 -7.5956547636050641e+02 2.4751536734034119e+01 6.6652028436400667e+02 1.6199549089538609e+03 1.8652222871458566e+03 4.3555170935393007e+03 -9.5632547516887212e+02 -2.2845869578774162e+02 6.9982627975055175e+02
init_forces: ! |2 init_forces: ! |2
1 -2.3333390280895383e+01 2.6994567613322732e+02 3.3272827850356794e+02 1 -2.3333467289742931e+01 2.6993142283476851e+02 3.3272495963292283e+02
2 1.5828554630414868e+02 1.3025008843535846e+02 -1.8629682358935690e+02 2 1.5828552013445056e+02 1.3025008546972211e+02 -1.8629688302475225e+02
3 -1.3528903738169089e+02 -3.8704313358320059e+02 -1.4568978437133126e+02 3 -1.3529016849461223e+02 -3.8704356552446848e+02 -1.4569166096697677e+02
4 -7.8711096705893420e+00 2.1350518625373542e+00 -5.5954532185548151e+00 4 -7.8711116846129050e+00 2.1350517679284451e+00 -5.5954561911890046e+00
5 -2.5176757268228527e+00 -4.0521510681020221e+00 1.2152704057877008e+01 5 -2.5177006460693390e+00 -4.0521653208614632e+00 1.2152678277353530e+01
6 -8.3190662465252262e+02 9.6394149462625705e+02 1.1509093566509250e+03 6 -8.3190697480339566e+02 9.6394156556954056e+02 1.1509082485986419e+03
7 5.8203388932513640e+01 -3.3608997951626816e+02 -1.7179617996573054e+03 7 6.4961865086373535e+01 -3.3998877273576284e+02 -1.7032949977108992e+03
8 1.4451392284291583e+02 -1.0927475861089046e+02 3.9990593492420493e+02 8 1.3800067755917669e+02 -1.0575764259058835e+02 3.8568183849544192e+02
9 7.9156945283097571e+01 8.5273009783986680e+01 3.5032175698445252e+02 9 7.9156940582018805e+01 8.5272978047670051e+01 3.5032172427046436e+02
10 5.3118875219105416e+02 -6.1040990859419469e+02 -1.8355872642619312e+02 10 5.3118723340662132e+02 -6.1040797933322176e+02 -1.8355763882870201e+02
11 -2.3530157267965532e+00 -5.9077640073819744e+00 -9.6590723955414326e+00 11 -2.3531003777844695e+00 -5.9077049537176469e+00 -9.6590265504356907e+00
12 1.7527155146800411e+01 1.0633119523437488e+01 -7.9254398064483143e+00 12 1.7525454559786660e+01 1.0636445740481784e+01 -7.9240149067722738e+00
13 8.0986409579532861e+00 -3.2098088264781510e+00 -1.4896399843793828e-01 13 8.0985903919880737e+00 -3.2096212808671210e+00 -1.4884740337815178e-01
14 -3.3852721292265100e+00 6.8636181241903504e-01 -8.7507190862499726e+00 14 -3.3853022166233191e+00 6.8640988271648729e-01 -8.7507072432538457e+00
15 -2.0454999188605286e-01 8.4846165523049883e+00 3.0131615419406708e+00 15 -2.0454983537269980e-01 8.4846157143527687e+00 3.0131531921339136e+00
16 4.6326310311812085e+02 -3.3087715736498177e+02 -1.1893024561782547e+03 16 4.6326233922126522e+02 -3.3087556531781973e+02 -1.1892999860848122e+03
17 -4.5334300923766710e+02 3.1554283255882558e+02 1.2058417793481196e+03 17 -4.5359533332836713e+02 3.1593155242296575e+02 1.2054040116538242e+03
18 -1.8862623280672657e-02 -3.3402010907951640e-02 3.1000479299095243e-02 18 -1.2313292578060062e-02 -2.5378393942268991e-02 2.2968315649798128e-02
19 3.1843079640570080e-04 -2.3918627818763423e-04 1.7427252638513441e-03 19 3.0439100375925543e-04 -2.4779478988349023e-04 1.7258398467618651e-03
20 -9.9760831209706009e-04 -1.0209184826753088e-03 3.6910972636601454e-04 20 -9.8045055969651082e-04 -1.0028949153285463e-03 3.5715001758946177e-04
21 -7.1566125273265527e+01 -8.1615678329920812e+01 2.2589561408339878e+02 21 -5.7186294103147572e+00 -6.6344147796080684e+00 1.8654007864095536e+01
22 -1.0808835729977487e+02 -2.6193787235943859e+01 -1.6957904943161384e+02 22 -8.9567671655515344e+00 -2.1701845330290590e+00 -1.4052631842883260e+01
23 1.7964455474779510e+02 1.0782097695276961e+02 -5.6305786479140700e+01 23 1.4673371058172327e+01 8.8071981142288021e+00 -4.5994772330864269e+00
24 3.6591406576585001e+01 -2.1181587621785556e+02 1.1218301872572404e+02 24 3.2769508891728725e+00 -1.7316771489185900e+01 9.3887574366841235e+00
25 -1.4851489147738829e+02 2.3907118122949107e+01 -1.2485634873166315e+02 25 -1.2406052232816045e+01 1.9955673026898786e+00 -1.0432202322872895e+01
26 1.1191129453598201e+02 1.8789774664223359e+02 1.2650137204319886e+01 26 9.1216838958879958e+00 1.5316110435596807e+01 1.0304939537049307e+00
27 5.1810388677546058e+01 -2.2705458321213791e+02 9.0849111082069683e+01 27 3.8455233865293490e+00 -1.8678583225803411e+01 7.2399697763695485e+00
28 -1.8041307121444072e+02 7.7534042932772934e+01 -1.2206956760706599e+02 28 -1.4536949587460585e+01 6.2480560831561052e+00 -9.8361741655762192e+00
29 1.2861057254925004e+02 1.4952711274394565e+02 3.1216025556267869e+01 29 1.0692946253413785e+01 1.2432540782763471e+01 2.5948100184389560e+00
run_vdwl: 719.443281677466 run_vdwl: 624.1198434527859
run_coul: 0 run_coul: 0
run_stress: ! |2- run_stress: ! |2-
2.1330153957371017e+03 2.1547728168285512e+03 4.3976497417710170e+03 -7.3873328448298525e+02 4.1743821105367225e+01 6.2788012209191243e+02 1.5811055300513408e+03 1.8260026652593124e+03 4.0928122296059910e+03 -9.3274940961565028e+02 -2.0869586127604293e+02 6.5975565836651401e+02
run_forces: ! |2 run_forces: ! |2
1 -2.0299419751359796e+01 2.6686193378822901e+02 3.2358785870694004e+02 1 -2.0299545735132892e+01 2.6684807204226053e+02 3.2358468359237850e+02
2 1.5298617928491248e+02 1.2596516341409225e+02 -1.7961292655338647e+02 2 1.5298613010577799e+02 1.2596515036763115e+02 -1.7961295708782035e+02
3 -1.3353630652439793e+02 -3.7923748696131213e+02 -1.4291839793625775e+02 3 -1.3353752998744326e+02 -3.7923796991710333e+02 -1.4292028045209116e+02
4 -7.8374717836161771e+00 2.1276610789823414e+00 -5.5845014473820624e+00 4 -7.8374742335759366e+00 2.1276610876297597e+00 -5.5845047399918775e+00
5 -2.5014258630866699e+00 -4.0250131424704385e+00 1.2103512372025625e+01 5 -2.5014507165598512e+00 -4.0250273077928105e+00 1.2103486006755219e+01
6 -8.0681462887292412e+02 9.2165637136761688e+02 1.0270795806932804e+03 6 -8.0709614974024726e+02 9.2196952917801661e+02 1.0273844835710092e+03
7 5.5780279349903594e+01 -3.1117530951561696e+02 -1.5746991292869038e+03 7 6.2368964790102126e+01 -3.1505972760991460e+02 -1.5609074758304780e+03
8 1.3452983055534955e+02 -1.0064659350255846e+02 3.8851791558207583e+02 8 1.2853739032019485e+02 -9.7465044500250556e+01 3.7497119240743029e+02
9 7.6746213883426122e+01 8.2501469877402286e+01 3.3944351200617950e+02 9 7.6715909814250395e+01 8.2459997325499288e+01 3.3929722449258207e+02
10 5.2128033527695618e+02 -5.9920098848285909e+02 -1.8126029815043356e+02 10 5.2123917690492942e+02 -5.9914969452129674e+02 -1.8122078898785443e+02
11 -2.3573118090915246e+00 -5.8616944550888350e+00 -9.6049808811326240e+00 11 -2.3573941156945706e+00 -5.8616368783617920e+00 -9.6049336125719105e+00
12 1.7503975847822890e+01 1.0626930310560827e+01 -8.0603160272054950e+00 12 1.7502383808896312e+01 1.0630235744520755e+01 -8.0588289450962680e+00
13 8.0530313322973104e+00 -3.1756495170399104e+00 -1.4618315664740525e-01 13 8.0529802801748964e+00 -3.1754616291151323e+00 -1.4606677296755816e-01
14 -3.3416065168069760e+00 6.6492606336082127e-01 -8.6345131440469647e+00 14 -3.3416363973176253e+00 6.6497430894639287e-01 -8.6345016037082427e+00
15 -2.2253843262374870e-01 8.5025661635348619e+00 3.0369735873081569e+00 15 -2.2253805990966902e-01 8.5025662406844038e+00 3.0369660480415672e+00
16 4.3476311264989528e+02 -3.1171086735551455e+02 -1.1135217194927461e+03 16 4.3476506269170443e+02 -3.1171159958023998e+02 -1.1135242200065077e+03
17 -4.2469846140777202e+02 2.9615411776780638e+02 1.1302573488400678e+03 17 -4.2495337371832613e+02 2.9654505216420324e+02 1.1298239214745126e+03
18 -1.8849981672825901e-02 -3.3371636477421286e-02 3.0986293443778724e-02 18 -1.2304275579819248e-02 -2.5351950229154721e-02 2.2962838569349546e-02
19 3.0940277774413972e-04 -2.4634536455373055e-04 1.7433360008861018e-03 19 2.9523284665120854e-04 -2.5507040924857842e-04 1.7263527188201720e-03
20 -9.8648131277150768e-04 -1.0112587134526944e-03 3.6932948773965422e-04 20 -9.6972071754998339e-04 -9.9365617456234753e-04 3.5770286471788313e-04
21 -7.0490745283106705e+01 -7.9749153581142281e+01 2.2171003384646417e+02 21 -5.7779283683910396e+00 -6.6373783567402054e+00 1.8717023177597437e+01
22 -1.0638717908920059e+02 -2.5949502163177943e+01 -1.6645589526812256e+02 22 -9.0188479017520962e+00 -2.2015411814231656e+00 -1.4100630927846634e+01
23 1.7686797710735050e+02 1.0571018898885526e+02 -5.5243337084099444e+01 23 1.4794749299535622e+01 8.8415202426425061e+00 -4.6144921197234865e+00
24 3.8206017656281247e+01 -2.1022820141992992e+02 1.1260711266189016e+02 24 3.4171983592341331e+00 -1.7549081284618467e+01 9.5729670271818517e+00
25 -1.4918881473530885e+02 2.3762151395876515e+01 -1.2549188139143089e+02 25 -1.2674530181010821e+01 2.0106979870159911e+00 -1.0661184439552951e+01
26 1.1097059498808326e+02 1.8645503634228552e+02 1.2861559677865269e+01 26 9.2499114441813344e+00 1.5533293107821931e+01 1.0752648395769842e+00
27 5.0800844984832011e+01 -2.2296588090685447e+02 8.8607367716323097e+01 27 3.9098603108147572e+00 -1.8759688298395208e+01 7.2506773670471274e+00
28 -1.7694190504288861e+02 7.6029945485181912e+01 -1.1950518150242056e+02 28 -1.4631015477945336e+01 6.2801033491768763e+00 -9.8799560206646078e+00
29 1.2614894925528131e+02 1.4694250820033537e+02 3.0893386672863009e+01 29 1.0722675266961424e+01 1.2481598596015642e+01 2.6278846486097209e+00
... ...

View File

@ -0,0 +1,99 @@
---
lammps_version: 8 Apr 2021
date_generated: Mon Apr 19 08:49:08 2021
epsilon: 5e-14
skip_tests: gpu
prerequisites: ! |
atom full
pair lj/cut
pre_commands: ! ""
post_commands: ! ""
input_file: in.fourmol
pair_style: hybrid lj/cut 8.0 lj/cut 8.0
pair_coeff: ! |
1 1 lj/cut 1 0.02 2.5 8
1 2 lj/cut 1 0.01 1.75 8
1 3 lj/cut 1 0.02 2.85 8
1 4 lj/cut 1 0.0173205 2.8 8
1 5 lj/cut 1 0.0173205 2.8 8
2 2 lj/cut 1 0.005 1 8
2 3 none
2 4 lj/cut 2 0.005 0.5 8
2 5 lj/cut 2 0.00866025 2.05 8
3 3 lj/cut 2 0.02 3.2 8
3 4 lj/cut 2 0.0173205 3.15 8
3 5 lj/cut 2 0.0173205 3.15 8
4 4 none
4 5 lj/cut 2 0.015 3.1 8
5 5 lj/cut 2 0.015 3.1 8
extract: ! ""
natoms: 29
init_vdwl: 695.3923515458562
init_coul: 0
init_stress: ! |2-
2.0701694962880379e+03 2.1161697936676396e+03 4.2064778387649758e+03 -8.5392301766114281e+02 5.8381311611070338e+01 6.7526909503583579e+02
init_forces: ! |2
1 1.3470193899351008e+02 3.9971667505559770e+02 1.4653534158640173e+02
2 -2.5920146506056333e-04 -3.7955921659898438e-03 1.6073626919112927e-04
3 -1.3528903738169089e+02 -3.8704313358320059e+02 -1.4568978437133126e+02
4 -7.8050743980642938e+00 2.1869547823331810e+00 -5.5398195700937443e+00
5 -2.3463115265684147e+00 -3.6110080311379984e+00 1.1991043207479338e+01
6 -8.3190662465252262e+02 9.6394149462625705e+02 1.1509093566509250e+03
7 5.8196056725569250e+01 -3.3609532232737348e+02 -1.7179637678770343e+03
8 2.2371752997318714e+02 -2.4044581303870338e+01 7.5018536133648945e+02
9 -1.9409760262620549e-03 7.2485476558358224e-03 5.8859368216628563e-03
10 5.3118875219105416e+02 -6.1040990859419469e+02 -1.8355872642619312e+02
11 -2.3694888595131456e+00 -5.8683646131501845e+00 -9.6273569602169200e+00
12 1.7527155146800411e+01 1.0633119523437488e+01 -7.9254398064483143e+00
13 8.1017386753150031e+00 -3.2103099553624541e+00 -1.4999876338278073e-01
14 -3.3827233651141047e+00 6.8626763970182614e-01 -8.7541119515926020e+00
15 -2.2835033173800551e-01 8.4695347876005833e+00 3.0205948609978988e+00
16 4.6326310311812085e+02 -3.3087715736498177e+02 -1.1893024561782547e+03
17 -4.5334049545249684e+02 3.1553975228548006e+02 1.2058468481979494e+03
18 -1.4044201506550015e-02 -2.4978926457057571e-02 2.7899849198216014e-02
19 5.7908066872909211e-04 2.3580122518177659e-05 9.4432839946607169e-04
20 -7.9929144000317922e-04 -8.5923998915859100e-04 9.3688470857894682e-05
21 -7.1566125273265527e+01 -8.1615678329920812e+01 2.2589561408339878e+02
22 -1.0808832728447032e+02 -2.6193822094038484e+01 -1.6957908491609356e+02
23 1.7964458878508086e+02 1.0782095393625858e+02 -5.6305810335528790e+01
24 3.6591406576585001e+01 -2.1181587621785556e+02 1.1218301872572404e+02
25 -1.4851247198601720e+02 2.3908563011127814e+01 -1.2485206982576771e+02
26 1.1191155617819715e+02 1.8789792679177191e+02 1.2650470167620387e+01
27 5.1810388677546058e+01 -2.2705458321213791e+02 9.0849111082069683e+01
28 -1.8041314710135907e+02 7.7533961534478649e+01 -1.2206952271304674e+02
29 1.2861042716162333e+02 1.4952690328401346e+02 3.1216205256769118e+01
run_vdwl: 666.4782147617275
run_coul: 0
run_stress: ! |2-
2.0230459789503245e+03 2.0702509496053467e+03 3.9518738620330496e+03 -8.2693736200387241e+02 7.2394119974104541e+01 6.3708810010786885e+02
run_forces: ! |2
1 1.3222884765649096e+02 3.9147464530754542e+02 1.4358022294156322e+02
2 -3.0864727869908275e-04 -3.8828117503160744e-03 1.7172318042670622e-04
3 -1.3332620470087795e+02 -3.7836092101534376e+02 -1.4242041283928734e+02
4 -7.7728646036501301e+00 2.1785693730418103e+00 -5.5299592481691731e+00
5 -2.3308414297947593e+00 -3.5861079994724223e+00 1.1943272718268586e+01
6 -8.0362787449170855e+02 9.1873908852320062e+02 1.0286784127827473e+03
7 5.5811219820327509e+01 -3.1120381969697877e+02 -1.5746114945931058e+03
8 2.0944769168608951e+02 -1.6467844308363212e+01 7.2633940157846291e+02
9 -1.8576332682468917e-03 7.0788521064532543e-03 5.6952330037911550e-03
10 5.1993646731938259e+02 -5.9797705136296099e+02 -1.8137145374090557e+02
11 -2.3735947029864999e+00 -5.8227345663909000e+00 -9.5735721932593005e+00
12 1.7496750082385656e+01 1.0626428651973894e+01 -8.0588816332352362e+00
13 8.0561193459222018e+00 -3.1761461937053199e+00 -1.4721657561379659e-01
14 -3.3390327331317540e+00 6.6483212295920502e-01 -8.6379436016166640e+00
15 -2.4691219203353357e-01 8.4871512091352503e+00 3.0445957174405320e+00
16 4.3476322109548175e+02 -3.1171106479661643e+02 -1.1135217352066604e+03
17 -4.2469483753690730e+02 2.9614920041309318e+02 1.1302640053436066e+03
18 -1.4041685725000265e-02 -2.4956350669900162e-02 2.7904010910612693e-02
19 5.7049372682756931e-04 1.6554736417528457e-05 9.4341990684141492e-04
20 -7.8849148841722897e-04 -8.4994368910122327e-04 9.4566031895818034e-05
21 -7.0490744649332854e+01 -7.9749153638697052e+01 2.2171003329264727e+02
22 -1.0638714881331208e+02 -2.5949537046722948e+01 -1.6645593048575904e+02
23 1.7686801069212282e+02 1.0571016567965997e+02 -5.5243360803916154e+01
24 3.8206094080913594e+01 -2.1022820935692107e+02 1.1260716750436217e+02
25 -1.4918646093941553e+02 2.3763610305920544e+01 -1.2548765023777884e+02
26 1.1097085296101896e+02 1.8645520999549970e+02 1.2861892631557549e+01
27 5.0800842221321886e+01 -2.2296588391583720e+02 8.8607366497542188e+01
28 -1.7694198089845398e+02 7.6029863930484495e+01 -1.1950513646089449e+02
29 1.2614880669418112e+02 1.4694230208476219e+02 3.0893567658970003e+01
...

View File

@ -2,7 +2,6 @@
lammps_version: 10 Feb 2021 lammps_version: 10 Feb 2021
date_generated: Fri Feb 26 23:08:45 2021 date_generated: Fri Feb 26 23:08:45 2021
epsilon: 7e-14 epsilon: 7e-14
skip_tests: gpu
prerequisites: ! | prerequisites: ! |
atom full atom full
pair lj/charmm/coul/charmm pair lj/charmm/coul/charmm

View File

@ -1,6 +1,6 @@
--- ---
lammps_version: 10 Feb 2021 lammps_version: 8 Apr 2021
date_generated: Fri Feb 26 23:08:56 2021 date_generated: Mon Apr 19 08:49:08 2021
epsilon: 5e-14 epsilon: 5e-14
prerequisites: ! | prerequisites: ! |
atom full atom full
@ -15,8 +15,8 @@ pair_coeff: ! |
* * python py_pot.LJCutFourMol 1 2 3 4 5 * * python py_pot.LJCutFourMol 1 2 3 4 5
extract: ! "" extract: ! ""
natoms: 29 natoms: 29
init_vdwl: 769.435514792906 init_vdwl: 769.4355147929056
init_coul: -127.494586297384 init_coul: -127.49458629738443
init_stress: ! |2- init_stress: ! |2-
2.2678521911648518e+03 2.2247029630324569e+03 4.6668446509523028e+03 -7.1863043563709800e+02 6.6980305204573611e+01 6.6425623166019000e+02 2.2678521911648518e+03 2.2247029630324569e+03 4.6668446509523028e+03 -7.1863043563709800e+02 6.6980305204573611e+01 6.6425623166019000e+02
init_forces: ! |2 init_forces: ! |2
@ -49,8 +49,8 @@ init_forces: ! |2
27 5.8858131514524516e+01 -2.5934658519982310e+02 1.0378659589349859e+02 27 5.8858131514524516e+01 -2.5934658519982310e+02 1.0378659589349859e+02
28 -2.1004851662389484e+02 8.7061736878465183e+01 -1.4131944246679177e+02 28 -2.1004851662389484e+02 8.7061736878465183e+01 -1.4131944246679177e+02
29 1.5193395589309270e+02 1.7194075642255194e+02 3.8106025733269696e+01 29 1.5193395589309270e+02 1.7194075642255194e+02 3.8106025733269696e+01
run_vdwl: 738.975921529802 run_vdwl: 738.9759215298017
run_coul: -127.388878149465 run_coul: -127.38887814946516
run_stress: ! |2- run_stress: ! |2-
2.2173727908784563e+03 2.1780484935540412e+03 4.3978310588967724e+03 -6.9936430337437957e+02 8.2321786589523725e+01 6.2596079360064653e+02 2.2173727908784563e+03 2.1780484935540412e+03 4.3978310588967724e+03 -6.9936430337437957e+02 8.2321786589523725e+01 6.2596079360064653e+02
run_forces: ! |2 run_forces: ! |2

View File

@ -48,7 +48,7 @@
using LAMMPS_NS::utils::split_words; using LAMMPS_NS::utils::split_words;
static void create_molecule_files() static void create_molecule_files(const std::string & h2o_filename, const std::string & co2_filename)
{ {
// create molecule files // create molecule files
const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n" const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n"
@ -73,18 +73,16 @@ static void create_molecule_files()
"Special Bond Counts\n\n1 2 0 0\n2 1 1 0\n3 1 1 0\n\n" "Special Bond Counts\n\n1 2 0 0\n2 1 1 0\n3 1 1 0\n\n"
"Special Bonds\n\n1 2 3\n2 1 3\n3 1 2\n\n"; "Special Bonds\n\n1 2 3\n2 1 3\n3 1 2\n\n";
FILE *fp = fopen("tmp.h2o.mol", "w"); FILE *fp = fopen(h2o_filename.c_str(), "w");
if (fp) { if (fp) {
fputs(h2o_file, fp); fputs(h2o_file, fp);
fclose(fp); fclose(fp);
} }
rename("tmp.h2o.mol", "h2o.mol"); fp = fopen(co2_filename.c_str(), "w");
fp = fopen("tmp.co2.mol", "w");
if (fp) { if (fp) {
fputs(co2_file, fp); fputs(co2_file, fp);
fclose(fp); fclose(fp);
} }
rename("tmp.co2.mol", "co2.mol");
} }
// whether to print verbose output (i.e. not capturing LAMMPS screen output). // whether to print verbose output (i.e. not capturing LAMMPS screen output).
@ -97,6 +95,15 @@ using ::testing::Eq;
class AtomStyleTest : public LAMMPSTest { class AtomStyleTest : public LAMMPSTest {
protected: protected:
static void SetUpTestSuite() {
create_molecule_files("h2o.mol", "co2.mol");
}
static void TearDownTestSuite() {
remove("h2o.mol");
remove("co2.mol");
}
void SetUp() override void SetUp() override
{ {
testbinary = "AtomStyleTest"; testbinary = "AtomStyleTest";
@ -2618,7 +2625,6 @@ TEST_F(AtomStyleTest, body_nparticle)
TEST_F(AtomStyleTest, template) TEST_F(AtomStyleTest, template)
{ {
if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP();
create_molecule_files();
BEGIN_HIDE_OUTPUT(); BEGIN_HIDE_OUTPUT();
command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0");
command("atom_style template twomols"); command("atom_style template twomols");
@ -3014,7 +3020,6 @@ TEST_F(AtomStyleTest, template)
TEST_F(AtomStyleTest, template_charge) TEST_F(AtomStyleTest, template_charge)
{ {
if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP(); if (!LAMMPS::is_installed_pkg("MOLECULE")) GTEST_SKIP();
create_molecule_files();
BEGIN_HIDE_OUTPUT(); BEGIN_HIDE_OUTPUT();
command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0");
command("atom_style hybrid template twomols charge"); command("atom_style hybrid template twomols charge");

View File

@ -35,7 +35,7 @@ using utils::split_words;
#define test_name test_info_->name() #define test_name test_info_->name()
static void create_molecule_files() static void create_molecule_files(const std::string & h2o_filename, const std::string & co2_filename)
{ {
// create molecule files // create molecule files
const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n" const char h2o_file[] = "# Water molecule. SPC/E model.\n\n3 atoms\n2 bonds\n1 angles\n\n"
@ -60,18 +60,16 @@ static void create_molecule_files()
"Special Bond Counts\n\n1 2 0 0\n2 1 1 0\n3 1 1 0\n\n" "Special Bond Counts\n\n1 2 0 0\n2 1 1 0\n3 1 1 0\n\n"
"Special Bonds\n\n1 2 3\n2 1 3\n3 1 2\n\n"; "Special Bonds\n\n1 2 3\n2 1 3\n3 1 2\n\n";
FILE *fp = fopen("tmp.h2o.mol", "w"); FILE *fp = fopen(h2o_filename.c_str(), "w");
if (fp) { if (fp) {
fputs(h2o_file, fp); fputs(h2o_file, fp);
fclose(fp); fclose(fp);
} }
rename("tmp.h2o.mol", "h2o.mol"); fp = fopen(co2_filename.c_str(), "w");
fp = fopen("tmp.co2.mol", "w");
if (fp) { if (fp) {
fputs(co2_file, fp); fputs(co2_file, fp);
fclose(fp); fclose(fp);
} }
rename("tmp.co2.mol", "co2.mol");
} }
// whether to print verbose output (i.e. not capturing LAMMPS screen output). // whether to print verbose output (i.e. not capturing LAMMPS screen output).
@ -79,26 +77,30 @@ bool verbose = false;
class MoleculeFileTest : public LAMMPSTest { class MoleculeFileTest : public LAMMPSTest {
protected: protected:
static void SetUpTestSuite() {
create_molecule_files("moltest.h2o.mol", "moltest.co2.mol");
}
static void TearDownTestSuite() {
remove("moltest.h2o.mol");
remove("moltest.co2.mol");
}
void SetUp() override void SetUp() override
{ {
testbinary = "MoleculeFileTest"; testbinary = "MoleculeFileTest";
LAMMPSTest::SetUp(); LAMMPSTest::SetUp();
ASSERT_NE(lmp, nullptr); ASSERT_NE(lmp, nullptr);
BEGIN_HIDE_OUTPUT();
create_molecule_files();
END_HIDE_OUTPUT();
} }
void TearDown() override void TearDown() override
{ {
LAMMPSTest::TearDown(); LAMMPSTest::TearDown();
remove("h2o.mol");
remove("co2.mol");
} }
void run_mol_cmd(const std::string &name, const std::string &args, const std::string &content) void run_mol_cmd(const std::string &name, const std::string &args, const std::string &content)
{ {
std::string file = name + ".mol"; std::string file = fmt::format("moltest_{}.mol", name);
FILE *fp = fopen(file.c_str(), "w"); FILE *fp = fopen(file.c_str(), "w");
fputs(content.c_str(), fp); fputs(content.c_str(), fp);
fclose(fp); fclose(fp);
@ -195,7 +197,7 @@ TEST_F(MoleculeFileTest, twomols)
TEST_F(MoleculeFileTest, twofiles) TEST_F(MoleculeFileTest, twofiles)
{ {
BEGIN_CAPTURE_OUTPUT(); BEGIN_CAPTURE_OUTPUT();
command("molecule twomols h2o.mol co2.mol offset 2 1 1 0 0"); command("molecule twomols moltest.h2o.mol moltest.co2.mol offset 2 1 1 0 0");
auto output = END_CAPTURE_OUTPUT(); auto output = END_CAPTURE_OUTPUT();
ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms " ASSERT_THAT(output, MatchesRegex(".*Read molecule template twomols:.*1 molecules.*3 atoms "
"with max type 2.*2 bonds with max type 1.*" "with max type 2.*2 bonds with max type 1.*"

View File

@ -42,6 +42,9 @@ using ::testing::MatchesRegex;
auto mesg = ::testing::internal::GetCapturedStdout(); \ auto mesg = ::testing::internal::GetCapturedStdout(); \
ASSERT_THAT(mesg, MatchesRegex(errmsg)); \ ASSERT_THAT(mesg, MatchesRegex(errmsg)); \
} \ } \
else { \
std::cerr << "[ ] [ INFO ] Skipping death test (no exception support) \n"; \
} \
} }
// whether to print verbose output (i.e. not capturing LAMMPS screen output). // whether to print verbose output (i.e. not capturing LAMMPS screen output).