/* Calculate the forces on the particles of the strand that are attributed * to the structure of the strand itself. These are: * Fbond, Fangle, Fdihedral, Fstack. */ static void strandForces(Strand *s) { if (s->numMonomers < 0) return; assert(s->Ss != NULL && s->Ps != NULL && s->Bs != NULL); /* Bottom monomer */ FbondSB(&s->Ss[0], &s->Bs[0]); Fbond(&s->Ss[0], &s->Ps[0], BOND_S5_P); FangleP5SB(&s->Ps[0], &s->Ss[0], &s->Bs[0]); /* Rest of the monomers */ for (int i = 1; i < s->numMonomers; i++) { FbondSB(&s->Ss[i], &s->Bs[i]); Fbond(&s->Ss[i], &s->Ps[i], BOND_S5_P); Fbond(&s->Ss[i], &s->Ps[i-1], BOND_S3_P); Fstack(&s->Bs[i], &s->Bs[i-1], 0); FangleP5SB(&s->Ps[ i ], &s->Ss[ i ], &s->Bs[ i ]); Fangle (&s->Ps[ i ], &s->Ss[ i ], &s->Ps[i-1], ANGLE_P_5S3_P); FangleP3SB(&s->Ps[i-1], &s->Ss[ i ], &s->Bs[ i ]); Fangle (&s->Ss[i-1], &s->Ps[i-1], &s->Ss[ i ], ANGLE_S5_P_3S); FdihedralBS3P5S(&s->Bs[i], &s->Ss[ i ], &s->Ps[i-1], &s->Ss[i-1]); FdihedralS3P5SB(&s->Ss[i], &s->Ps[i-1], &s->Ss[i-1], &s->Bs[i-1]); Fdihedral(&s->Ps[i], &s->Ss[ i ], &s->Ps[i-1], &s->Ss[i-1], dihedralP5S3P5S); if (i < 2) continue; Fdihedral(&s->Ss[i], &s->Ps[i-1], &s->Ss[i-1], &s->Ps[i-2], dihedralS3P5S3P); Fstack(&s->Bs[i], &s->Bs[i-2], 1); } }
static void FangleP3SB(Particle *p, Particle *s, Particle *b) { AngleBaseInfo info = getAngleBaseInfo(b->type); Fangle(p, s, b, info.P3SB); }
array minlin(const array x,const array x0,const array dx,const array y0 ) { array res = y0 + dx * Fangle((x-x0)/dx); res.eval(); return res; }
array limlin( const array x, const array x0, const array dx, const array y0 ) { array res = y0 - dx * Fangle((x-x0)*(-1.)/dx); res.eval(); return res; }