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