4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Gromacs Runs On Most of All Computer Systems
36 static char *SRCID_glaasje_c = "$Id$";
44 void do_glas(FILE *log,int start,int homenr,rvec x[],rvec f[],
45 t_forcerec *fr,t_mdatoms *md,int atnr,t_inputrec *ir,
48 static bool bFirst=TRUE,bGlas;
49 static real d[2],pi6,pi12,rc9,rc4,rc10,rc3,rc;
51 real wd,wdd,zi,fz,dd,d10,d4,d9,d3,r9,r3,sign,cc6,cc12;
62 /* Check whether these constants have been set. */
63 bGlas = (pi6 != 0) && (pi12 != 0) && (d[0] != 0) && (d[1] != 0);
66 if (ir->eDispCorr != edispcNO) {
67 fatal_error(0,"Can not have Long Range C6 corrections and GLASMD");
69 rc = max(fr->rvdw,fr->rlist);
76 "Constants for GLASMD: pi6 = %10g, pi12 = %10g\n"
77 " d1 = %10g, d2 = %10g\n"
78 " rc3 = %10g, rc4 = %10g\n"
79 " rc9 = %10g, rc10 = %10g\n",
80 pi6,pi12,d[0],d[1],rc3,rc4,rc9,rc10);
82 fatal_error(0,"d1 > d2 for GLASMD (check log file)");
87 for(i=0; (i<atnr); i++) {
88 c6[i] = C6 (fr->nbfp,atnr,i,i);
89 c12[i] = C12(fr->nbfp,atnr,i,i);
93 fprintf(stderr,"No glasmd!\n");
99 for(i=start; (i<start+homenr); i++) {
101 if ((c6[ti] != 0) || (c12[ti] != 0)) {
103 cc6 = M_PI*sqrt(c6[ti]*pi6);
104 cc12 = M_PI*sqrt(c12[ti]*pi12);
106 /* Use a factor for the sign, this saves taking absolute values */
108 for(j=0; (j<2); j++) {
113 wdd = cc12/(45.0*d9) - cc6/(6.0*d3);
116 fz = sign*(cc12/(5.0*d10) - cc6/(2.0*d4));
119 wdd = cc12*(2.0/(9.0*rc9) - dd/(5.0*rc10)) -
120 cc6*(2.0/(3.0*rc3) - dd/(2.0*rc4));
121 fz = sign*(cc12/(5.0*rc10)-cc6/(2.0*rc4));