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