11 #define MIN_DEBUG_LEVEL 2
20 #define GF_OVERLAPCHECK_FREQ 1000
46 Vector gfScale = grid->get_scale();
53 DebugM(1,
"Atom " << p[i].
id <<
" is gridforced\n" <<
endi);
62 int err = grid->compute_VdV(pos, V, dV);
71 Force force = -charge * scale *
Vector(gfScale.
x * dV.
x, gfScale.
y * dV.
y, gfScale.
z * dV.
z);
74 DebugM(2,
"scale = " << scale <<
" gfScale = " << gfScale <<
" charge = " << charge <<
"\n" <<
endi);
78 DebugM(2,
"grid = " << gridnum <<
" force = " << force <<
" pos = " << pos <<
" V = " << V <<
" dV = " << dV <<
" step = " <<
homePatch->
flags.
step <<
" index = " << p[i].
id <<
"\n" <<
endi);
80 DebugM(1,
"transform = " << (
int)p[i].transform.i <<
" "
84 iout <<
iWARN <<
"V is NaN!\natomid = " << p[i].
id <<
" loc = " << p[i].
position <<
" V = " << V <<
"\n" <<
endi;
93 if (gfScale.
x == gfScale.
y && gfScale.
x == gfScale.
z)
96 energy += scale * gfScale.
x * (charge * V);
100 extVirial +=
outer(force,vpos);
126 if ((gfScale.
x == 0.0) && (gfScale.
y == 0.0) && (gfScale.
z == 0.0)) {
127 DebugM(3,
"Skipping grid index " << gridnum <<
"\n" <<
endi);
139 sprintf(errmsg,
"Warning: Periodic cell basis too small for Gridforce grid %d. Set gridforcechecksize off in configuration file to ignore.\n", gridnum);
148 DebugM(3,
"center = " << center <<
"\n" <<
endi);
154 do_calc(g, gridnum, p, numAtoms, mol, forces, energy, extForce, extVirial);
157 do_calc(g, gridnum, p, numAtoms, mol, forces, energy, extForce, extVirial);
#define ADD_TENSOR_OBJECT(R, RL, D)
SimParameters * simParameters
ComputeGridForce(ComputeID c, PatchID pid)
static __thread float4 * forces
std::ostream & endi(std::ostream &s)
#define GF_OVERLAPCHECK_FREQ
std::ostream & iWARN(std::ostream &s)
SubmitReduction * willSubmit(int setID, int size=-1)
void doForce(FullAtom *p, Results *r)
static ReductionMgr * Object(void)
void get_gridfrc_params(Real &k, Charge &q, int atomnum, int gridnum) const
bool fits_lattice(const Lattice &lattice)
void NAMD_bug(const char *err_msg)
virtual Position get_center(void) const =0
virtual ~ComputeGridForce()
SubmitReduction * reduction
GridforceGrid * get_gridfrc_grid(int gridnum) const
void NAMD_die(const char *err_msg)
virtual Bool get_checksize(void) const =0
Tensor outer(const Vector &v1, const Vector &v2)
virtual Vector get_scale(void) const =0
Position reverse_transform(Position data, const Transform &t) const
virtual Tensor get_e(void) const =0
#define ADD_VECTOR_OBJECT(R, RL, D)
void do_calc(T *grid, int gridnum, FullAtom *p, int numAtoms, Molecule *mol, Force *forces, BigReal &energy, Force &extForce, Tensor &extVirial)
k< npairi;++k){TABENERGY(const int numtypes=simParams->tableNumTypes;const float table_spacing=simParams->tableSpacing;const int npertype=(int)(namdnearbyint(simParams->tableMaxDist/simParams->tableSpacing)+1);) int table_i=(r2iilist[2 *k] >> 14)+r2_delta_expc;const int j=pairlisti[k];#define p_j BigReal diffa=r2list[k]-r2_table[table_i];#define table_four_i TABENERGY(register const int tabtype=-1-(lj_pars->A< 0?lj_pars->A:0);) BigReal kqq=kq_i *p_j-> charge
GridforceGridType get_grid_type(void)
Bool is_atom_gridforced(int atomnum, int gridnum) const