whitespace
This commit is contained in:
@ -56,6 +56,7 @@ FixCMAPKokkos<DeviceType>::FixCMAPKokkos(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
datamask_modify = F_MASK;
|
datamask_modify = F_MASK;
|
||||||
|
|
||||||
// allocate memory for CMAP data
|
// allocate memory for CMAP data
|
||||||
|
|
||||||
memoryKK->create_kokkos(k_g_axis,g_axis,CMAPDIM,"cmap:g_axis");
|
memoryKK->create_kokkos(k_g_axis,g_axis,CMAPDIM,"cmap:g_axis");
|
||||||
memoryKK->create_kokkos(k_cmapgrid,cmapgrid,CMAPMAX,CMAPDIM,CMAPDIM,"cmap:grid");
|
memoryKK->create_kokkos(k_cmapgrid,cmapgrid,CMAPMAX,CMAPDIM,CMAPDIM,"cmap:grid");
|
||||||
memoryKK->create_kokkos(k_d1cmapgrid,d1cmapgrid,CMAPMAX,CMAPDIM,CMAPDIM,"cmap:d1grid");
|
memoryKK->create_kokkos(k_d1cmapgrid,d1cmapgrid,CMAPMAX,CMAPDIM,CMAPDIM,"cmap:d1grid");
|
||||||
@ -69,6 +70,7 @@ FixCMAPKokkos<DeviceType>::FixCMAPKokkos(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
d_d12cmapgrid = k_d12cmapgrid.template view<DeviceType>();
|
d_d12cmapgrid = k_d12cmapgrid.template view<DeviceType>();
|
||||||
|
|
||||||
// read and setup CMAP data
|
// read and setup CMAP data
|
||||||
|
|
||||||
read_grid_map(arg[3]);
|
read_grid_map(arg[3]);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -88,6 +90,7 @@ FixCMAPKokkos<DeviceType>::FixCMAPKokkos(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
for( int i=0 ; i<CMAPMAX ; i++ ) {
|
for( int i=0 ; i<CMAPMAX ; i++ ) {
|
||||||
|
|
||||||
// pre-compute the derivatives of the maps
|
// pre-compute the derivatives of the maps
|
||||||
|
|
||||||
set_map_derivatives(cmapgrid[i],d1cmapgrid[i],d2cmapgrid[i],d12cmapgrid[i]);
|
set_map_derivatives(cmapgrid[i],d1cmapgrid[i],d2cmapgrid[i],d12cmapgrid[i]);
|
||||||
|
|
||||||
for( int j=0 ; j<CMAPDIM ; j++ ) {
|
for( int j=0 ; j<CMAPDIM ; j++ ) {
|
||||||
@ -111,7 +114,6 @@ FixCMAPKokkos<DeviceType>::FixCMAPKokkos(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
k_d1cmapgrid.template sync<DeviceType>();
|
k_d1cmapgrid.template sync<DeviceType>();
|
||||||
k_d2cmapgrid.template sync<DeviceType>();
|
k_d2cmapgrid.template sync<DeviceType>();
|
||||||
k_d12cmapgrid.template sync<DeviceType>();
|
k_d12cmapgrid.template sync<DeviceType>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -136,7 +138,6 @@ FixCMAPKokkos<DeviceType>::~FixCMAPKokkos()
|
|||||||
memoryKK->destroy_kokkos(k_crossterm_atom5,crossterm_atom5);
|
memoryKK->destroy_kokkos(k_crossterm_atom5,crossterm_atom5);
|
||||||
|
|
||||||
memoryKK->destroy_kokkos(d_crosstermlist);
|
memoryKK->destroy_kokkos(d_crosstermlist);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -148,6 +149,7 @@ void FixCMAPKokkos<DeviceType>::init()
|
|||||||
error->all(FLERR,"Cannot yet use respa with Kokkos");
|
error->all(FLERR,"Cannot yet use respa with Kokkos");
|
||||||
|
|
||||||
// on KOKKOS, allocate enough for all crossterms on each GPU to avoid grow operation in device code
|
// on KOKKOS, allocate enough for all crossterms on each GPU to avoid grow operation in device code
|
||||||
|
|
||||||
maxcrossterm = ncmap;
|
maxcrossterm = ncmap;
|
||||||
memoryKK->create_kokkos(d_crosstermlist,maxcrossterm,CMAPMAX,"cmap:crosstermlist");
|
memoryKK->create_kokkos(d_crosstermlist,maxcrossterm,CMAPMAX,"cmap:crosstermlist");
|
||||||
}
|
}
|
||||||
@ -159,7 +161,6 @@ void FixCMAPKokkos<DeviceType>::init()
|
|||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
void FixCMAPKokkos<DeviceType>::pre_neighbor()
|
void FixCMAPKokkos<DeviceType>::pre_neighbor()
|
||||||
{
|
{
|
||||||
|
|
||||||
atomKK->sync(execution_space,X_MASK);
|
atomKK->sync(execution_space,X_MASK);
|
||||||
d_x = atomKK->k_x.view<DeviceType>();
|
d_x = atomKK->k_x.view<DeviceType>();
|
||||||
int nlocal = atomKK->nlocal;
|
int nlocal = atomKK->nlocal;
|
||||||
@ -179,14 +180,12 @@ void FixCMAPKokkos<DeviceType>::pre_neighbor()
|
|||||||
copymode = 1;
|
copymode = 1;
|
||||||
Kokkos::parallel_scan(Kokkos::RangePolicy<DeviceType,TagFixCmapPreNeighbor>(0,nlocal),*this,ncrosstermlist);
|
Kokkos::parallel_scan(Kokkos::RangePolicy<DeviceType,TagFixCmapPreNeighbor>(0,nlocal),*this,ncrosstermlist);
|
||||||
copymode = 0;
|
copymode = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
void FixCMAPKokkos<DeviceType>::operator()(TagFixCmapPreNeighbor, const int i, int &l_ncrosstermlist, const bool is_final ) const
|
void FixCMAPKokkos<DeviceType>::operator()(TagFixCmapPreNeighbor, const int i, int &l_ncrosstermlist, const bool is_final ) const
|
||||||
{
|
{
|
||||||
|
|
||||||
for( int m = 0; m < d_num_crossterm(i); m++) {
|
for( int m = 0; m < d_num_crossterm(i); m++) {
|
||||||
|
|
||||||
int atom1 = AtomKokkos::map_kokkos<DeviceType>(d_crossterm_atom1(i,m),map_style,k_map_array,k_map_hash);
|
int atom1 = AtomKokkos::map_kokkos<DeviceType>(d_crossterm_atom1(i,m),map_style,k_map_array,k_map_hash);
|
||||||
@ -297,6 +296,7 @@ void FixCMAPKokkos<DeviceType>::operator()(TagFixCmapPostForce, const int n, dou
|
|||||||
double vb45z = d_x(i4,2) - d_x(i5,2);
|
double vb45z = d_x(i4,2) - d_x(i5,2);
|
||||||
|
|
||||||
// calculate normal vectors for planes that define the dihedral angles
|
// calculate normal vectors for planes that define the dihedral angles
|
||||||
|
|
||||||
double a1x = vb12y*vb23z - vb12z*vb23y;
|
double a1x = vb12y*vb23z - vb12z*vb23y;
|
||||||
double a1y = vb12z*vb23x - vb12x*vb23z;
|
double a1y = vb12z*vb23x - vb12x*vb23z;
|
||||||
double a1z = vb12x*vb23y - vb12y*vb23x;
|
double a1z = vb12x*vb23y - vb12y*vb23x;
|
||||||
@ -325,6 +325,7 @@ void FixCMAPKokkos<DeviceType>::operator()(TagFixCmapPostForce, const int n, dou
|
|||||||
if (a1sq<0.0001 || b1sq<0.0001 || a2sq<0.0001 || b2sq<0.0001) return;
|
if (a1sq<0.0001 || b1sq<0.0001 || a2sq<0.0001 || b2sq<0.0001) return;
|
||||||
|
|
||||||
// vectors needed to calculate the cross-term dihedral angles
|
// vectors needed to calculate the cross-term dihedral angles
|
||||||
|
|
||||||
double dpr21r32 = vb21x*vb32x + vb21y*vb32y + vb21z*vb32z;
|
double dpr21r32 = vb21x*vb32x + vb21y*vb32y + vb21z*vb32z;
|
||||||
double dpr34r32 = vb34x*vb32x + vb34y*vb32y + vb34z*vb32z;
|
double dpr34r32 = vb34x*vb32x + vb34y*vb32y + vb34z*vb32z;
|
||||||
double dpr32r43 = vb32x*vb43x + vb32y*vb43y + vb32z*vb43z;
|
double dpr32r43 = vb32x*vb43x + vb32y*vb43y + vb32z*vb43z;
|
||||||
@ -388,8 +389,8 @@ void FixCMAPKokkos<DeviceType>::operator()(TagFixCmapPostForce, const int n, dou
|
|||||||
bc_interpol(phi,psi,li3,li4,gs,d1gs,d2gs,d12gs,E,dEdPhi,dEdPsi);
|
bc_interpol(phi,psi,li3,li4,gs,d1gs,d2gs,d12gs,E,dEdPhi,dEdPsi);
|
||||||
|
|
||||||
// sum up cmap energy contributions
|
// sum up cmap energy contributions
|
||||||
|
|
||||||
// needed for compute_scalar()
|
// needed for compute_scalar()
|
||||||
|
|
||||||
double engfraction = 0.2 * E;
|
double engfraction = 0.2 * E;
|
||||||
if (i1 < nlocal) ecmapKK += engfraction;
|
if (i1 < nlocal) ecmapKK += engfraction;
|
||||||
if (i2 < nlocal) ecmapKK += engfraction;
|
if (i2 < nlocal) ecmapKK += engfraction;
|
||||||
@ -479,6 +480,7 @@ void FixCMAPKokkos<DeviceType>::grow_arrays(int nmax)
|
|||||||
k_crossterm_atom5.template sync<LMPHostType>();
|
k_crossterm_atom5.template sync<LMPHostType>();
|
||||||
|
|
||||||
// force reallocation on host
|
// force reallocation on host
|
||||||
|
|
||||||
k_num_crossterm.template modify<LMPHostType>();
|
k_num_crossterm.template modify<LMPHostType>();
|
||||||
k_crossterm_type.template modify<LMPHostType>();
|
k_crossterm_type.template modify<LMPHostType>();
|
||||||
k_crossterm_atom1.template modify<LMPHostType>();
|
k_crossterm_atom1.template modify<LMPHostType>();
|
||||||
@ -877,8 +879,6 @@ void FixCMAPKokkos<DeviceType>::bc_interpol(double x1, double x2, int low1, int
|
|||||||
dEdPsi *= (180.0/MY_PI/CMAPDX);
|
dEdPsi *= (180.0/MY_PI/CMAPDX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
return local index of atom J or any of its images that is closest to atom I
|
return local index of atom J or any of its images that is closest to atom I
|
||||||
if J is not a valid index like -1, just return it
|
if J is not a valid index like -1, just return it
|
||||||
@ -917,7 +917,6 @@ int FixCMAPKokkos<DeviceType>::closest_image(const int i, int j) const
|
|||||||
return closest;
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
template class FixCMAPKokkos<LMPDeviceType>;
|
template class FixCMAPKokkos<LMPDeviceType>;
|
||||||
#ifdef LMP_KOKKOS_GPU
|
#ifdef LMP_KOKKOS_GPU
|
||||||
|
|||||||
@ -120,7 +120,6 @@ void FixNVELimitKokkos<DeviceType>::initial_integrate(int /*vflag*/)
|
|||||||
|
|
||||||
ncount += d_ncount;
|
ncount += d_ncount;
|
||||||
atomKK->modified(execution_space, X_MASK | V_MASK );
|
atomKK->modified(execution_space, X_MASK | V_MASK );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -190,7 +189,6 @@ void FixNVELimitKokkos<DeviceType>::final_integrate()
|
|||||||
|
|
||||||
ncount += d_ncount;
|
ncount += d_ncount;
|
||||||
atomKK->modified(execution_space, V_MASK );
|
atomKK->modified(execution_space, V_MASK );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -50,7 +50,6 @@ FixRecenterKokkos<DeviceType>::FixRecenterKokkos(LAMMPS *lmp, int narg, char **a
|
|||||||
template<class DeviceType>
|
template<class DeviceType>
|
||||||
void FixRecenterKokkos<DeviceType>::initial_integrate(int /*vflag*/)
|
void FixRecenterKokkos<DeviceType>::initial_integrate(int /*vflag*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
atomKK->sync(execution_space,datamask_read);
|
atomKK->sync(execution_space,datamask_read);
|
||||||
int nlocal = atomKK->nlocal;
|
int nlocal = atomKK->nlocal;
|
||||||
if (igroup == atomKK->firstgroup) nlocal = atomKK->nfirst;
|
if (igroup == atomKK->firstgroup) nlocal = atomKK->nfirst;
|
||||||
@ -121,7 +120,6 @@ void FixRecenterKokkos<DeviceType>::initial_integrate(int /*vflag*/)
|
|||||||
atomKK->modified(execution_space,datamask_modify);
|
atomKK->modified(execution_space,datamask_modify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
template class FixRecenterKokkos<LMPDeviceType>;
|
template class FixRecenterKokkos<LMPDeviceType>;
|
||||||
#ifdef LMP_KOKKOS_GPU
|
#ifdef LMP_KOKKOS_GPU
|
||||||
|
|||||||
@ -91,8 +91,8 @@ void FixWallRegionKokkos<DeviceType>::post_force(int vflag)
|
|||||||
// initilize ewall after region->prematch(),
|
// initilize ewall after region->prematch(),
|
||||||
// so a dynamic region can access last timestep values
|
// so a dynamic region can access last timestep values
|
||||||
|
|
||||||
// energy intialize.
|
// energy intialize
|
||||||
// eflag is used to track whether wall energies have been communicated.
|
// eflag is used to track whether wall energies have been communicated
|
||||||
|
|
||||||
eflag = 0;
|
eflag = 0;
|
||||||
double result[10];
|
double result[10];
|
||||||
@ -330,7 +330,6 @@ template <class DeviceType>
|
|||||||
KOKKOS_INLINE_FUNCTION
|
KOKKOS_INLINE_FUNCTION
|
||||||
void FixWallRegionKokkos<DeviceType>::v_tally(value_type result, int i, double *v) const
|
void FixWallRegionKokkos<DeviceType>::v_tally(value_type result, int i, double *v) const
|
||||||
{
|
{
|
||||||
|
|
||||||
if (vflag_global) {
|
if (vflag_global) {
|
||||||
result[4] += v[0];
|
result[4] += v[0];
|
||||||
result[5] += v[1];
|
result[5] += v[1];
|
||||||
@ -348,7 +347,6 @@ void FixWallRegionKokkos<DeviceType>::v_tally(value_type result, int i, double *
|
|||||||
Kokkos::atomic_add(&(d_vatom(i,4)),v[4]);
|
Kokkos::atomic_add(&(d_vatom(i,4)),v[4]);
|
||||||
Kokkos::atomic_add(&(d_vatom(i,5)),v[5]);
|
Kokkos::atomic_add(&(d_vatom(i,5)),v[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|||||||
@ -71,7 +71,6 @@ double GroupKokkos<DeviceType>::mass(int igroup)
|
|||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
compute the center-of-mass coords of group of atoms
|
compute the center-of-mass coords of group of atoms
|
||||||
masstotal = total mass
|
masstotal = total mass
|
||||||
|
|||||||
@ -271,7 +271,6 @@ namespace MathSpecialKokkos {
|
|||||||
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
|
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace MathSpecialKokkos
|
} // namespace MathSpecialKokkos
|
||||||
} // namespace LAMMPS_NS
|
} // namespace LAMMPS_NS
|
||||||
|
|
||||||
|
|||||||
@ -98,6 +98,7 @@ class RegBlockKokkos : public RegBlock, public KokkosBase {
|
|||||||
|
|
||||||
return ncontact;
|
return ncontact;
|
||||||
}
|
}
|
||||||
|
|
||||||
Kokkos::View<Contact*, DeviceType> d_contact;
|
Kokkos::View<Contact*, DeviceType> d_contact;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -417,7 +418,6 @@ double find_closest_point(int i, double *x, double &xc, double &yc, double &zc)
|
|||||||
return d2min;
|
return d2min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,6 @@ void RegSphereKokkos<DeviceType>::operator()(TagRegSphereMatchAll, const int &i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|||||||
@ -131,6 +131,7 @@ FixCMAP::~FixCMAP()
|
|||||||
if (copymode) return;
|
if (copymode) return;
|
||||||
|
|
||||||
// unregister callbacks to this fix from Atom class
|
// unregister callbacks to this fix from Atom class
|
||||||
|
|
||||||
atom->delete_callback(id,Atom::GROW);
|
atom->delete_callback(id,Atom::GROW);
|
||||||
atom->delete_callback(id,Atom::RESTART);
|
atom->delete_callback(id,Atom::RESTART);
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) :
|
|||||||
Region::~Region()
|
Region::~Region()
|
||||||
{
|
{
|
||||||
if (copymode) return;
|
if (copymode) return;
|
||||||
|
|
||||||
delete[] id;
|
delete[] id;
|
||||||
delete[] style;
|
delete[] style;
|
||||||
delete[] xstr;
|
delete[] xstr;
|
||||||
|
|||||||
@ -262,6 +262,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
RegBlock::~RegBlock()
|
RegBlock::~RegBlock()
|
||||||
{
|
{
|
||||||
if (copymode) return;
|
if (copymode) return;
|
||||||
|
|
||||||
delete[] xlostr;
|
delete[] xlostr;
|
||||||
delete[] xhistr;
|
delete[] xhistr;
|
||||||
delete[] ylostr;
|
delete[] ylostr;
|
||||||
|
|||||||
@ -102,6 +102,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
RegSphere::~RegSphere()
|
RegSphere::~RegSphere()
|
||||||
{
|
{
|
||||||
if (copymode) return;
|
if (copymode) return;
|
||||||
|
|
||||||
delete[] xstr;
|
delete[] xstr;
|
||||||
delete[] ystr;
|
delete[] ystr;
|
||||||
delete[] zstr;
|
delete[] zstr;
|
||||||
|
|||||||
Reference in New Issue
Block a user