This commit is contained in:
@ -1421,11 +1421,11 @@ target API.
|
||||
<td>CUDA SM architecture targeted by GPU package</td>
|
||||
<td>
|
||||
<dl>
|
||||
<dt><code>sm20</code> (Fermi)</dt>
|
||||
<dt><code>sm30</code> (Kepler)</dt>
|
||||
<dt><code>sm50</code> (Maxwell)</dt>
|
||||
<dt><code>sm60</code> (Pascal)</dt>
|
||||
<dt><code>sm70</code> (Volta)</dt>
|
||||
<dt><code>sm_20</code> (Fermi)</dt>
|
||||
<dt><code>sm_30</code> (Kepler)</dt>
|
||||
<dt><code>sm_50</code> (Maxwell)</dt>
|
||||
<dt><code>sm_60</code> (Pascal)</dt>
|
||||
<dt><code>sm_70</code> (Volta)</dt>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -476,7 +476,7 @@ is the name of the class. This code allows LAMMPS to find your fix
|
||||
when it parses input script. In addition, your fix header must be
|
||||
included in the file "style\_fix.h". In case if you use LAMMPS make,
|
||||
this file is generated automatically - all files starting with prefix
|
||||
fix\_ are included, so call your header the same way. Otherwise, don<EFBFBD>t
|
||||
fix\_ are included, so call your header the same way. Otherwise, don't
|
||||
forget to add your include into "style\_fix.h".
|
||||
|
||||
Let's write a simple fix which will print average velocity at the end
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<!-- HTML_ONLY -->
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="29 Jun 2018 version">
|
||||
<META NAME="docnumber" CONTENT="16 Jul 2018 version">
|
||||
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
|
||||
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
|
||||
</HEAD>
|
||||
@ -19,7 +19,7 @@
|
||||
:line
|
||||
|
||||
LAMMPS Documentation :c,h1
|
||||
29 Jun 2018 version :c,h2
|
||||
16 Jul 2018 version :c,h2
|
||||
|
||||
Version info: :h3
|
||||
|
||||
|
||||
@ -582,7 +582,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
|
||||
"dt/reset"_fix_dt_reset.html,
|
||||
"efield"_fix_efield.html,
|
||||
"ehex"_fix_ehex.html,
|
||||
"enforce2d"_fix_enforce2d.html,
|
||||
"enforce2d (k)"_fix_enforce2d.html,
|
||||
"evaporate"_fix_evaporate.html,
|
||||
"external"_fix_external.html,
|
||||
"freeze"_fix_freeze.html,
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
:line
|
||||
|
||||
fix enforce2d command :h3
|
||||
fix enforce2d/kk command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
@ -27,12 +28,13 @@ not move from their initial z coordinate.
|
||||
|
||||
:line
|
||||
|
||||
Styles with a suffix are functionally the same as the corresponding
|
||||
style without the suffix. They have been optimized to run faster,
|
||||
depending on your available hardware, as discussed in
|
||||
"Section 5"_Section_accelerate.html of the manual. The
|
||||
accelerated styles take the same arguments and should produce the same
|
||||
results, except for round-off and precision issues.
|
||||
Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are
|
||||
functionally the same as the corresponding style without the suffix.
|
||||
They have been optimized to run faster, depending on your available
|
||||
hardware, as discussed in "Section 5"_Section_accelerate.html
|
||||
of the manual. The accelerated styles take the same arguments and
|
||||
should produce the same results, except for round-off and precision
|
||||
issues.
|
||||
|
||||
These accelerated styles are part of the GPU, USER-INTEL, KOKKOS,
|
||||
USER-OMP and OPT packages, respectively. They are only enabled if
|
||||
|
||||
@ -36,6 +36,8 @@ keyword = {type} or {type/fraction} or {mol} or {x} or {y} or {z} or \
|
||||
value can be an atom-style variable (see below)
|
||||
{x},{y},{z} value = atom coordinate (distance units)
|
||||
value can be an atom-style variable (see below)
|
||||
{vx},{vy},{vz} value = atom velocity (velocity units)
|
||||
value can be an atom-style variable (see below)
|
||||
{charge} value = atomic charge (charge units)
|
||||
value can be an atom-style variable (see below)
|
||||
{dipole} values = x y z
|
||||
@ -127,6 +129,7 @@ set type 3 charge 0.5
|
||||
set type 1*3 charge 0.5
|
||||
set atom * charge v_atomfile
|
||||
set atom 100*200 x 0.5 y 1.0
|
||||
set atom 100 vx 0.0 vy 0.0 vz -1.0
|
||||
set atom 1492 type 3 :pre
|
||||
|
||||
[Description:]
|
||||
@ -225,7 +228,8 @@ IDs.
|
||||
|
||||
Keywords {x}, {y}, {z}, and {charge} set the coordinates or charge of
|
||||
all selected atoms. For {charge}, the "atom style"_atom_style.html
|
||||
being used must support the use of atomic charge.
|
||||
being used must support the use of atomic charge. Keywords {vx}, {vy},
|
||||
and {vz} set the velocities of all selected atoms.
|
||||
|
||||
Keyword {dipole} uses the specified x,y,z values as components of a
|
||||
vector to set as the orientation of the dipole moment vectors of the
|
||||
|
||||
@ -708,6 +708,12 @@ class Atom(object):
|
||||
self.lmp.eval("vy[%d]" % self.index),
|
||||
self.lmp.eval("vz[%d]" % self.index))
|
||||
|
||||
@velocity.setter
|
||||
def velocity(self, value):
|
||||
self.lmp.set("atom", self.index, "vx", value[0])
|
||||
self.lmp.set("atom", self.index, "vy", value[1])
|
||||
self.lmp.set("atom", self.index, "vz", value[2])
|
||||
|
||||
@property
|
||||
def force(self):
|
||||
return (self.lmp.eval("fx[%d]" % self.index),
|
||||
@ -738,6 +744,11 @@ class Atom2D(Atom):
|
||||
return (self.lmp.eval("vx[%d]" % self.index),
|
||||
self.lmp.eval("vy[%d]" % self.index))
|
||||
|
||||
@velocity.setter
|
||||
def velocity(self, value):
|
||||
self.lmp.set("atom", self.index, "vx", value[0])
|
||||
self.lmp.set("atom", self.index, "vy", value[1])
|
||||
|
||||
@property
|
||||
def force(self):
|
||||
return (self.lmp.eval("fx[%d]" % self.index),
|
||||
|
||||
@ -93,6 +93,8 @@ action domain_kokkos.cpp
|
||||
action domain_kokkos.h
|
||||
action fix_deform_kokkos.cpp
|
||||
action fix_deform_kokkos.h
|
||||
action fix_enforce2d_kokkos.cpp
|
||||
action fix_enforce2d_kokkos.h
|
||||
action fix_eos_table_rx_kokkos.cpp fix_eos_table_rx.cpp
|
||||
action fix_eos_table_rx_kokkos.h fix_eos_table_rx.h
|
||||
action fix_langevin_kokkos.cpp
|
||||
|
||||
168
src/KOKKOS/fix_enforce2d_kokkos.cpp
Normal file
168
src/KOKKOS/fix_enforce2d_kokkos.cpp
Normal file
@ -0,0 +1,168 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing authors: Stefan Paquay & Matthew Peterson (Brandeis University)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "atom_masks.h"
|
||||
#include "atom_kokkos.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "fix_enforce2d_kokkos.h"
|
||||
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
|
||||
template <class DeviceType>
|
||||
FixEnforce2DKokkos<DeviceType>::FixEnforce2DKokkos(LAMMPS *lmp, int narg, char **arg) :
|
||||
FixEnforce2D(lmp, narg, arg)
|
||||
{
|
||||
kokkosable = 1;
|
||||
atomKK = (AtomKokkos *) atom;
|
||||
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||
|
||||
datamask_read = V_MASK | F_MASK | OMEGA_MASK | MASK_MASK
|
||||
| TORQUE_MASK | ANGMOM_MASK;
|
||||
|
||||
datamask_modify = V_MASK | F_MASK | OMEGA_MASK
|
||||
| TORQUE_MASK | ANGMOM_MASK;
|
||||
}
|
||||
|
||||
|
||||
template <class DeviceType>
|
||||
void FixEnforce2DKokkos<DeviceType>::setup(int vflag)
|
||||
{
|
||||
post_force(vflag);
|
||||
}
|
||||
|
||||
|
||||
template <class DeviceType>
|
||||
void FixEnforce2DKokkos<DeviceType>::post_force(int vflag)
|
||||
{
|
||||
atomKK->sync(execution_space,datamask_read);
|
||||
|
||||
v = atomKK->k_v.view<DeviceType>();
|
||||
f = atomKK->k_f.view<DeviceType>();
|
||||
|
||||
if( atomKK->omega_flag )
|
||||
omega = atomKK->k_omega.view<DeviceType>();
|
||||
|
||||
if( atomKK->angmom_flag )
|
||||
angmom = atomKK->k_angmom.view<DeviceType>();
|
||||
|
||||
if( atomKK->torque_flag )
|
||||
torque = atomKK->k_torque.view<DeviceType>();
|
||||
|
||||
|
||||
mask = atomKK->k_mask.view<DeviceType>();
|
||||
|
||||
int nlocal = atomKK->nlocal;
|
||||
if (igroup == atomKK->firstgroup) nlocal = atomKK->nfirst;
|
||||
|
||||
int flag_mask = 0;
|
||||
if( atomKK->omega_flag ) flag_mask |= 1;
|
||||
if( atomKK->angmom_flag ) flag_mask |= 2;
|
||||
if( atomKK->torque_flag ) flag_mask |= 4;
|
||||
|
||||
copymode = 1;
|
||||
switch( flag_mask ){
|
||||
case 0:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,0,0,0> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 1:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,1,0,0> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 2:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,0,1,0> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 3:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,1,1,0> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,0,0,1> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 5:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,1,0,1> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 6:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,0,1,1> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
case 7:{
|
||||
FixEnforce2DKokkosPostForceFunctor<DeviceType,1,1,1> functor(this);
|
||||
Kokkos::parallel_for(nlocal,functor);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
error->all(FLERR, "Flag in fix_enforce2d_kokkos outside of what it should be");
|
||||
}
|
||||
copymode = 0;
|
||||
|
||||
atomKK->modified(execution_space,datamask_modify);
|
||||
|
||||
for (int m = 0; m < nfixlist; m++) {
|
||||
atomKK->sync(flist[m]->execution_space,flist[m]->datamask_read);
|
||||
flist[m]->enforce2d();
|
||||
atomKK->modified(flist[m]->execution_space,flist[m]->datamask_modify);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <class DeviceType>
|
||||
template <int omega_flag, int angmom_flag, int torque_flag>
|
||||
void FixEnforce2DKokkos<DeviceType>::post_force_item( int i ) const
|
||||
{
|
||||
if (mask[i] & groupbit){
|
||||
v(i,2) = 0.0;
|
||||
f(i,2) = 0.0;
|
||||
|
||||
if(omega_flag){
|
||||
omega(i,0) = 0.0;
|
||||
omega(i,1) = 0.0;
|
||||
}
|
||||
|
||||
if(angmom_flag){
|
||||
angmom(i,0) = 0.0;
|
||||
angmom(i,1) = 0.0;
|
||||
}
|
||||
|
||||
if(torque_flag){
|
||||
torque(i,0) = 0.0;
|
||||
torque(i,1) = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
template class FixEnforce2DKokkos<LMPDeviceType>;
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
template class FixEnforce2DKokkos<LMPHostType>;
|
||||
#endif
|
||||
}
|
||||
84
src/KOKKOS/fix_enforce2d_kokkos.h
Normal file
84
src/KOKKOS/fix_enforce2d_kokkos.h
Normal file
@ -0,0 +1,84 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FIX_CLASS
|
||||
|
||||
FixStyle(enforce2d/kk,FixEnforce2DKokkos<LMPDeviceType>)
|
||||
FixStyle(enforce2d/kk/device,FixEnforce2DKokkos<LMPDeviceType>)
|
||||
FixStyle(enforce2d/kk/host,FixEnforce2DKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_FIX_ENFORCE2D_KOKKOS_H
|
||||
#define LMP_FIX_ENFORCE2D_KOKKOS_H
|
||||
|
||||
#include "fix_enforce2d.h"
|
||||
#include "kokkos_type.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<class DeviceType>
|
||||
class FixEnforce2DKokkos : public FixEnforce2D {
|
||||
public:
|
||||
FixEnforce2DKokkos(class LAMMPS *, int, char **);
|
||||
// ~FixEnforce2DKokkos() {}
|
||||
void setup(int);
|
||||
void post_force(int);
|
||||
|
||||
template <int omega_flag, int angmom_flag, int torque_flag>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void post_force_item(const int i) const;
|
||||
|
||||
// void min_setup(int); Kokkos does not support minimization (yet)
|
||||
// void min_post_force(int); Kokkos does not support minimization (yet)
|
||||
// void post_force_respa(int, int, int); No RRESPA support yet.
|
||||
|
||||
private:
|
||||
typename ArrayTypes<DeviceType>::t_v_array v;
|
||||
typename ArrayTypes<DeviceType>::t_f_array f;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_v_array omega;
|
||||
typename ArrayTypes<DeviceType>::t_v_array angmom;
|
||||
typename ArrayTypes<DeviceType>::t_f_array torque;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_int_1d mask;
|
||||
};
|
||||
|
||||
|
||||
template <class DeviceType, int omega_flag, int angmom_flag, int torque_flag>
|
||||
struct FixEnforce2DKokkosPostForceFunctor {
|
||||
typedef DeviceType device_type;
|
||||
FixEnforce2DKokkos<DeviceType> c;
|
||||
|
||||
FixEnforce2DKokkosPostForceFunctor(FixEnforce2DKokkos<DeviceType>* c_ptr):
|
||||
c(*c_ptr) {};
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(const int i) const {
|
||||
c.template post_force_item <omega_flag, angmom_flag, torque_flag>(i);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Flag in fix_enforce2d_kokkos outside of what it should be
|
||||
|
||||
LAMMPS developer-only error.
|
||||
|
||||
*/
|
||||
@ -343,6 +343,7 @@ void PairReaxCKokkos<DeviceType>::init_md()
|
||||
|
||||
swa = control->nonb_low;
|
||||
swb = control->nonb_cut;
|
||||
enobondsflag = control->enobondsflag;
|
||||
|
||||
if (fabs(swa) > 0.01 )
|
||||
error->warning(FLERR,"Warning: non-zero lower Taper-radius cutoff");
|
||||
@ -2272,12 +2273,12 @@ void PairReaxCKokkos<DeviceType>::operator()(PairReaxComputeMulti2<NEIGHFLAG,EVF
|
||||
int numbonds = d_bo_num[i];
|
||||
|
||||
e_lp = 0.0;
|
||||
if (numbonds > 0 || control->enobondsflag)
|
||||
if (numbonds > 0 || enobondsflag)
|
||||
e_lp = p_lp2 * d_Delta_lp[i] * inv_expvd2;
|
||||
const F_FLOAT dElp = p_lp2 * inv_expvd2 + 75.0 * p_lp2 * d_Delta_lp[i] * expvd2 * inv_expvd2*inv_expvd2;
|
||||
const F_FLOAT CElp = dElp * d_dDelta_lp[i];
|
||||
|
||||
if (numbonds > 0 || control->enobondsflag)
|
||||
if (numbonds > 0 || enobondsflag)
|
||||
a_CdDelta[i] += CElp;
|
||||
|
||||
if (eflag) ev.ereax[0] += e_lp;
|
||||
@ -2314,7 +2315,7 @@ void PairReaxCKokkos<DeviceType>::operator()(PairReaxComputeMulti2<NEIGHFLAG,EVF
|
||||
const F_FLOAT inv_exp_ovun8 = 1.0 / (1.0 + exp_ovun8);
|
||||
|
||||
e_un = 0;
|
||||
if (numbonds > 0 || control->enobondsflag)
|
||||
if (numbonds > 0 || enobondsflag)
|
||||
e_un = -p_ovun5 * (1.0 - exp_ovun6) * inv_exp_ovun2n * inv_exp_ovun8;
|
||||
|
||||
if (eflag) ev.ereax[2] += e_un;
|
||||
@ -2334,7 +2335,7 @@ void PairReaxCKokkos<DeviceType>::operator()(PairReaxComputeMulti2<NEIGHFLAG,EVF
|
||||
// multibody forces
|
||||
|
||||
a_CdDelta[i] += CEover3;
|
||||
if (numbonds > 0 || control->enobondsflag)
|
||||
if (numbonds > 0 || enobondsflag)
|
||||
a_CdDelta[i] += CEunder3;
|
||||
|
||||
const int j_start = d_bo_first[i];
|
||||
|
||||
@ -427,7 +427,7 @@ class PairReaxCKokkos : public PairReaxC {
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairReaxCKokkos>(PairReaxCKokkos*);
|
||||
|
||||
int bocnt,hbcnt;
|
||||
int bocnt,hbcnt,enobondsflag;
|
||||
|
||||
typedef LR_lookup_table_kk<DeviceType> LR_lookup_table_kk_DT;
|
||||
|
||||
|
||||
@ -38,6 +38,8 @@ FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
FixEnforce2D::~FixEnforce2D()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
delete [] flist;
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class FixEnforce2D : public Fix {
|
||||
void post_force_respa(int, int, int);
|
||||
void min_post_force(int);
|
||||
|
||||
private:
|
||||
protected:
|
||||
int nfixlist;
|
||||
class Fix **flist;
|
||||
};
|
||||
|
||||
@ -62,7 +62,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT,
|
||||
MULTIPROC,MPIIO,PROCSPERFILE,PERPROC,
|
||||
IMAGEINT,BOUNDMIN,TIMESTEP,
|
||||
ATOM_ID,ATOM_MAP_STYLE,ATOM_MAP_USER,ATOM_SORTFREQ,ATOM_SORTBIN,
|
||||
COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR};
|
||||
COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR,
|
||||
EXTRA_BOND_PER_ATOM,EXTRA_ANGLE_PER_ATOM,EXTRA_DIHEDRAL_PER_ATOM,
|
||||
EXTRA_IMPROPER_PER_ATOM,EXTRA_SPECIAL_PER_ATOM};
|
||||
|
||||
#define LB_FACTOR 1.1
|
||||
|
||||
@ -914,6 +916,17 @@ void ReadRestart::header(int incompatible)
|
||||
} else if (flag == COMM_VEL) {
|
||||
comm->ghost_velocity = read_int();
|
||||
|
||||
} else if (flag == EXTRA_BOND_PER_ATOM) {
|
||||
atom->extra_bond_per_atom = read_int();
|
||||
} else if (flag == EXTRA_ANGLE_PER_ATOM) {
|
||||
atom->extra_angle_per_atom = read_int();
|
||||
} else if (flag == EXTRA_DIHEDRAL_PER_ATOM) {
|
||||
atom->extra_dihedral_per_atom = read_int();
|
||||
} else if (flag == EXTRA_IMPROPER_PER_ATOM) {
|
||||
atom->extra_improper_per_atom = read_int();
|
||||
} else if (flag == EXTRA_SPECIAL_PER_ATOM) {
|
||||
force->special_extra = read_int();
|
||||
|
||||
} else error->all(FLERR,"Invalid flag in header section of restart file");
|
||||
|
||||
flag = read_int();
|
||||
|
||||
26
src/set.cpp
26
src/set.cpp
@ -48,7 +48,7 @@ enum{TYPE,TYPE_FRACTION,MOLECULE,X,Y,Z,CHARGE,MASS,SHAPE,LENGTH,TRI,
|
||||
THETA,THETA_RANDOM,ANGMOM,OMEGA,
|
||||
DIAMETER,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER,
|
||||
MESO_E,MESO_CV,MESO_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY,
|
||||
SMD_CONTACT_RADIUS,DPDTHETA,INAME,DNAME};
|
||||
SMD_CONTACT_RADIUS,DPDTHETA,INAME,DNAME,VX,VY,VZ};
|
||||
|
||||
#define BIG INT_MAX
|
||||
|
||||
@ -141,6 +141,27 @@ void Set::command(int narg, char **arg)
|
||||
set(Z);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vx") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else dvalue = force->numeric(FLERR,arg[iarg+1]);
|
||||
set(VX);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vy") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else dvalue = force->numeric(FLERR,arg[iarg+1]);
|
||||
set(VY);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vz") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
else dvalue = force->numeric(FLERR,arg[iarg+1]);
|
||||
set(VZ);
|
||||
iarg += 2;
|
||||
|
||||
} else if (strcmp(arg[iarg],"charge") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal set command");
|
||||
if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1);
|
||||
@ -732,6 +753,9 @@ void Set::set(int keyword)
|
||||
else if (keyword == X) atom->x[i][0] = dvalue;
|
||||
else if (keyword == Y) atom->x[i][1] = dvalue;
|
||||
else if (keyword == Z) atom->x[i][2] = dvalue;
|
||||
else if (keyword == VX) atom->v[i][0] = dvalue;
|
||||
else if (keyword == VY) atom->v[i][1] = dvalue;
|
||||
else if (keyword == VZ) atom->v[i][2] = dvalue;
|
||||
else if (keyword == CHARGE) atom->q[i] = dvalue;
|
||||
else if (keyword == MASS) {
|
||||
if (dvalue <= 0.0) error->one(FLERR,"Invalid mass in set command");
|
||||
|
||||
@ -1 +1 @@
|
||||
#define LAMMPS_VERSION "29 Jun 2018"
|
||||
#define LAMMPS_VERSION "16 Jul 2018"
|
||||
|
||||
@ -61,7 +61,9 @@ enum{VERSION,SMALLINT,TAGINT,BIGINT,
|
||||
MULTIPROC,MPIIO,PROCSPERFILE,PERPROC,
|
||||
IMAGEINT,BOUNDMIN,TIMESTEP,
|
||||
ATOM_ID,ATOM_MAP_STYLE,ATOM_MAP_USER,ATOM_SORTFREQ,ATOM_SORTBIN,
|
||||
COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR};
|
||||
COMM_MODE,COMM_CUTOFF,COMM_VEL,NO_PAIR,
|
||||
EXTRA_BOND_PER_ATOM,EXTRA_ANGLE_PER_ATOM,EXTRA_DIHEDRAL_PER_ATOM,
|
||||
EXTRA_IMPROPER_PER_ATOM,EXTRA_SPECIAL_PER_ATOM};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -527,6 +529,12 @@ void WriteRestart::header()
|
||||
write_double(COMM_CUTOFF,comm->cutghostuser);
|
||||
write_int(COMM_VEL,comm->ghost_velocity);
|
||||
|
||||
write_int(EXTRA_BOND_PER_ATOM,atom->extra_bond_per_atom);
|
||||
write_int(EXTRA_ANGLE_PER_ATOM,atom->extra_angle_per_atom);
|
||||
write_int(EXTRA_DIHEDRAL_PER_ATOM,atom->extra_dihedral_per_atom);
|
||||
write_int(EXTRA_IMPROPER_PER_ATOM,atom->extra_improper_per_atom);
|
||||
write_int(EXTRA_SPECIAL_PER_ATOM,force->special_extra);
|
||||
|
||||
// -1 flag signals end of header
|
||||
|
||||
int flag = -1;
|
||||
|
||||
Reference in New Issue
Block a user