| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-std=gnu17" } */ |
| 3 |
/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */ |
| 4 |
|
| 5 |
typedef float real; |
| 6 |
typedef struct |
| 7 |
{ |
| 8 |
int ngtc; |
| 9 |
real *ref_t; |
| 10 |
real *tau_t; |
| 11 |
} t_grpopts; |
| 12 |
typedef struct |
| 13 |
{ |
| 14 |
real T; |
| 15 |
real xi; |
| 16 |
} t_grp_tcstat; |
| 17 |
typedef struct |
| 18 |
{ |
| 19 |
t_grp_tcstat *tcstat; |
| 20 |
} t_groups; |
| 21 |
extern real *save_calloc (); |
| 22 |
void |
| 23 |
nosehoover_tcoupl (t_grpopts * opts, t_groups * grps, real dt, real SAfactor) |
| 24 |
{ |
| 25 |
static real *Qinv = ((void *) 0); |
| 26 |
int i; |
| 27 |
real reft = 0, xit, oldxi; |
| 28 |
if (Qinv == ((void *) 0)) |
| 29 |
{ |
| 30 |
(Qinv) = |
| 31 |
save_calloc ("Qinv", "coupling.c", 372, (opts->ngtc), |
| 32 |
sizeof (*(Qinv))); |
| 33 |
for (i = 0; i < opts->ngtc; i++) |
| 34 |
if ((opts->tau_t[i] > 0)) |
| 35 |
Qinv[i] = 1.0 / opts->tau_t[i]; |
| 36 |
} |
| 37 |
for (i = 0; (i < opts->ngtc); i++) |
| 38 |
{ |
| 39 |
reft = |
| 40 |
(((0.0) > |
| 41 |
(opts->ref_t[i] * SAfactor)) ? (0.0) : (opts->ref_t[i] * SAfactor)); |
| 42 |
grps->tcstat[i].xi += dt * Qinv[i] * (grps->tcstat[i].T - reft); |
| 43 |
} |
| 44 |
} |