1 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
5 /* { dg-options "-mcpu=power8 -O3 -funroll-loops" } */
6
7 #include <stddef.h>
8 #include <stdlib.h>
9 #include <math.h>
10 #include <string.h>
11
12 typedef long unsigned int size_t;
13 typedef struct _IO_FILE FILE;
14 typedef float real;
15 typedef real rvec[3];
16 typedef real matrix[3][3];
17 typedef real tensor[3][3];
18 enum
19 {
20 F_BONDS, F_G96BONDS, F_MORSE, F_CUBICBONDS, F_CONNBONDS, F_HARMONIC,
21 F_ANGLES, F_G96ANGLES, F_PDIHS, F_RBDIHS, F_IDIHS, F_LJ14, F_COUL14, F_LJ,
22 F_BHAM, F_LJLR, F_DISPCORR, F_SR, F_LR, F_WPOL, F_POSRES, F_DISRES,
23 F_DISRESVIOL, F_ORIRES, F_ORIRESDEV, F_ANGRES, F_ANGRESZ, F_SHAKE,
24 F_SHAKENC, F_SETTLE, F_DUMMY2, F_DUMMY3, F_DUMMY3FD, F_DUMMY3FAD,
25 F_DUMMY3OUT, F_DUMMY4FD, F_EQM, F_EPOT, F_EKIN, F_ETOT, F_TEMP, F_PRES,
26 F_DVDL, F_DVDLKIN, F_NRE
27 };
28 typedef union
29 {
30 struct
31 {
32 }
33 bham;
34 struct
35 {
36 real rA, krA, rB, krB;
37 }
38 harmonic;
39 }
40 t_iparams;
41 typedef struct
42 {
43 t_iparams *iparams;
44 }
45 t_idef;
46 typedef struct
47 {
48 }
49 t_inputrec;
50 typedef struct
51 {
52 }
53 t_commrec;
54 typedef struct
55 {
56 }
57 t_forcerec;
58 typedef struct
59 {
60 }
61 t_mdatoms;
62 typedef struct
63 {
64 }
65 t_filenm;
66 enum
67 {
68 eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy,
69 eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory =
70 eoObsNR, eoInter, eoUseVirial, eoNR
71 };
72 extern char *eoNames[eoNR];
73 typedef struct
74 {
75 int bPrint;
76 }
77 t_coupl_LJ;
78 typedef struct
79 {
80 int eObs;
81 t_iparams xi;
82 }
83 t_coupl_iparams;
84 typedef struct
85 {
86 real act_value[eoObsNR];
87 real av_value[eoObsNR];
88 real ref_value[eoObsNR];
89 int bObsUsed[eoObsNR];
90 int nLJ, nBU, nQ, nIP;
91 t_coupl_LJ *tcLJ;
92 }
93 t_coupl_rec;
94 void xvgr_legend ();
95 real calc_deviation ();
96 void pr_dev ();
97 static void
pr_ff(t_coupl_rec * tcr,real time,t_idef * idef,t_commrec * cr,int nfile,t_filenm fnm[])98 pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile,
99 t_filenm fnm[])
100 {
101 static FILE *prop;
102 static FILE **out = ((void *) 0);
103 static FILE **qq = ((void *) 0);
104 static FILE **ip = ((void *) 0);
105 char buf[256];
106 char *leg[] = {
107 "C12", "C6"
108 };
109 char **raleg;
110 int i, j, index;
111 if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0))
112 && (ip == ((void *) 0)))
113 {
114 for (i = j = 0; (i < eoObsNR); i++)
115 {
116 if (tcr->bObsUsed[i])
117 {
118 raleg[j++] =
119 (__extension__
120 (__builtin_constant_p (eoNames[i])
121 && ((size_t) (const void *) ((eoNames[i]) + 1) -
122 (size_t) (const void *) (eoNames[i]) ==
123 1) ? (((const char *) (eoNames[i]))[0] ==
124 '\0' ? (char *) calloc ((size_t) 1,
125 (size_t) 1) : (
126 {
127 size_t
128 __len
129 =
130 strlen
131 (eoNames
132 [i])
133 +
134 1;
135 char
136 *__retval
137 =
138 (char
139 *)
140 malloc
141 (__len);
142 __retval;}
143 )): strdup (eoNames[i])));
144 raleg[j++] =
145 (__extension__
146 (__builtin_constant_p (buf)
147 && ((size_t) (const void *) ((buf) + 1) -
148 (size_t) (const void *) (buf) ==
149 1) ? (((const char *) (buf))[0] ==
150 '\0' ? (char *) calloc ((size_t) 1,
151 (size_t) 1) : (
152 {
153 size_t
154 __len
155 =
156 strlen
157 (buf)
158 +
159 1;
160 char
161 *__retval
162 =
163 (char
164 *)
165 malloc
166 (__len);
167 __retval;}
168 )): strdup (buf)));
169 }
170 }
171 if (tcr->nLJ)
172 {
173 for (i = 0; (i < tcr->nLJ); i++)
174 {
175 if (tcr->tcLJ[i].bPrint)
176 {
177 xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])),
178 leg);
179 }
180 }
181 }
182 }
183 }
184
185 void
do_coupling(FILE * log,int nfile,t_filenm fnm[],t_coupl_rec * tcr,real t,int step,real ener[],t_forcerec * fr,t_inputrec * ir,int bMaster,t_mdatoms * md,t_idef * idef,real mu_aver,int nmols,t_commrec * cr,matrix box,tensor virial,tensor pres,rvec mu_tot,rvec x[],rvec f[],int bDoIt)186 do_coupling (FILE * log, int nfile, t_filenm fnm[], t_coupl_rec * tcr, real t,
187 int step, real ener[], t_forcerec * fr, t_inputrec * ir,
188 int bMaster, t_mdatoms * md, t_idef * idef, real mu_aver,
189 int nmols, t_commrec * cr, matrix box, tensor virial,
190 tensor pres, rvec mu_tot, rvec x[], rvec f[], int bDoIt)
191 {
192 int i, j, ati, atj, atnr2, type, ftype;
193 real deviation[eoObsNR], prdev[eoObsNR], epot0, dist, rmsf;
194 real ff6, ff12, ffa, ffb, ffc, ffq, factor, dt, mu_ind;
195 int bTest, bPrint;
196 t_coupl_iparams *tip;
197 if (bPrint)
198 {
199 pr_ff (tcr, t, idef, cr, nfile, fnm);
200 }
201 for (i = 0; (i < eoObsNR); i++)
202 {
203 deviation[i] =
204 calc_deviation (tcr->av_value[i], tcr->act_value[i],
205 tcr->ref_value[i]);
206 prdev[i] = tcr->ref_value[i] - tcr->act_value[i];
207 }
208 if (bPrint)
209 pr_dev (tcr, t, prdev, cr, nfile, fnm);
210 for (i = 0; (i < atnr2); i++)
211 {
212 factor = dt * deviation[tip->eObs];
213 switch (ftype)
214 {
215 case F_BONDS:
216 if (fabs (tip->xi.harmonic.krA) > 1.2e-38)
217 idef->iparams[type].harmonic.krA *=
218 (1 + factor / tip->xi.harmonic.krA);
219 }
220 }
221 }
222