34 #ifdef MEM_OPT_VERSION 35 NAMD_die(
"Should not be called in AngleElem::getMoleculePointers in memory optimized version!");
38 *byatom = mol->anglesByAtom;
39 *structarray = mol->angles;
63 for (
int ituple=0; ituple<ntuple; ++ituple ) {
72 #if defined(DEBUG_PROTOCELL) 88 CkPrintf(
"%11d %11d %11d k=%g theta0=%g kub=%g rub=%g\n",
89 i, j, k, ktheta, theta0, kub, rub);
105 BigReal cos_theta = (r12*r32)*(d12inv*d32inv);
109 if (cos_theta > 1.0) cos_theta = 1.0;
110 else if (cos_theta < -1.0) cos_theta = -1.0;
116 BigReal theta = acos(cos_theta);
122 diff = theta - theta0;
124 diff = cos_theta - cos(theta0);
136 BigReal sin_theta = sqrt(1.0 - cos_theta*cos_theta);
139 }
else if ( sin_theta < 1.e-6 ) {
143 if ( diff < 0. ) diff = 2.0 * k;
144 else diff = -2.0 * k;
146 diff *= (-2.0* k) / sin_theta;
152 Force force1 = c1*(r12*(d12inv*cos_theta) - r32*d32inv);
153 Force force2 = force1;
154 Force force3 = c2*(r32*(d32inv*cos_theta) - r12*d12inv);
155 force2 += force3; force2 *= -1;
164 NAMD_die(
"ERROR: Can't use cosAngles with Urey-Bradley angles");
172 energy += k_ub *diff*diff;
174 diff *= -2.0*k_ub / d13;
188 energy *= bond_lambda_1;
189 force1 *= bond_lambda_1;
190 force2 *= bond_lambda_1;
191 force3 *= bond_lambda_1;
196 energy *= bond_lambda_2;
197 force1 *= bond_lambda_2;
198 force2 *= bond_lambda_2;
199 force3 *= bond_lambda_2;
217 DebugM(3,
"::computeForce() -- ending with delta energy " << energy << std::endl);
220 reduction[virialIndex_XX] += ( force1.
x * r12.
x + force3.
x * r32.
x );
221 reduction[virialIndex_XY] += ( force1.
x * r12.
y + force3.
x * r32.
y );
222 reduction[virialIndex_XZ] += ( force1.
x * r12.
z + force3.
x * r32.
z );
223 reduction[virialIndex_YX] += ( force1.
y * r12.
x + force3.
y * r32.
x );
224 reduction[virialIndex_YY] += ( force1.
y * r12.
y + force3.
y * r32.
y );
225 reduction[virialIndex_YZ] += ( force1.
y * r12.
z + force3.
y * r32.
z );
226 reduction[virialIndex_ZX] += ( force1.
z * r12.
x + force3.
z * r32.
x );
227 reduction[virialIndex_ZY] += ( force1.
z * r12.
y + force3.
z * r32.
y );
228 reduction[virialIndex_ZZ] += ( force1.
z * r12.
z + force3.
z * r32.
z );
230 if (pressureProfileData) {
246 force1.
x * r12.
x, force1.
y * r12.
y, force1.
z * r12.
z,
247 pressureProfileData);
250 force3.
x * r32.
x, force3.
y * r32.
y, force3.
z * r32.
z,
251 pressureProfileData);
264 ADD_TENSOR(reduction,REDUCTION_VIRIAL_NORMAL,data,virialIndex);
static BigReal pressureProfileThickness
#define ADD_TENSOR(R, RL, D, DL)
void pp_reduction(int nslabs, int n1, int n2, int atype1, int atype2, int numtypes, BigReal vxx, BigReal vyy, BigReal vzz, BigReal *reduction)
SimParameters * simParameters
static void computeForce(AngleElem *, int, BigReal *, BigReal *)
static BigReal pressureProfileMin
Molecule stores the structural information for the system.
void pp_clamp(int &n, int nslabs)
NAMD_HOST_DEVICE BigReal length(void) const
static void getParameterPointers(Parameters *, const AngleValue **)
static void getMoleculePointers(Molecule *, int *, int32 ***, Angle **)
int get_fep_bonded_type(const int *atomID, unsigned int order) const
void NAMD_die(const char *err_msg)
static int pressureProfileSlabs
static void submitReductionData(BigReal *, SubmitReduction *)
NAMD_HOST_DEVICE BigReal rlength(void) const
static int pressureProfileAtomTypes
NAMD_HOST_DEVICE Vector delta(const Position &pos1, const Position &pos2) const