changed file names and added a lj12-5 function type in OPENMP pkg.

This commit is contained in:
yskmiyazaki
2022-07-08 18:18:39 +09:00
parent 60b189672e
commit 07633622e6
9 changed files with 97 additions and 59 deletions

View File

@ -17,32 +17,32 @@
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "angle_sdk_omp.h"
#include "angle_spica_omp.h"
#include <cmath>
#include "atom.h"
#include "neighbor.h"
#include "comm.h"
#include "force.h"
#include "lj_sdk_common.h"
#include "lj_spica_common.h"
#include "suffix.h"
using namespace LAMMPS_NS;
using namespace LJSDKParms;
using namespace LJSPICAParms;
#define SMALL 0.001
/* ---------------------------------------------------------------------- */
AngleSDKOMP::AngleSDKOMP(class LAMMPS *lmp)
: AngleSDK(lmp), ThrOMP(lmp,THR_ANGLE)
AngleSPICAOMP::AngleSPICAOMP(class LAMMPS *lmp)
: AngleSPICA(lmp), ThrOMP(lmp,THR_ANGLE)
{
suffix_flag |= Suffix::OMP;
}
/* ---------------------------------------------------------------------- */
void AngleSDKOMP::compute(int eflag, int vflag)
void AngleSPICAOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
@ -81,7 +81,7 @@ void AngleSDKOMP::compute(int eflag, int vflag)
}
template <int EVFLAG, int EFLAG, int NEWTON_BOND>
void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr)
void AngleSPICAOMP::eval(int nfrom, int nto, ThrData * const thr)
{
int i1,i2,i3,n,type;
double delx1,dely1,delz1,delx2,dely2,delz2,delx3,dely3,delz3;
@ -171,6 +171,13 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr)
f13 = r6inv*(lj1[type1][type3]*r6inv - lj2[type1][type3]);
if (EFLAG) e13 = r6inv*(lj3[type1][type3]*r6inv - lj4[type1][type3]);
} else if (ljt == LJ12_5) {
const double r5inv = r2inv*r2inv*sqrt(r2inv);
const double r7inv = r5inv*r2inv;
f13 = r5inv*(lj1[type1][type3]*r7inv - lj2[type1][type3]);
if (EFLAG) e13 = r5inv*(lj3[type1][type3]*r7inv - lj4[type1][type3]);
}
// make sure energy is 0.0 at the cutoff.

View File

@ -17,22 +17,23 @@
#ifdef ANGLE_CLASS
// clang-format off
AngleStyle(sdk/omp,AngleSDKOMP);
AngleStyle(spica/omp,AngleSPICAOMP);
AngleStyle(sdk/omp,AngleSPICAOMP);
// clang-format on
#else
#ifndef LMP_ANGLE_SDK_OMP_H
#define LMP_ANGLE_SDK_OMP_H
#ifndef LMP_ANGLE_SPICA_OMP_H
#define LMP_ANGLE_SPICA_OMP_H
#include "angle_sdk.h"
#include "angle_spica.h"
#include "thr_omp.h"
namespace LAMMPS_NS {
class AngleSDKOMP : public AngleSDK, public ThrOMP {
class AngleSPICAOMP : public AngleSPICA, public ThrOMP {
public:
AngleSDKOMP(class LAMMPS *lmp);
AngleSPICAOMP(class LAMMPS *lmp);
void compute(int, int) override;
private:

View File

@ -13,8 +13,8 @@
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "pair_lj_sdk_coul_long_omp.h"
#include "lj_sdk_common.h"
#include "pair_lj_spica_coul_long_omp.h"
#include "lj_spica_common.h"
#include "atom.h"
#include "comm.h"
@ -26,11 +26,11 @@
#include "omp_compat.h"
using namespace LAMMPS_NS;
using namespace LJSDKParms;
using namespace LJSPICAParms;
/* ---------------------------------------------------------------------- */
PairLJSDKCoulLongOMP::PairLJSDKCoulLongOMP(LAMMPS *lmp) :
PairLJSDKCoulLong(lmp), ThrOMP(lmp, THR_PAIR)
PairLJSPICACoulLongOMP::PairLJSPICACoulLongOMP(LAMMPS *lmp) :
PairLJSPICACoulLong(lmp), ThrOMP(lmp, THR_PAIR)
{
suffix_flag |= Suffix::OMP;
respa_enable = 0;
@ -38,7 +38,7 @@ PairLJSDKCoulLongOMP::PairLJSDKCoulLongOMP(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- */
void PairLJSDKCoulLongOMP::compute(int eflag, int vflag)
void PairLJSPICACoulLongOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
@ -78,7 +78,7 @@ void PairLJSDKCoulLongOMP::compute(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
void PairLJSPICACoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
{
const auto * _noalias const x = (dbl3_t *) atom->x[0];
@ -195,6 +195,15 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
if (EFLAG)
evdwl = r6inv*(lj3[itype][jtype]*r6inv
- lj4[itype][jtype]) - offset[itype][jtype];
} else if (ljt == LJ12_5) {
const double r5inv = r2inv*r2inv*sqrt(r2inv);
const double r7inv = r5inv*r2inv;
forcelj = r5inv*(lj1[itype][jtype]*r7inv
- lj2[itype][jtype]);
if (EFLAG)
evdwl = r5inv*(lj3[itype][jtype]*r7inv
- lj4[itype][jtype]) - offset[itype][jtype];
}
if (sbindex) {
@ -228,10 +237,10 @@ void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
/* ---------------------------------------------------------------------- */
double PairLJSDKCoulLongOMP::memory_usage()
double PairLJSPICACoulLongOMP::memory_usage()
{
double bytes = memory_usage_thr();
bytes += PairLJSDKCoulLong::memory_usage();
bytes += PairLJSPICACoulLong::memory_usage();
return bytes;
}

View File

@ -17,22 +17,23 @@
#ifdef PAIR_CLASS
// clang-format off
PairStyle(lj/sdk/coul/long/omp,PairLJSDKCoulLongOMP);
PairStyle(lj/spica/coul/long/omp,PairLJSPICACoulLongOMP);
PairStyle(lj/sdk/coul/long/omp,PairLJSPICACoulLongOMP);
// clang-format on
#else
#ifndef LMP_PAIR_LJ_SDK_COUL_LONG_OMP_H
#define LMP_PAIR_LJ_SDK_COUL_LONG_OMP_H
#ifndef LMP_PAIR_LJ_SPICA_COUL_LONG_OMP_H
#define LMP_PAIR_LJ_SPICA_COUL_LONG_OMP_H
#include "pair_lj_sdk_coul_long.h"
#include "pair_lj_spica_coul_long.h"
#include "thr_omp.h"
namespace LAMMPS_NS {
class PairLJSDKCoulLongOMP : public PairLJSDKCoulLong, public ThrOMP {
class PairLJSPICACoulLongOMP : public PairLJSPICACoulLong, public ThrOMP {
public:
PairLJSDKCoulLongOMP(class LAMMPS *);
PairLJSPICACoulLongOMP(class LAMMPS *);
void compute(int, int) override;
double memory_usage() override;

View File

@ -14,8 +14,8 @@
This style is a simplified re-implementation of the CG/CMM pair style
------------------------------------------------------------------------- */
#include "pair_lj_sdk_coul_msm_omp.h"
#include "lj_sdk_common.h"
#include "pair_lj_spica_coul_msm_omp.h"
#include "lj_spica_common.h"
#include "atom.h"
#include "comm.h"
@ -29,11 +29,11 @@
#include "omp_compat.h"
using namespace LAMMPS_NS;
using namespace LJSDKParms;
using namespace LJSPICAParms;
/* ---------------------------------------------------------------------- */
PairLJSDKCoulMSMOMP::PairLJSDKCoulMSMOMP(LAMMPS *lmp) :
PairLJSDKCoulMSM(lmp), ThrOMP(lmp, THR_PAIR)
PairLJSPICACoulMSMOMP::PairLJSPICACoulMSMOMP(LAMMPS *lmp) :
PairLJSPICACoulMSM(lmp), ThrOMP(lmp, THR_PAIR)
{
suffix_flag |= Suffix::OMP;
respa_enable = 0;
@ -41,7 +41,7 @@ PairLJSDKCoulMSMOMP::PairLJSDKCoulMSMOMP(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- */
void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag)
void PairLJSPICACoulMSMOMP::compute(int eflag, int vflag)
{
if (force->kspace->scalar_pressure_flag)
error->all(FLERR,"Must use 'kspace_modify pressure/scalar no' "
@ -85,7 +85,7 @@ void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void PairLJSDKCoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr)
void PairLJSPICACoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr)
{
const double * const * const x = atom->x;
@ -194,6 +194,15 @@ void PairLJSDKCoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr
if (EFLAG)
evdwl = r6inv*(lj3[itype][jtype]*r6inv
- lj4[itype][jtype]) - offset[itype][jtype];
} else if (ljt == LJ12_5) {
const double r5inv = r2inv*r2inv*sqrt(r2inv);
const double r7inv = r5inv*r2inv;
forcelj = r5inv*(lj1[itype][jtype]*r7inv
- lj2[itype][jtype]);
if (EFLAG)
evdwl = r5inv*(lj3[itype][jtype]*r7inv
- lj4[itype][jtype]) - offset[itype][jtype];
}
if (sbindex) {
@ -227,10 +236,10 @@ void PairLJSDKCoulMSMOMP::eval_msm_thr(int iifrom, int iito, ThrData * const thr
/* ---------------------------------------------------------------------- */
double PairLJSDKCoulMSMOMP::memory_usage()
double PairLJSPICACoulMSMOMP::memory_usage()
{
double bytes = memory_usage_thr();
bytes += PairLJSDKCoulMSM::memory_usage();
bytes += PairLJSPICACoulMSM::memory_usage();
return bytes;
}

View File

@ -17,22 +17,23 @@
#ifdef PAIR_CLASS
// clang-format off
PairStyle(lj/sdk/coul/msm/omp,PairLJSDKCoulMSMOMP);
PairStyle(lj/spica/coul/msm/omp,PairLJSPICACoulMSMOMP);
PairStyle(lj/sdk/coul/msm/omp,PairLJSPICACoulMSMOMP);
// clang-format on
#else
#ifndef LMP_PAIR_LJ_SDK_COUL_MSM_OMP_H
#define LMP_PAIR_LJ_SDK_COUL_MSM_OMP_H
#ifndef LMP_PAIR_LJ_SPICA_COUL_MSM_OMP_H
#define LMP_PAIR_LJ_SPICA_COUL_MSM_OMP_H
#include "pair_lj_sdk_coul_msm.h"
#include "pair_lj_spica_coul_msm.h"
#include "thr_omp.h"
namespace LAMMPS_NS {
class PairLJSDKCoulMSMOMP : public PairLJSDKCoulMSM, public ThrOMP {
class PairLJSPICACoulMSMOMP : public PairLJSPICACoulMSM, public ThrOMP {
public:
PairLJSDKCoulMSMOMP(class LAMMPS *);
PairLJSPICACoulMSMOMP(class LAMMPS *);
void compute(int, int) override;
double memory_usage() override;

View File

@ -14,8 +14,8 @@
This style is a simplified re-implementation of the CG/CMM pair style
------------------------------------------------------------------------- */
#include "pair_lj_sdk_omp.h"
#include "lj_sdk_common.h"
#include "pair_lj_spica_omp.h"
#include "lj_spica_common.h"
#include "atom.h"
#include "comm.h"
@ -27,12 +27,12 @@
#include "omp_compat.h"
using namespace LAMMPS_NS;
using namespace LJSDKParms;
using namespace LJSPICAParms;
/* ---------------------------------------------------------------------- */
PairLJSDKOMP::PairLJSDKOMP(LAMMPS *lmp) :
PairLJSDK(lmp), ThrOMP(lmp, THR_PAIR)
PairLJSPICAOMP::PairLJSPICAOMP(LAMMPS *lmp) :
PairLJSPICA(lmp), ThrOMP(lmp, THR_PAIR)
{
suffix_flag |= Suffix::OMP;
respa_enable = 0;
@ -40,7 +40,7 @@ PairLJSDKOMP::PairLJSDKOMP(LAMMPS *lmp) :
/* ---------------------------------------------------------------------- */
void PairLJSDKOMP::compute(int eflag, int vflag)
void PairLJSPICAOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
@ -80,7 +80,7 @@ void PairLJSDKOMP::compute(int eflag, int vflag)
/* ---------------------------------------------------------------------- */
template <int EVFLAG, int EFLAG, int NEWTON_PAIR>
void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
void PairLJSPICAOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
{
int i,j,ii,jj,jtype;
double xtmp,ytmp,ztmp,delx,dely,delz,evdwl,fpair;
@ -153,6 +153,15 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
if (EFLAG)
evdwl = r6inv*(lj3[itype][jtype]*r6inv
- lj4[itype][jtype]) - offset[itype][jtype];
} else if (ljt == LJ12_5) {
const double r5inv = r2inv*r2inv*sqrt(r2inv);
const double r7inv = r5inv*r2inv;
forcelj = r5inv*(lj1[itype][jtype]*r7inv
- lj2[itype][jtype]);
if (EFLAG)
evdwl = r5inv*(lj3[itype][jtype]*r7inv
- lj4[itype][jtype]) - offset[itype][jtype];
} else continue;
fpair = factor_lj*forcelj*r2inv;
@ -179,10 +188,10 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr)
/* ---------------------------------------------------------------------- */
double PairLJSDKOMP::memory_usage()
double PairLJSPICAOMP::memory_usage()
{
double bytes = memory_usage_thr();
bytes += PairLJSDK::memory_usage();
bytes += PairLJSPICA::memory_usage();
return bytes;
}

View File

@ -17,22 +17,23 @@
#ifdef PAIR_CLASS
// clang-format off
PairStyle(lj/sdk/omp,PairLJSDKOMP);
PairStyle(lj/spica/omp,PairLJSPICAOMP);
PairStyle(lj/sdk/omp,PairLJSPICAOMP);
// clang-format on
#else
#ifndef LMP_PAIR_LJ_SDK_OMP_H
#define LMP_PAIR_LJ_SDK_OMP_H
#ifndef LMP_PAIR_LJ_SPICA_OMP_H
#define LMP_PAIR_LJ_SPICA_OMP_H
#include "pair_lj_sdk.h"
#include "pair_lj_spica.h"
#include "thr_omp.h"
namespace LAMMPS_NS {
class PairLJSDKOMP : public PairLJSDK, public ThrOMP {
class PairLJSPICAOMP : public PairLJSPICA, public ThrOMP {
public:
PairLJSDKOMP(class LAMMPS *);
PairLJSPICAOMP(class LAMMPS *);
void compute(int, int) override;
double memory_usage() override;

View File

@ -1042,7 +1042,7 @@ void ThrOMP::ev_tally_thr(Angle * const angle, const int i, const int j, const i
}
/* ----------------------------------------------------------------------
tally energy and virial from 1-3 repulsion of SDK angle into accumulators
tally energy and virial from 1-3 repulsion of SPICA angle into accumulators
------------------------------------------------------------------------- */
void ThrOMP::ev_tally13_thr(Angle * const angle, const int i1, const int i3,