4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Copyright (c) 1991-2001, University of Groningen, The Netherlands
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * If you want to redistribute modifications, please consider that
18 * scientific software is very special. Version control is crucial -
19 * bugs must be traceable. We will be happy to consider code for
20 * inclusion in the official distribution, but derived work must not
21 * be called official GROMACS. Details are found in the README & COPYING
22 * files - if they are missing, get the official version at www.gromacs.org.
24 * To help us fund GROMACS development, we humbly ask that you cite
25 * the papers on the package - you can find them in the top README file.
27 * For more info, check our website at http://www.gromacs.org
30 * GROningen Mixture of Alchemy and Childrens' Stories
41 void do_glas(FILE *log
,int start
,int homenr
,rvec x
[],rvec f
[],
42 t_forcerec
*fr
,t_mdatoms
*md
,int atnr
,t_inputrec
*ir
,
45 static bool bFirst
=TRUE
,bGlas
;
46 static real d
[2],pi6
,pi12
,rc9
,rc4
,rc10
,rc3
,rc
;
48 real wd
,wdd
,zi
,fz
,dd
,d10
,d4
,d9
,d3
,r9
,r3
,sign
,cc6
,cc12
;
59 /* Check whether these constants have been set. */
60 bGlas
= (pi6
!= 0) && (pi12
!= 0) && (d
[0] != 0) && (d
[1] != 0);
63 if (ir
->eDispCorr
!= edispcNO
) {
64 fatal_error(0,"Can not have Long Range C6 corrections and GLASMD");
66 rc
= max(fr
->rvdw
,fr
->rlist
);
73 "Constants for GLASMD: pi6 = %10g, pi12 = %10g\n"
74 " d1 = %10g, d2 = %10g\n"
75 " rc3 = %10g, rc4 = %10g\n"
76 " rc9 = %10g, rc10 = %10g\n",
77 pi6
,pi12
,d
[0],d
[1],rc3
,rc4
,rc9
,rc10
);
79 fatal_error(0,"d1 > d2 for GLASMD (check log file)");
84 for(i
=0; (i
<atnr
); i
++) {
85 c6
[i
] = C6 (fr
->nbfp
,atnr
,i
,i
);
86 c12
[i
] = C12(fr
->nbfp
,atnr
,i
,i
);
90 fprintf(stderr
,"No glasmd!\n");
96 for(i
=start
; (i
<start
+homenr
); i
++) {
98 if ((c6
[ti
] != 0) || (c12
[ti
] != 0)) {
100 cc6
= M_PI
*sqrt(c6
[ti
]*pi6
);
101 cc12
= M_PI
*sqrt(c12
[ti
]*pi12
);
103 /* Use a factor for the sign, this saves taking absolute values */
105 for(j
=0; (j
<2); j
++) {
110 wdd
= cc12
/(45.0*d9
) - cc6
/(6.0*d3
);
113 fz
= sign
*(cc12
/(5.0*d10
) - cc6
/(2.0*d4
));
116 wdd
= cc12
*(2.0/(9.0*rc9
) - dd
/(5.0*rc10
)) -
117 cc6
*(2.0/(3.0*rc3
) - dd
/(2.0*rc4
));
118 fz
= sign
*(cc12
/(5.0*rc10
)-cc6
/(2.0*rc4
));