Implement born_matrix in pair_nm_cut.cpp

This commit is contained in:
Evangelos Voyiatzis
2023-02-24 12:25:55 +02:00
committed by GitHub
parent f264631267
commit 8ba61e11a2

View File

@ -36,6 +36,7 @@ using namespace MathConst;
PairNMCut::PairNMCut(LAMMPS *lmp) : Pair(lmp)
{
born_matrix_enable = 1;
writedata = 1;
}
@ -416,6 +417,25 @@ double PairNMCut::single(int /*i*/, int /*j*/, int itype, int jtype,
/* ---------------------------------------------------------------------- */
void PairNMCut::born_matrix(int /*i*/, int /*j*/, int itype, int jtype, double rsq,
double /*factor_coul*/, double factor_lj, double &dupair,
double &du2pair)
{
double r = sqrt(rsq);
double prefactor = e0nm[itype][jtype]*nm[itype][jtype];
double du = prefactor *
(r0m[itype][jtype]/pow(r,mm[itype][jtype]) - r0n[itype][jtype]/pow(r,nn[itype][jtype])) / r;
double du2 = prefactor *
(r0n[itype][jtype]*(nn[itype][jtype] + 1.0) / pow(r,nn[itype][jtype]) -
r0m[itype][jtype]*(mm[itype][jtype] + 1.0) / pow(r,mm[itype][jtype])) / rsq;
dupair = factor_lj * du;
du2pair = factor_lj * du2;
}
/* ---------------------------------------------------------------------- */
void *PairNMCut::extract(const char *str, int &dim)
{
dim = 2;