63 for (
int ituple=0; ituple<ntuple; ++ituple ) {
84 BigReal cos_theta = (r12*r32)*(d12inv*d32inv);
88 if (cos_theta > 1.0) cos_theta = 1.0;
89 else if (cos_theta < -1.0) cos_theta = -1.0;
95 BigReal theta = acos(cos_theta);
101 diff = theta - theta0;
103 diff = cos_theta - cos(theta0);
115 BigReal sin_theta = sqrt(1.0 - cos_theta*cos_theta);
118 }
else if ( sin_theta < 1.e-6 ) {
122 if ( diff < 0. ) diff = 2.0 * k;
123 else diff = -2.0 * k;
125 diff *= (-2.0* k) / sin_theta;
131 Force force1 = c1*(r12*(d12inv*cos_theta) - r32*d32inv);
132 Force force2 = force1;
133 Force force3 = c2*(r32*(d32inv*cos_theta) - r12*d12inv);
134 force2 += force3; force2 *= -1;
143 NAMD_die(
"ERROR: Can't use cosAngles with Urey-Bradley angles");
151 energy += k_ub *diff*diff;
153 diff *= -2.0*k_ub / d13;
167 energy *= bond_lambda_1;
168 force1 *= bond_lambda_1;
169 force2 *= bond_lambda_1;
170 force3 *= bond_lambda_1;
175 energy *= bond_lambda_2;
176 force1 *= bond_lambda_2;
177 force2 *= bond_lambda_2;
178 force3 *= bond_lambda_2;
196 DebugM(3,
"::computeForce() -- ending with delta energy " << energy << std::endl);
199 reduction[virialIndex_XX] += ( force1.x * r12.
x + force3.x * r32.x );
200 reduction[virialIndex_XY] += ( force1.x * r12.
y + force3.x * r32.y );
201 reduction[virialIndex_XZ] += ( force1.x * r12.
z + force3.x * r32.z );
202 reduction[virialIndex_YX] += ( force1.y * r12.
x + force3.y * r32.x );
203 reduction[virialIndex_YY] += ( force1.y * r12.
y + force3.y * r32.y );
204 reduction[virialIndex_YZ] += ( force1.y * r12.
z + force3.y * r32.z );
205 reduction[virialIndex_ZX] += ( force1.z * r12.
x + force3.z * r32.x );
206 reduction[virialIndex_ZY] += ( force1.z * r12.
y + force3.z * r32.y );
207 reduction[virialIndex_ZZ] += ( force1.z * r12.
z + force3.z * r32.z );
209 if (pressureProfileData) {
225 force1.x * r12.
x, force1.y * r12.
y, force1.z * r12.
z,
226 pressureProfileData);
229 force3.x * r32.x, force3.y * r32.y, force3.z * r32.z,
230 pressureProfileData);
static BigReal pressureProfileThickness
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 BigReal pressureProfileMin
int get_fep_bonded_type(const int *atomID, unsigned int order) const
BigReal length(void) const
void pp_clamp(int &n, int nslabs)
BigReal getBondLambda(const BigReal)
BigReal getCurrentLambda2(const int)
Vector delta(const Position &pos1, const Position &pos2) const
void NAMD_die(const char *err_msg)
BigReal getCurrentLambda(const int)
static int pressureProfileSlabs
static int pressureProfileAtomTypes