git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8226 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2012-06-06 22:47:51 +00:00
parent f46eb9dedb
commit ef9e700545
1408 changed files with 58053 additions and 57983 deletions

View File

@ -5,7 +5,7 @@
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
@ -17,23 +17,23 @@
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Description: This file implements the improper potential introduced
Description: This file implements the improper potential introduced
by Destree et al., in Equation 9 of:
- M. Destree, F. Laupretre, A. Lyulin, and J.-P.
Ryckaert, J. Chem. Phys. 112, 9632 (2000),
- M. Destree, F. Laupretre, A. Lyulin, and J.-P.
Ryckaert, J. Chem. Phys. 112, 9632 (2000),
and subsequently referred in:
- A.V. Lyulin, M.A.J Michels, Macromolecules, 35, 1463,
(2002)
This potential does not affect small amplitude vibrations
but is used in an ad hoc way to prevent the onset of
accidentially large amplitude fluctuations leading to
the occurrence of a planar conformation of the three
bonds i, i + 1 and i', an intermediate conformation
but is used in an ad hoc way to prevent the onset of
accidentially large amplitude fluctuations leading to
the occurrence of a planar conformation of the three
bonds i, i + 1 and i', an intermediate conformation
toward the chiral inversion of a methine carbon.
In the "Impropers" section of data file four atoms:
i, j, k and l are specified with i,j and l lying on the
backbone of the chain and k specifying the chirality
of j.
of j.
------------------------------------------------------------------------- */
#include "lmptype.h"
@ -79,20 +79,20 @@ void ImproperRing::compute(int eflag, int vflag)
/* Be careful!: "chi" is the equilibrium angle in radians. */
int i1,i2,i3,i4,n,type;
double eimproper ;
double eimproper ;
/* Compatibility variables. */
double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z;
double f1[3], f3[3], f4[3];
/* Actual computation variables. */
int at1[3], at2[3], at3[3], icomb;
double bvec1x[3], bvec1y[3], bvec1z[3],
bvec2x[3], bvec2y[3], bvec2z[3],
double bvec1x[3], bvec1y[3], bvec1z[3],
bvec2x[3], bvec2y[3], bvec2z[3],
bvec1n[3], bvec2n[3], bend_angle[3];
double angle_summer, angfac, cfact1, cfact2, cfact3;
double cjiji, ckjji, ckjkj, fix, fiy, fiz, fjx, fjy, fjz, fkx, fky, fkz;
eimproper = 0.0;
if (eflag || vflag) ev_setup(eflag,vflag);
else evflag = 0;
@ -106,9 +106,9 @@ void ImproperRing::compute(int eflag, int vflag)
int newton_bond = force->newton_bond;
/* A description of the potential can be found in
/* A description of the potential can be found in
Macromolecules 35, pp. 1463-1472 (2002). */
for (n = 0; n < nimproperlist; n++)
for (n = 0; n < nimproperlist; n++)
{
/* Take the ids of the atoms contributing to the improper potential. */
i1 = improperlist[n][0]; /* Atom "1" of Figure 1 from the above reference.*/
@ -117,9 +117,9 @@ void ImproperRing::compute(int eflag, int vflag)
i4 = improperlist[n][3]; /* Atom "9" ... */
type = improperlist[n][4];
/* Calculate the necessary variables for LAMMPS implementation.
/* Calculate the necessary variables for LAMMPS implementation.
if (evflag) ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,f1,f3,f4,
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z);
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z);
Although, they are irrelevant to the calculation of the potential, we keep
them for maximal compatibility. */
vb1x = x[i1][0] - x[i2][0]; vb1y = x[i1][1] - x[i2][1]; vb1z = x[i1][2] - x[i2][2];
@ -131,27 +131,27 @@ void ImproperRing::compute(int eflag, int vflag)
vb3x = x[i4][0] - x[i3][0]; vb3y = x[i4][1] - x[i3][1]; vb3z = x[i4][2] - x[i3][2];
domain->minimum_image(vb3x,vb3y,vb3z);
/* Pass the atom tags to form the necessary combinations. */
at1[0] = i1; at2[0] = i2; at3[0] = i4; /* ids: 1-2-9 */
at1[1] = i1; at2[1] = i2; at3[1] = i3; /* ids: 1-2-3 */
at1[2] = i4; at2[2] = i2; at3[2] = i3; /* ids: 9-2-3 */
/* Initialize the sum of the angles differences. */
angle_summer = 0.0;
/* Take a loop over the three angles, defined by each triad: */
for (icomb = 0; icomb < 3; icomb ++)
{
/* Bond vector connecting the first and the second atom. */
bvec1x[icomb] = x[at2[icomb]][0] - x[at1[icomb]][0];
bvec1y[icomb] = x[at2[icomb]][1] - x[at1[icomb]][1];
bvec1z[icomb] = x[at2[icomb]][2] - x[at1[icomb]][2];
domain -> minimum_image(bvec1x[icomb], bvec1y[icomb], bvec1z[icomb]);
/* also calculate the norm of the vector: */
bvec1n[icomb] = sqrt( bvec1x[icomb]*bvec1x[icomb]
+ bvec1y[icomb]*bvec1y[icomb]
bvec1n[icomb] = sqrt( bvec1x[icomb]*bvec1x[icomb]
+ bvec1y[icomb]*bvec1y[icomb]
+ bvec1z[icomb]*bvec1z[icomb]);
/* Bond vector connecting the second and the third atom. */
bvec2x[icomb] = x[at3[icomb]][0] - x[at2[icomb]][0];
@ -159,13 +159,13 @@ void ImproperRing::compute(int eflag, int vflag)
bvec2z[icomb] = x[at3[icomb]][2] - x[at2[icomb]][2];
domain -> minimum_image(bvec2x[icomb], bvec2y[icomb], bvec2z[icomb]);
/* also calculate the norm of the vector: */
bvec2n[icomb] = sqrt( bvec2x[icomb]*bvec2x[icomb]
+ bvec2y[icomb]*bvec2y[icomb]
bvec2n[icomb] = sqrt( bvec2x[icomb]*bvec2x[icomb]
+ bvec2y[icomb]*bvec2y[icomb]
+ bvec2z[icomb]*bvec2z[icomb]);
/* Calculate the bending angle of the atom triad: */
bend_angle[icomb] = ( bvec2x[icomb]*bvec1x[icomb]
+ bvec2y[icomb]*bvec1y[icomb]
bend_angle[icomb] = ( bvec2x[icomb]*bvec1x[icomb]
+ bvec2y[icomb]*bvec1y[icomb]
+ bvec2z[icomb]*bvec1z[icomb]);
bend_angle[icomb] /= (bvec1n[icomb] * bvec2n[icomb]);
if (bend_angle[icomb] > 1.0) bend_angle[icomb] -= SMALL;
@ -173,38 +173,38 @@ void ImproperRing::compute(int eflag, int vflag)
/* Append the current angle to the sum of angle differences. */
angle_summer += (bend_angle[icomb] - chi[type]);
}
if (eflag) eimproper = (1.0/6.0) *k[type] * pow(angle_summer,6.0);
}
if (eflag) eimproper = (1.0/6.0) *k[type] * pow(angle_summer,6.0);
/*
printf("The tags: %d-%d-%d-%d, of type %d .\n",atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4],type);
printf("The tags: %d-%d-%d-%d, of type %d .\n",atom->tag[i1],atom->tag[i2],atom->tag[i3],atom->tag[i4],type);
// printf("The coordinates of the first: %f, %f, %f.\n", x[i1][0], x[i1][1], x[i1][2]);
// printf("The coordinates of the second: %f, %f, %f.\n", x[i2][0], x[i2][1], x[i2][2]);
// printf("The coordinates of the third: %f, %f, %f.\n", x[i3][0], x[i3][1], x[i3][2]);
// printf("The coordinates of the fourth: %f, %f, %f.\n", x[i4][0], x[i4][1], x[i4][2]);
printf("The angles are: %f / %f / %f equilibrium: %f.\n", bend_angle[0], bend_angle[1], bend_angle[2],chi[type]);
printf("The energy of the improper: %f with prefactor %f.\n", eimproper,(1.0/6.0)*k[type]);
printf("The sum of the angles: %f.\n", angle_summer);
printf("The sum of the angles: %f.\n", angle_summer);
*/
/* Force calculation acting on all atoms.
/* Force calculation acting on all atoms.
Calculate the derivatives of the potential. */
angfac = k[type] * pow(angle_summer,5.0);
f1[0] = 0.0; f1[1] = 0.0; f1[2] = 0.0;
f3[0] = 0.0; f3[1] = 0.0; f3[2] = 0.0;
f4[0] = 0.0; f4[1] = 0.0; f4[2] = 0.0;
f4[0] = 0.0; f4[1] = 0.0; f4[2] = 0.0;
/* Take a loop over the three angles, defined by each triad: */
for (icomb = 0; icomb < 3; icomb ++)
{
/* Calculate the squares of the distances. */
cjiji = bvec1n[icomb] * bvec1n[icomb]; ckjkj = bvec2n[icomb] * bvec2n[icomb];
ckjji = bvec2x[icomb] * bvec1x[icomb]
ckjji = bvec2x[icomb] * bvec1x[icomb]
+ bvec2y[icomb] * bvec1y[icomb]
+ bvec2z[icomb] * bvec1z[icomb] ;
cfact1 = angfac / (sqrt(ckjkj * cjiji));
cfact1 = angfac / (sqrt(ckjkj * cjiji));
cfact2 = ckjji / ckjkj;
cfact3 = ckjji / cjiji;
@ -212,15 +212,15 @@ void ImproperRing::compute(int eflag, int vflag)
fkx = cfact2 * bvec2x[icomb] - bvec1x[icomb];
fky = cfact2 * bvec2y[icomb] - bvec1y[icomb];
fkz = cfact2 * bvec2z[icomb] - bvec1z[icomb];
/* Calculate the force acted on the first atom of the angle. */
fix = bvec2x[icomb] - cfact3 * bvec1x[icomb];
fiy = bvec2y[icomb] - cfact3 * bvec1y[icomb];
fiz = bvec2z[icomb] - cfact3 * bvec1z[icomb];
fiz = bvec2z[icomb] - cfact3 * bvec1z[icomb];
/* Finally, calculate the force acted on the middle atom of the angle.*/
fjx = - fix - fkx; fjy = - fiy - fky; fjz = - fiz - fkz;
fjx = - fix - fkx; fjy = - fiy - fky; fjz = - fiz - fkz;
/* Consider the appropriate scaling of the forces: */
fix *= cfact1; fiy *= cfact1; fiz *= cfact1;
fjx *= cfact1; fjy *= cfact1; fjz *= cfact1;
@ -229,7 +229,7 @@ void ImproperRing::compute(int eflag, int vflag)
if (at1[icomb] == i1) {f1[0] += fix; f1[1] += fiy; f1[2] += fiz;}
else if (at2[icomb] == i1) {f1[0] += fjx; f1[1] += fjy; f1[2] += fjz;}
else if (at3[icomb] == i1) {f1[0] += fkx; f1[1] += fky; f1[2] += fkz;}
if (at1[icomb] == i3) {f3[0] += fix; f3[1] += fiy; f3[2] += fiz;}
else if (at2[icomb] == i3) {f3[0] += fjx; f3[1] += fjy; f3[2] += fjz;}
else if (at3[icomb] == i3) {f3[0] += fkx; f3[1] += fky; f3[2] += fkz;}
@ -242,7 +242,7 @@ void ImproperRing::compute(int eflag, int vflag)
/* Store the contribution to the global arrays: */
/* Take the id of the atom from the at1[icomb] element, i1 = at1[icomb]. */
if (newton_bond || at1[icomb] < nlocal) {
f[at1[icomb]][0] += fix;
f[at1[icomb]][0] += fix;
f[at1[icomb]][1] += fiy;
f[at1[icomb]][2] += fiz;
}
@ -258,11 +258,11 @@ void ImproperRing::compute(int eflag, int vflag)
f[at3[icomb]][1] += fky;
f[at3[icomb]][2] += fkz;
}
}
if (evflag) ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,f1,f3,f4,
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z);
vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z);
}
}
@ -287,7 +287,7 @@ void ImproperRing::allocate()
void ImproperRing ::coeff(int narg, char **arg)
{
/* Check whether there exist sufficient number of arguments.
/* Check whether there exist sufficient number of arguments.
0: type of improper to be applied to
1: energetic constant
2: equilibrium angle in degrees */
@ -315,7 +315,7 @@ void ImproperRing ::coeff(int narg, char **arg)
}
/* ----------------------------------------------------------------------
proc 0 writes out coeffs to restart file
proc 0 writes out coeffs to restart file
------------------------------------------------------------------------- */
void ImproperRing ::write_restart(FILE *fp)
@ -325,7 +325,7 @@ void ImproperRing ::write_restart(FILE *fp)
}
/* ----------------------------------------------------------------------
proc 0 reads coeffs from restart file, bcasts them
proc 0 reads coeffs from restart file, bcasts them
------------------------------------------------------------------------- */
void ImproperRing::read_restart(FILE *fp)