gmx_large_int_t b,
gmx_large_int_t *result);
+static int gmx_greatest_common_divisor(int p, int q)
+{
+ int tmp;
+ while (q != 0)
+ {
+ tmp = q;
+ q = p % q;
+ p = tmp;
+ }
+ return p;
+}
+
#ifdef __cplusplus
}
#endif
debug_gmx();
- /* set free energy calculation frequency as the minimum of nstdhdl, nstexpanded, and nstrepl_ex_nst*/
+ /* set free energy calculation frequency as the minimum
+ greatest common denominator of nstdhdl, nstexpanded, and repl_ex_nst*/
nstfep = ir->fepvals->nstdhdl;
- if (ir->bExpanded && (nstfep > ir->expandedvals->nstexpanded))
+ if (ir->bExpanded)
{
- nstfep = ir->expandedvals->nstexpanded;
+ nstfep = gmx_greatest_common_divisor(ir->fepvals->nstdhdl,nstfep);
}
- if (repl_ex_nst > 0 && nstfep > repl_ex_nst)
+ if (repl_ex_nst > 0)
{
- nstfep = repl_ex_nst;
+ nstfep = gmx_greatest_common_divisor(repl_ex_nst,nstfep);
}
/* I'm assuming we need global communication the first time! MRS */
#include "mtop_util.h"
#include "gmx_ana.h"
-static int greatest_common_divisor(int p, int q)
-{
- int tmp;
- while (q != 0)
- {
- tmp = q;
- q = p % q;
- p = tmp;
- }
- return p;
-}
-
static void insert_ion(int nsa, int *nwater,
gmx_bool bSet[], int repl[], atom_id index[],
rvec x[], t_pbc *pbc,
/* Check if the system is neutralizable
* is (qdelta == p_q*p_num + n_q*n_num) solvable for p_num and n_num? */
- int gcd = greatest_common_divisor(n_q, p_q);
+ int gcd = gmx_greatest_common_divisor(n_q, p_q);
if ((qdelta % gcd) != 0)
{
gmx_fatal(FARGS, "Can't neutralize this system using -nq %d and"