#include "gmx_wallcycle.h"
#include "vcm.h"
#include "nrnb.h"
+#include "md_logging.h"
+#include "md_support.h"
/* Is the signal in one simulation independent of other simulations? */
gmx_bool gs_simlocal[eglsNR] = { TRUE, FALSE, FALSE, TRUE };
const char *desc_nst,int nst,
const char *desc_p,int *p)
{
- char buf[STRLEN];
-
if (*p > 0 && *p % nst != 0)
{
/* Round up to the next multiple of nst */
*p = ((*p)/nst + 1)*nst;
- sprintf(buf,"NOTE: %s changes %s to %d\n",desc_nst,desc_p,*p);
- md_print_warning(cr,fplog,buf);
+ md_print_warn(cr,fplog,
+ "NOTE: %s changes %s to %d\n",desc_nst,desc_p,*p);
}
}
}
}
-void reset_all_counters(FILE *fplog,t_commrec *cr,
- gmx_large_int_t step,
- gmx_large_int_t *step_rel,t_inputrec *ir,
- gmx_wallcycle_t wcycle,t_nrnb *nrnb,
- gmx_runtime_t *runtime)
-{
- char buf[STRLEN],sbuf[STEPSTRSIZE];
-
- /* Reset all the counters related to performance over the run */
- sprintf(buf,"Step %s: resetting all time and cycle counters\n",
- gmx_step_str(step,sbuf));
- md_print_warning(cr,fplog,buf);
-
- wallcycle_stop(wcycle,ewcRUN);
- wallcycle_reset_all(wcycle);
- if (DOMAINDECOMP(cr))
- {
- reset_dd_statistics_counters(cr->dd);
- }
- init_nrnb(nrnb);
- ir->init_step += *step_rel;
- ir->nsteps -= *step_rel;
- *step_rel = 0;
- wallcycle_start(wcycle,ewcRUN);
- runtime_start(runtime);
- print_date_and_time(fplog,cr->nodeid,"Restarted time",runtime);
-}
-
-void min_zero(int *n,int i)
+static void min_zero(int *n,int i)
{
if (i > 0 && (*n == 0 || i < *n))
{
}
}
-int lcd4(int i1,int i2,int i3,int i4)
+static int lcd4(int i1,int i2,int i3,int i4)
{
int nst;
int check_nstglobalcomm(FILE *fplog,t_commrec *cr,
int nstglobalcomm,t_inputrec *ir)
{
- char buf[STRLEN];
-
if (!EI_DYNAMICS(ir->eI))
{
nstglobalcomm = 1;
nstglobalcomm > ir->nstlist && nstglobalcomm % ir->nstlist != 0)
{
nstglobalcomm = (nstglobalcomm / ir->nstlist)*ir->nstlist;
- sprintf(buf,"WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d\n",nstglobalcomm);
- md_print_warning(cr,fplog,buf);
+ md_print_warn(cr,fplog,"WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d\n",nstglobalcomm);
}
if (ir->nstcalcenergy > 0)
{
if (ir->comm_mode != ecmNO && ir->nstcomm < nstglobalcomm)
{
- sprintf(buf,"WARNING: Changing nstcomm from %d to %d\n",
- ir->nstcomm,nstglobalcomm);
- md_print_warning(cr,fplog,buf);
+ md_print_warn(cr,fplog,"WARNING: Changing nstcomm from %d to %d\n",
+ ir->nstcomm,nstglobalcomm);
ir->nstcomm = nstglobalcomm;
}
if (IR_TWINRANGE(*ir) && ir->nstlist > 1 &&
ir->nstcalcenergy % ir->nstlist != 0)
{
- md_print_warning(cr,fplog,"Old tpr file with twin-range settings: modifying energy calculation and/or T/P-coupling frequencies");
+ md_print_warn(cr,fplog,"Old tpr file with twin-range settings: modifying energy calculation and/or T/P-coupling frequencies\n");
if (gmx_mtop_ftype_count(mtop,F_CONSTR) +
gmx_mtop_ftype_count(mtop,F_CONSTRNC) > 0 &&
ir->eConstrAlg == econtSHAKE)
{
- md_print_warning(cr,fplog,"With twin-range cut-off's and SHAKE the virial and pressure are incorrect");
+ md_print_warn(cr,fplog,"With twin-range cut-off's and SHAKE the virial and pressure are incorrect\n");
if (ir->epc != epcNO)
{
gmx_fatal(FARGS,"Can not do pressure coupling with twin-range cut-off's and SHAKE");
}
}
}
-
-void md_print_warning(const t_commrec *cr,FILE *fplog,const char *buf)
-{
- if (MASTER(cr))
- {
- fprintf(stderr,"\n%s\n",buf);
- }
- if (fplog)
- {
- fprintf(fplog,"\n%s\n",buf);
- }
-}