reformat, minor cosmetic changes
This commit is contained in:
@ -21,13 +21,11 @@
|
||||
#include "atom_kokkos.h"
|
||||
#include "atom_masks.h"
|
||||
#include "comm.h"
|
||||
#include "domain_kokkos.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "update.h"
|
||||
#include "memory_kokkos.h"
|
||||
#include "domain_kokkos.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "update.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@ ComputeStyle(temp/deform/kk/host,ComputeTempDeformKokkos<LMPHostType>);
|
||||
#define LMP_COMPUTE_TEMP_DEFORM_KOKKOS_H
|
||||
|
||||
#include "compute_temp_deform.h"
|
||||
#include "kokkos_type.h"
|
||||
#include "kokkos_few.h"
|
||||
#include "kokkos_type.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -19,13 +18,13 @@ ComputeStyle(temp/kk/device,ComputeTempKokkos<LMPDeviceType>);
|
||||
ComputeStyle(temp/kk/host,ComputeTempKokkos<LMPHostType>);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_COMPUTE_TEMP_KOKKOS_H
|
||||
#define LMP_COMPUTE_TEMP_KOKKOS_H
|
||||
|
||||
#include "compute_temp.h"
|
||||
#include "kokkos_type.h"
|
||||
|
||||
// clang-format off
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<int RMASS>
|
||||
@ -72,7 +71,7 @@ class ComputeTempKokkos : public ComputeTemp {
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
|
||||
ComputeTempKokkos(class LAMMPS *, int, char **);
|
||||
virtual ~ComputeTempKokkos() {};
|
||||
virtual ~ComputeTempKokkos() {}
|
||||
double compute_scalar();
|
||||
void compute_vector();
|
||||
|
||||
|
||||
@ -19,21 +19,19 @@
|
||||
#include "fix_nvt_sllod_kokkos.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom.h"
|
||||
#include "atom_kokkos.h"
|
||||
#include "atom_masks.h"
|
||||
#include "compute.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "fix.h"
|
||||
#include "fix_deform_kokkos.h"
|
||||
#include "group.h"
|
||||
#include "math_extra.h"
|
||||
#include "modify.h"
|
||||
#include "atom_kokkos.h"
|
||||
#include "atom.h"
|
||||
#include "atom_masks.h"
|
||||
#include "kokkos_few.h"
|
||||
#include "math_extra.h"
|
||||
#include "memory_kokkos.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "modify.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -62,15 +60,6 @@ FixNVTSllodKokkos<DeviceType>::FixNVTSllodKokkos(LAMMPS *lmp, int narg, char **a
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
FixNVTSllodKokkos<DeviceType>::~FixNVTSllodKokkos()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void FixNVTSllodKokkos<DeviceType>::init()
|
||||
{
|
||||
@ -82,16 +71,15 @@ void FixNVTSllodKokkos<DeviceType>::init()
|
||||
this->error->all(FLERR,"Temperature for fix nvt/sllod does not have a bias");
|
||||
|
||||
nondeformbias = 0;
|
||||
if (strncmp(this->temperature->style,"temp/deform", 11) != 0) nondeformbias = 1;
|
||||
if (utils::strmatch(this->temperature->style,"^temp/deform")) nondeformbias = 1;
|
||||
|
||||
// check fix deform remap settings
|
||||
|
||||
int i;
|
||||
for (i = 0; i < this->modify->nfix; i++)
|
||||
if (strncmp(this->modify->fix[i]->style,"deform",6) == 0) {
|
||||
if (utils::strmatch(this->modify->fix[i]->style,"^deform")) {
|
||||
if (((FixDeform *) this->modify->fix[i])->remapflag != Domain::V_REMAP)
|
||||
this->error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform "
|
||||
"remap option");
|
||||
this->error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform remap option");
|
||||
break;
|
||||
}
|
||||
if (i == this->modify->nfix)
|
||||
|
||||
@ -23,9 +23,10 @@ FixStyle(nvt/sllod/kk/host,FixNVTSllodKokkos<LMPHostType>);
|
||||
#define LMP_FIX_NVT_SLLOD_KOKKOS_H
|
||||
|
||||
#include "fix_nh_kokkos.h"
|
||||
#include "kokkos_type.h"
|
||||
#include "kokkos_few.h"
|
||||
#include "kokkos_type.h"
|
||||
|
||||
// clang-format off
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
struct TagFixNVTSllod_temp1{};
|
||||
@ -35,7 +36,7 @@ template<class DeviceType>
|
||||
class FixNVTSllodKokkos : public FixNHKokkos<DeviceType> {
|
||||
public:
|
||||
FixNVTSllodKokkos(class LAMMPS *, int, char **);
|
||||
~FixNVTSllodKokkos();
|
||||
~FixNVTSllodKokkos() {}
|
||||
void init();
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.org/, Sandia National Laboratories
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// clang-format off
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://lammps.org/, Sandia National Laboratories
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
@ -14,9 +13,9 @@
|
||||
|
||||
#ifdef KSPACE_CLASS
|
||||
// clang-format off
|
||||
KSpaceStyle(pppm/kk,PPPMKokkos<LMPDeviceType>)
|
||||
KSpaceStyle(pppm/kk/device,PPPMKokkos<LMPDeviceType>)
|
||||
KSpaceStyle(pppm/kk/host,PPPMKokkos<LMPHostType>)
|
||||
KSpaceStyle(pppm/kk,PPPMKokkos<LMPDeviceType>);
|
||||
KSpaceStyle(pppm/kk/device,PPPMKokkos<LMPDeviceType>);
|
||||
KSpaceStyle(pppm/kk/host,PPPMKokkos<LMPHostType>);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
@ -31,6 +30,8 @@ KSpaceStyle(pppm/kk/host,PPPMKokkos<LMPHostType>)
|
||||
#include "kokkos_type.h"
|
||||
#include "kokkos_few.h"
|
||||
|
||||
// clang-format off
|
||||
|
||||
// fix up FFT defines for KOKKOS with CUDA
|
||||
|
||||
#ifdef KOKKOS_ENABLE_CUDA
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -18,27 +17,25 @@
|
||||
|
||||
#include "compute_temp_deform.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "domain.h"
|
||||
#include "atom.h"
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "modify.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "fix.h"
|
||||
#include "fix_deform.h"
|
||||
#include "force.h"
|
||||
#include "group.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "modify.h"
|
||||
#include "update.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg)
|
||||
ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg)
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute temp/deform command");
|
||||
if (narg != 3) error->all(FLERR, "Illegal compute temp/deform command");
|
||||
|
||||
scalar_flag = vector_flag = 1;
|
||||
size_vector = 6;
|
||||
@ -56,10 +53,9 @@ ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
ComputeTempDeform::~ComputeTempDeform()
|
||||
{
|
||||
if (!copymode)
|
||||
{
|
||||
if (!copymode) {
|
||||
memory->destroy(vbiasall);
|
||||
delete [] vector;
|
||||
delete[] vector;
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,16 +68,14 @@ void ComputeTempDeform::init()
|
||||
// check fix deform remap settings
|
||||
|
||||
for (i = 0; i < modify->nfix; i++)
|
||||
if (strncmp(modify->fix[i]->style,"deform", 6) == 0) {
|
||||
if (((FixDeform *) modify->fix[i])->remapflag == Domain::X_REMAP &&
|
||||
comm->me == 0)
|
||||
error->warning(FLERR,"Using compute temp/deform with inconsistent "
|
||||
"fix deform remap option");
|
||||
if (utils::strmatch(modify->fix[i]->style, "^deform")) {
|
||||
if (((FixDeform *) modify->fix[i])->remapflag == Domain::X_REMAP && comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"Using compute temp/deform with inconsistent fix deform remap option");
|
||||
break;
|
||||
}
|
||||
if (i == modify->nfix && comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"Using compute temp/deform with no fix deform defined");
|
||||
error->warning(FLERR, "Using compute temp/deform with no fix deform defined");
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -101,15 +95,17 @@ void ComputeTempDeform::dof_compute()
|
||||
natoms_temp = group->count(igroup);
|
||||
dof = domain->dimension * natoms_temp;
|
||||
dof -= extra_dof + fix_dof;
|
||||
if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz);
|
||||
else tfactor = 0.0;
|
||||
if (dof > 0)
|
||||
tfactor = force->mvv2e / (dof * force->boltz);
|
||||
else
|
||||
tfactor = 0.0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double ComputeTempDeform::compute_scalar()
|
||||
{
|
||||
double lamda[3],vstream[3],vthermal[3];
|
||||
double lamda[3], vstream[3], vthermal[3];
|
||||
|
||||
invoked_scalar = update->ntimestep;
|
||||
|
||||
@ -132,26 +128,25 @@ double ComputeTempDeform::compute_scalar()
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
domain->x2lamda(x[i],lamda);
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
domain->x2lamda(x[i], lamda);
|
||||
vstream[0] = h_rate[0] * lamda[0] + h_rate[5] * lamda[1] + h_rate[4] * lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1] * lamda[1] + h_rate[3] * lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2] * lamda[2] + h_ratelo[2];
|
||||
vthermal[0] = v[i][0] - vstream[0];
|
||||
vthermal[1] = v[i][1] - vstream[1];
|
||||
vthermal[2] = v[i][2] - vstream[2];
|
||||
if (rmass)
|
||||
t += (vthermal[0]*vthermal[0] + vthermal[1]*vthermal[1] +
|
||||
vthermal[2]*vthermal[2]) * rmass[i];
|
||||
t += (vthermal[0] * vthermal[0] + vthermal[1] * vthermal[1] + vthermal[2] * vthermal[2]) *
|
||||
rmass[i];
|
||||
else
|
||||
t += (vthermal[0]*vthermal[0] + vthermal[1]*vthermal[1] +
|
||||
vthermal[2]*vthermal[2]) * mass[type[i]];
|
||||
t += (vthermal[0] * vthermal[0] + vthermal[1] * vthermal[1] + vthermal[2] * vthermal[2]) *
|
||||
mass[type[i]];
|
||||
}
|
||||
|
||||
MPI_Allreduce(&t,&scalar,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(&t, &scalar, 1, MPI_DOUBLE, MPI_SUM, world);
|
||||
if (dynamic) dof_compute();
|
||||
if (dof < 0.0 && natoms_temp > 0.0)
|
||||
error->all(FLERR,"Temperature compute degrees of freedom < 0");
|
||||
error->all(FLERR, "Temperature compute degrees of freedom < 0");
|
||||
scalar *= tfactor;
|
||||
return scalar;
|
||||
}
|
||||
@ -160,7 +155,7 @@ double ComputeTempDeform::compute_scalar()
|
||||
|
||||
void ComputeTempDeform::compute_vector()
|
||||
{
|
||||
double lamda[3],vstream[3],vthermal[3];
|
||||
double lamda[3], vstream[3], vthermal[3];
|
||||
|
||||
invoked_vector = update->ntimestep;
|
||||
|
||||
@ -175,31 +170,32 @@ void ComputeTempDeform::compute_vector()
|
||||
double *h_rate = domain->h_rate;
|
||||
double *h_ratelo = domain->h_ratelo;
|
||||
|
||||
double massone,t[6];
|
||||
double massone, t[6];
|
||||
for (int i = 0; i < 6; i++) t[i] = 0.0;
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
domain->x2lamda(x[i],lamda);
|
||||
vstream[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
domain->x2lamda(x[i], lamda);
|
||||
vstream[0] = h_rate[0] * lamda[0] + h_rate[5] * lamda[1] + h_rate[4] * lamda[2] + h_ratelo[0];
|
||||
vstream[1] = h_rate[1] * lamda[1] + h_rate[3] * lamda[2] + h_ratelo[1];
|
||||
vstream[2] = h_rate[2] * lamda[2] + h_ratelo[2];
|
||||
vthermal[0] = v[i][0] - vstream[0];
|
||||
vthermal[1] = v[i][1] - vstream[1];
|
||||
vthermal[2] = v[i][2] - vstream[2];
|
||||
|
||||
if (rmass) massone = rmass[i];
|
||||
else massone = mass[type[i]];
|
||||
t[0] += massone * vthermal[0]*vthermal[0];
|
||||
t[1] += massone * vthermal[1]*vthermal[1];
|
||||
t[2] += massone * vthermal[2]*vthermal[2];
|
||||
t[3] += massone * vthermal[0]*vthermal[1];
|
||||
t[4] += massone * vthermal[0]*vthermal[2];
|
||||
t[5] += massone * vthermal[1]*vthermal[2];
|
||||
if (rmass)
|
||||
massone = rmass[i];
|
||||
else
|
||||
massone = mass[type[i]];
|
||||
t[0] += massone * vthermal[0] * vthermal[0];
|
||||
t[1] += massone * vthermal[1] * vthermal[1];
|
||||
t[2] += massone * vthermal[2] * vthermal[2];
|
||||
t[3] += massone * vthermal[0] * vthermal[1];
|
||||
t[4] += massone * vthermal[0] * vthermal[2];
|
||||
t[5] += massone * vthermal[1] * vthermal[2];
|
||||
}
|
||||
|
||||
MPI_Allreduce(t,vector,6,MPI_DOUBLE,MPI_SUM,world);
|
||||
MPI_Allreduce(t, vector, 6, MPI_DOUBLE, MPI_SUM, world);
|
||||
for (int i = 0; i < 6; i++) vector[i] *= force->mvv2e;
|
||||
}
|
||||
|
||||
@ -213,11 +209,10 @@ void ComputeTempDeform::remove_bias(int i, double *v)
|
||||
double *h_rate = domain->h_rate;
|
||||
double *h_ratelo = domain->h_ratelo;
|
||||
|
||||
domain->x2lamda(atom->x[i],lamda);
|
||||
vbias[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vbias[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vbias[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
domain->x2lamda(atom->x[i], lamda);
|
||||
vbias[0] = h_rate[0] * lamda[0] + h_rate[5] * lamda[1] + h_rate[4] * lamda[2] + h_ratelo[0];
|
||||
vbias[1] = h_rate[1] * lamda[1] + h_rate[3] * lamda[2] + h_ratelo[1];
|
||||
vbias[2] = h_rate[2] * lamda[2] + h_ratelo[2];
|
||||
v[0] -= vbias[0];
|
||||
v[1] -= vbias[1];
|
||||
v[2] -= vbias[2];
|
||||
@ -233,11 +228,10 @@ void ComputeTempDeform::remove_bias_thr(int i, double *v, double *b)
|
||||
double *h_rate = domain->h_rate;
|
||||
double *h_ratelo = domain->h_ratelo;
|
||||
|
||||
domain->x2lamda(atom->x[i],lamda);
|
||||
b[0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
b[1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
b[2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
domain->x2lamda(atom->x[i], lamda);
|
||||
b[0] = h_rate[0] * lamda[0] + h_rate[5] * lamda[1] + h_rate[4] * lamda[2] + h_ratelo[0];
|
||||
b[1] = h_rate[1] * lamda[1] + h_rate[3] * lamda[2] + h_ratelo[1];
|
||||
b[2] = h_rate[2] * lamda[2] + h_ratelo[2];
|
||||
v[0] -= b[0];
|
||||
v[1] -= b[1];
|
||||
v[2] -= b[2];
|
||||
@ -256,7 +250,7 @@ void ComputeTempDeform::remove_bias_all()
|
||||
if (atom->nmax > maxbias) {
|
||||
memory->destroy(vbiasall);
|
||||
maxbias = atom->nmax;
|
||||
memory->create(vbiasall,maxbias,3,"temp/deform:vbiasall");
|
||||
memory->create(vbiasall, maxbias, 3, "temp/deform:vbiasall");
|
||||
}
|
||||
|
||||
double lamda[3];
|
||||
@ -265,11 +259,11 @@ void ComputeTempDeform::remove_bias_all()
|
||||
|
||||
for (int i = 0; i < nlocal; i++)
|
||||
if (mask[i] & groupbit) {
|
||||
domain->x2lamda(atom->x[i],lamda);
|
||||
vbiasall[i][0] = h_rate[0]*lamda[0] + h_rate[5]*lamda[1] +
|
||||
h_rate[4]*lamda[2] + h_ratelo[0];
|
||||
vbiasall[i][1] = h_rate[1]*lamda[1] + h_rate[3]*lamda[2] + h_ratelo[1];
|
||||
vbiasall[i][2] = h_rate[2]*lamda[2] + h_ratelo[2];
|
||||
domain->x2lamda(atom->x[i], lamda);
|
||||
vbiasall[i][0] =
|
||||
h_rate[0] * lamda[0] + h_rate[5] * lamda[1] + h_rate[4] * lamda[2] + h_ratelo[0];
|
||||
vbiasall[i][1] = h_rate[1] * lamda[1] + h_rate[3] * lamda[2] + h_ratelo[1];
|
||||
vbiasall[i][2] = h_rate[2] * lamda[2] + h_ratelo[2];
|
||||
v[i][0] -= vbiasall[i][0];
|
||||
v[i][1] -= vbiasall[i][1];
|
||||
v[i][2] -= vbiasall[i][2];
|
||||
@ -323,6 +317,6 @@ void ComputeTempDeform::restore_bias_all()
|
||||
|
||||
double ComputeTempDeform::memory_usage()
|
||||
{
|
||||
double bytes = 3*maxbias * sizeof(double);
|
||||
double bytes = 3 * maxbias * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user