Hi dear Developers,
I am using dihedral bond potential for my simulations. I found there
is a mistake in force calculation. Forces are shuffled. The force
which should be on Particle 1, it is on part 2. The force which should
be on Part 3 it is on Part 1.
You can change this
MDINLINE int calc_dihedral_force(Particle *p2, Particle *p1, Particle
*p3, Particle *p4,
Bonded_ia_parameters *iaparams, double force2[3],
double force1[2], double force3[2])
Change this like
MDINLINE int calc_dihedral_force(Particle *p2, Particle *p1, Particle
*p3, Particle *p4,
Bonded_ia_parameters *iaparams, double force1[3],
double force2[3], double force3[3])
Then change
/* store dihedral forces */
for(i=0;i<3;i++) {
force1[i] = fac*v23Xf1[i];
force2[i] = fac*(v34Xf4[i] - v12Xf1[i] - v23Xf1[i]);
force3[i] = fac*(v12Xf1[i] - v23Xf4[i] - v34Xf4[i]);
}
with
for(i=0;i<3;i++) {
force1[i] = fac*v23Xf1[i];
force2[i] = fac*(v12Xf1[i] - v23Xf4[i] - v34Xf4[i]);
force3[i] = fac*(v34Xf4[i] - v12Xf1[i] - v23Xf1[i]);
}
I have tested this and the way it is available in espresso it increase
the stiffness of chain instead of decreasing. And after changing i
compared the Rg and Re with published results.
One more efficient can be:
Compute all forces and multiply with force fac like
/* calculate force components (directions) */
for(i=0;i<3;i++) {
f1[i] = (v23Xv34[i] - cosphi*v12Xv23[i])/(l_v12Xv23);
f4[i] = (v12Xv23[i] - cosphi*v23Xv34[i])/(l_v23Xv34);
f2[i] = (-f1[i] + (scalar(v12,v23)/sqrlen(v23)) * f1[i] -
(scalar(v34,v23)/sqrlen(v23)) * f4[i]);
f3[i] = (-f4[i] - (scalar(v12,v23)/sqrlen(v23)) * f1[i] +
(scalar(v34,v23)/sqrlen(v23))* f4[i]);
}
/* store dihedral forces */
for(i=0;i<3;i++) {
force1[i] = fac * f1[i];
force2[i] = fac * f2[i];
force3[i] = fac * f3[i];
force4[i] = fac * f4[i];
}
I did not test this second method, just gone through literature and
found this in "Molecular Dynamics
Simulation Methods Revised by H. Bekker" in Chapter 5. They claim in
this method floating point operations are reduced by 40%.
Please have a look on this.
Thanks and have a nice day.