{
public:
//! Shorthand for the per-frame accumulation data structure type.
- typedef AnalysisDataFrameLocalData<gmx_int64_t> FrameLocalData;
+ typedef AnalysisDataFrameLocalData<int64_t> FrameLocalData;
Impl() {}
//! Creates an histogram impl with defined bin parameters.
Awh::~Awh() = default;
-bool Awh::isOutputStep(gmx_int64_t step) const
+bool Awh::isOutputStep(int64_t step) const
{
return (nstout_ > 0 && step % nstout_ == 0);
}
const matrix box,
gmx::ForceWithVirial *forceWithVirial,
double t,
- gmx_int64_t step,
+ int64_t step,
gmx_wallcycle *wallcycle,
FILE *fplog)
{
}
/* Fill the AWH data block of an energy frame with data (if there is any). */
-void Awh::writeToEnergyFrame(gmx_int64_t step,
+void Awh::writeToEnergyFrame(int64_t step,
t_enxframe *frame) const
{
GMX_ASSERT(MASTER(commRecord_), "writeToEnergyFrame should only be called on the master rank");
const matrix box,
gmx::ForceWithVirial *forceWithVirial,
double t,
- gmx_int64_t step,
+ int64_t step,
gmx_wallcycle *wallcycle,
FILE *fplog);
* \param[in] step The current MD step.
* \param[in,out] fr Energy data frame.
*/
- void writeToEnergyFrame(gmx_int64_t step,
+ void writeToEnergyFrame(int64_t step,
t_enxframe *fr) const;
/*! \brief Returns string "AWH" for registering AWH as an external potential provider with the pull module.
*
* \param[in] step The current MD step.
*/
- bool isOutputStep(gmx_int64_t step) const;
+ bool isOutputStep(int64_t step) const;
private:
std::vector<BiasCoupledToSystem> biasCoupledToSystem_; /**< AWH biases and definitions of their coupling to the system. */
- const gmx_int64_t seed_; /**< Random seed for MC jumping with umbrella type bias potential. */
+ const int64_t seed_; /**< Random seed for MC jumping with umbrella type bias potential. */
const int nstout_; /**< Interval in steps for writing to energy file. */
const t_commrec *commRecord_; /**< Pointer to the communication record. */
const gmx_multisim_t *multiSimRecord_; /**< Handler for multi-simulations. */
namespace gmx
{
-void Bias::warnForHistogramAnomalies(double t, gmx_int64_t step, FILE *fplog)
+void Bias::warnForHistogramAnomalies(double t, int64_t step, FILE *fplog)
{
const int maxNumWarningsInCheck = 1; /* The maximum number of warnings to print per check */
const int maxNumWarningsInRun = 10; /* The maximum number of warnings to print in a run */
const t_commrec *commRecord,
const gmx_multisim_t *ms,
double t,
- gmx_int64_t step,
- gmx_int64_t seed,
+ int64_t step,
+ int64_t seed,
FILE *fplog)
{
if (step < 0)
* \param[in] pointState The state of the points in a bias.
* \returns the total sample count.
*/
-static gmx_int64_t countSamples(const std::vector<PointState> &pointState)
+static int64_t countSamples(const std::vector<PointState> &pointState)
{
double numSamples = 0;
for (const PointState &point : pointState)
numSamples += point.weightSumTot();
}
- return static_cast<gmx_int64_t>(numSamples + 0.5);
+ return static_cast<int64_t>(numSamples + 0.5);
}
/*! \brief
static void ensureStateAndRunConsistency(const BiasParams ¶ms,
const BiasState &state)
{
- gmx_int64_t numSamples = countSamples(state.points());
- gmx_int64_t numUpdatesFromSamples = numSamples/(params.numSamplesUpdateFreeEnergy_*params.numSharedUpdate);
- gmx_int64_t numUpdatesExpected = state.histogramSize().numUpdates();
+ int64_t numSamples = countSamples(state.points());
+ int64_t numUpdatesFromSamples = numSamples/(params.numSamplesUpdateFreeEnergy_*params.numSharedUpdate);
+ int64_t numUpdatesExpected = state.histogramSize().numUpdates();
if (numUpdatesFromSamples != numUpdatesExpected)
{
std::string mesg = gmx::formatString("The number of AWH updates in the checkpoint file (%ld) does not match the total number of AWH samples divided by the number of samples per update for %d sharing AWH bias(es) (%ld/%d=%ld)",
const t_commrec *commRecord,
const gmx_multisim_t *ms,
double t,
- gmx_int64_t step,
- gmx_int64_t seed,
+ int64_t step,
+ int64_t seed,
FILE *fplog);
/*! \brief
* \param[in,out] fplog Output file for warnings.
*/
void warnForHistogramAnomalies(double t,
- gmx_int64_t step,
+ int64_t step,
FILE *fplog);
/*! \brief
* \param[in] awhBiasParams Bias parameters.
* \returns the target update interval in steps.
*/
-gmx_int64_t calcTargetUpdateInterval(const AwhParams &awhParams,
- const AwhBiasParams &awhBiasParams)
+int64_t calcTargetUpdateInterval(const AwhParams &awhParams,
+ const AwhBiasParams &awhBiasParams)
{
- gmx_int64_t numStepsUpdateTarget = 0;
+ int64_t numStepsUpdateTarget = 0;
/* Set the target update frequency based on the target distrbution type
* (this could be made a user-option but there is most likely no big need
* for tweaking this for most users).
* \param[in] gridAxis The Grid axes.
* \returns the check interval in steps.
*/
-gmx_int64_t calcCheckCoveringInterval(const AwhParams &awhParams,
- const std::vector<DimParams> &dimParams,
- const std::vector<GridAxis> &gridAxis)
+int64_t calcCheckCoveringInterval(const AwhParams &awhParams,
+ const std::vector<DimParams> &dimParams,
+ const std::vector<GridAxis> &gridAxis)
{
/* Each sample will have a width of sigma. To cover the axis a
minimum number of samples of width sigma is required. */
*
* \param[in] step The MD step number.
*/
- inline bool isSampleCoordStep(gmx_int64_t step) const
+ inline bool isSampleCoordStep(int64_t step) const
{
return (step > 0 && step % numStepsSampleCoord_ == 0);
}
*
* \param[in] step The MD step number.
*/
- inline bool isUpdateFreeEnergyStep(gmx_int64_t step) const
+ inline bool isUpdateFreeEnergyStep(int64_t step) const
{
int stepIntervalUpdateFreeEnergy = numSamplesUpdateFreeEnergy_*numStepsSampleCoord_;
return (step > 0 && step % stepIntervalUpdateFreeEnergy == 0);
*
* \param[in] step The MD step number.
*/
- inline bool isUpdateTargetStep(gmx_int64_t step) const
+ inline bool isUpdateTargetStep(int64_t step) const
{
return step % numStepsUpdateTarget_ == 0;
}
* \returns true at steps where checks should be performed.
* \note Only returns true at free energy update steps.
*/
- bool isCheckCoveringStep(gmx_int64_t step) const
+ bool isCheckCoveringStep(int64_t step) const
{
return step % numStepsCheckCovering_ == 0;
}
* \note Only returns true at free energy update steps.
* \todo Currently this function just calls isCheckCoveringStep but the checks could be done less frequently.
*/
- bool isCheckHistogramForAnomaliesStep(gmx_int64_t step) const
+ bool isCheckHistogramForAnomaliesStep(int64_t step) const
{
return isCheckCoveringStep(step);
}
/* Data members */
const double invBeta; /**< 1/beta = kT in kJ/mol */
private:
- const gmx_int64_t numStepsSampleCoord_; /**< Number of steps per coordinate value sample. */
+ const int64_t numStepsSampleCoord_; /**< Number of steps per coordinate value sample. */
public:
const int numSamplesUpdateFreeEnergy_; /**< Number of samples per free energy update. */
private:
- const gmx_int64_t numStepsUpdateTarget_; /**< Number of steps per updating the target distribution. */
- const gmx_int64_t numStepsCheckCovering_; /**< Number of steps per checking for covering. */
+ const int64_t numStepsUpdateTarget_; /**< Number of steps per updating the target distribution. */
+ const int64_t numStepsCheckCovering_; /**< Number of steps per checking for covering. */
public:
const int eTarget; /**< Type of target distribution. */
const double freeEnergyCutoffInKT; /**< Free energy cut-off in kT for cut-off target distribution. */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
if (awhParams.awhBiasParams[b].shareGroup > 0)
{
- std::vector<gmx_int64_t> pointSizes(numSim);
+ std::vector<int64_t> pointSizes(numSim);
pointSizes[multiSimComm->sim] = pointSize[b];
gmx_sumli_sim(pointSizes.size(), pointSizes.data(), multiSimComm);
for (int sim = 1; sim < numSim; sim++)
const Grid &grid,
gmx::ArrayRef<const double> probWeightNeighbor,
gmx::ArrayRef<double> biasForce,
- gmx_int64_t step,
- gmx_int64_t seed,
+ int64_t step,
+ int64_t seed,
int indexSeed)
{
/* Generate and set a new coordinate reference value */
const t_commrec *commRecord,
const gmx_multisim_t *multiSimComm,
double t,
- gmx_int64_t step,
+ int64_t step,
FILE *fplog,
std::vector<int> *updateList)
{
const Grid &grid,
gmx::ArrayRef<const double> probWeightNeighbor,
gmx::ArrayRef<double> biasForce,
- gmx_int64_t step,
- gmx_int64_t seed,
+ int64_t step,
+ int64_t seed,
int indexSeed);
private:
const t_commrec *commRecord,
const gmx_multisim_t *ms,
double t,
- gmx_int64_t step,
+ int64_t step,
FILE *fplog,
std::vector<int> *updateList);
* \returns a sample index in [0, distr.size() - 1]
*/
int getSampleFromDistribution(ArrayRef<const double> distr,
- gmx_int64_t seed,
- gmx_int64_t indexSeed0,
- gmx_int64_t indexSeed1)
+ int64_t seed,
+ int64_t indexSeed0,
+ int64_t indexSeed1)
{
gmx::ThreeFry2x64<0> rng(seed, gmx::RandomDomain::AwhBiasing);
gmx::UniformRealDistribution<real> uniformRealDistr;
CoordState::sampleUmbrellaGridpoint(const Grid &grid,
int gridpointIndex,
gmx::ArrayRef<const double> probWeightNeighbor,
- gmx_int64_t step,
- gmx_int64_t seed,
+ int64_t step,
+ int64_t seed,
int indexSeed)
{
/* Sample new umbrella reference value from the probability distribution
void sampleUmbrellaGridpoint(const Grid &grid,
int gridpointIndex,
gmx::ArrayRef<const double> probWeightNeighbor,
- gmx_int64_t step,
- gmx_int64_t seed,
+ int64_t step,
+ int64_t seed,
int indexSeed);
/*! \brief Update the coordinate value with coordValue.
}
private:
- gmx_int64_t numUpdates_; /**< The number of updates performed since the start of the simulation. */
+ int64_t numUpdates_; /**< The number of updates performed since the start of the simulation. */
/* The histogram size sets the update size and so controls the convergence rate of the free energy and bias. */
double histogramSize_; /**< Size of reference weight histogram. */
* \returns true if at least one update was applied.
*/
bool performPreviouslySkippedUpdates(const BiasParams ¶ms,
- gmx_int64_t numUpdates,
+ int64_t numUpdates,
double weighthistScaling,
double logPmfSumScaling)
{
}
/* The most current past update */
- gmx_int64_t lastUpdateIndex = numUpdates;
- gmx_int64_t numUpdatesSkipped = lastUpdateIndex - lastUpdateIndex_;
+ int64_t lastUpdateIndex = numUpdates;
+ int64_t numUpdatesSkipped = lastUpdateIndex - lastUpdateIndex_;
if (numUpdatesSkipped == 0)
{
* \param[in] logPmfSumScaling Log of the scaling factor for the PMF histogram.
*/
void updateWithNewSampling(const BiasParams ¶ms,
- gmx_int64_t numUpdates,
+ int64_t numUpdates,
double weighthistScaling,
double logPmfSumScaling)
{
}
private:
- double bias_; /**< Current biasing function estimate */
- double freeEnergy_; /**< Current estimate of the convolved free energy/PMF. */
- double target_; /**< Current target distribution, normalized to 1 */
- double targetConstantWeight_; /**< Constant target weight, from user data. */
- double weightSumIteration_; /**< Accumulated weight this iteration; note: only contains data for this Bias, even when sharing biases. */
- double weightSumTot_; /**< Accumulated weights, never reset */
- double weightSumRef_; /**< The reference weight histogram determining the free energy updates */
- gmx_int64_t lastUpdateIndex_; /**< The last update that was performed at this point, in units of number of updates. */
- double logPmfSum_; /**< Logarithm of the PMF histogram */
- double numVisitsIteration_; /**< Visits to this bin this iteration; note: only contains data for this Bias, even when sharing biases. */
- double numVisitsTot_; /**< Accumulated visits to this bin */
+ double bias_; /**< Current biasing function estimate */
+ double freeEnergy_; /**< Current estimate of the convolved free energy/PMF. */
+ double target_; /**< Current target distribution, normalized to 1 */
+ double targetConstantWeight_; /**< Constant target weight, from user data. */
+ double weightSumIteration_; /**< Accumulated weight this iteration; note: only contains data for this Bias, even when sharing biases. */
+ double weightSumTot_; /**< Accumulated weights, never reset */
+ double weightSumRef_; /**< The reference weight histogram determining the free energy updates */
+ int64_t lastUpdateIndex_; /**< The last update that was performed at this point, in units of number of updates. */
+ double logPmfSum_; /**< Logarithm of the PMF histogram */
+ double numVisitsIteration_; /**< Visits to this bin this iteration; note: only contains data for this Bias, even when sharing biases. */
+ double numVisitsTot_; /**< Accumulated visits to this bin */
};
} // namespace gmx
if (awhParams->seed == -1)
{
awhParams->seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Setting the AWH bias MC random seed to %" GMX_PRId64 "\n", awhParams->seed);
+ fprintf(stderr, "Setting the AWH bias MC random seed to %" PRId64 "\n", awhParams->seed);
}
printStringNoNewline(inp, "Data output interval in number of steps");
double convFactor = 1;
double k = 1000;
- gmx_int64_t seed = 93471803;
+ int64_t seed = 93471803;
params.dimParams.push_back(DimParams(convFactor, k, params.beta));
{
public:
//! Random seed for AWH MC sampling
- gmx_int64_t seed_;
+ int64_t seed_;
//! Coordinates representing a trajectory in time
std::vector<double> coordinates_;
double coordMaxValue = 0;
double potentialJump = 0;
- gmx_int64_t step = 0;
+ int64_t step = 0;
for (auto &coord : coordinates_)
{
coordMaxValue = std::max(coordMaxValue, std::abs(coord));
* coordinate range in a semi-realistic way. The period is 4*pi=12.57.
* We get out of the initial stage after 4 coverings at step 300.
*/
- const gmx_int64_t exitStepRef = 300;
+ const int64_t exitStepRef = 300;
const double midPoint = 0.5*(awhDimParams.end + awhDimParams.origin);
const double halfWidth = 0.5*(awhDimParams.end - awhDimParams.origin);
bool inInitialStage = bias.state().inInitialStage();
/* Normally this loop exits at exitStepRef, but we extend with failure */
- gmx_int64_t step;
+ int64_t step;
for (step = 0; step <= 2*exitStepRef; step++)
{
double t = step*mdTimeStep;
/** Integer value for etINT. */
int *i;
/** Integer value for etINT64. */
- gmx_int64_t *is;
+ int64_t *is;
/** Real value for etREAL and etTIME. */
real *r;
/*! \brief
TEST_F(ParseCommonArgsTest, ParsesInt64Args)
{
- gmx_int64_t value1 = 0, value2 = 0, value3 = 3;
+ int64_t value1 = 0, value2 = 0, value3 = 3;
t_pargs pa[] = {
{ "-i1", FALSE, etINT64, {&value1}, "Description" },
{ "-i2", FALSE, etINT64, {&value2}, "Description" },
static void dd_cell_sizes_dlb_root_enforce_limits(gmx_domdec_t *dd,
int d, int dim, RowMaster *rowMaster,
const gmx_ddbox_t *ddbox,
- gmx_bool bUniform, gmx_int64_t step, real cellsize_limit_f, int range[])
+ gmx_bool bUniform, int64_t step, real cellsize_limit_f, int range[])
{
gmx_domdec_comm_t *comm;
real halfway, cellsize_limit_f_i, region_size;
int d, int dim, RowMaster *rowMaster,
const gmx_ddbox_t *ddbox,
gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_int64_t step)
+ gmx_bool bUniform, int64_t step)
{
gmx_domdec_comm_t *comm = dd->comm;
constexpr real c_relax = 0.5;
static void set_dd_cell_sizes_dlb_change(gmx_domdec_t *dd,
const gmx_ddbox_t *ddbox,
gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_int64_t step)
+ gmx_bool bUniform, int64_t step)
{
for (int d = 0; d < dd->ndim; d++)
{
static void set_dd_cell_sizes_dlb(gmx_domdec_t *dd,
const gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_bool bDoDLB, gmx_int64_t step,
+ gmx_bool bUniform, gmx_bool bDoDLB, int64_t step,
gmx_wallcycle_t wcycle)
{
gmx_domdec_comm_t *comm;
void set_dd_cell_sizes(gmx_domdec_t *dd,
const gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_bool bDoDLB, gmx_int64_t step,
+ gmx_bool bUniform, gmx_bool bDoDLB, int64_t step,
gmx_wallcycle_t wcycle)
{
gmx_domdec_comm_t *comm = dd->comm;
/*! \brief General cell size adjustment, possibly applying dynamic load balancing */
void set_dd_cell_sizes(gmx_domdec_t *dd,
const gmx_ddbox_t *ddbox, gmx_bool bDynamicBox,
- gmx_bool bUniform, gmx_bool bDoDLB, gmx_int64_t step,
+ gmx_bool bUniform, gmx_bool bDoDLB, int64_t step,
gmx_wallcycle_t wcycle);
#endif
}
}
-static void write_dd_grid_pdb(const char *fn, gmx_int64_t step,
+static void write_dd_grid_pdb(const char *fn, int64_t step,
gmx_domdec_t *dd, matrix box, gmx_ddbox_t *ddbox)
{
rvec grid_s[2], *grid_r = nullptr, cx, r;
}
}
-void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
+void write_dd_pdb(const char *fn, int64_t step, const char *title,
const gmx_mtop_t *mtop, const t_commrec *cr,
int natoms, const rvec x[], const matrix box)
{
}
}
-static bool check_grid_jump(gmx_int64_t step,
+static bool check_grid_jump(int64_t step,
const gmx_domdec_t *dd,
real cutoff,
const gmx_ddbox_t *ddbox,
static void comm_dd_ns_cell_sizes(gmx_domdec_t *dd,
gmx_ddbox_t *ddbox,
rvec cell_ns_x0, rvec cell_ns_x1,
- gmx_int64_t step)
+ int64_t step)
{
gmx_domdec_comm_t *comm;
int dim_ind, dim;
}
}
-static void dd_print_load(FILE *fplog, gmx_domdec_t *dd, gmx_int64_t step)
+static void dd_print_load(FILE *fplog, gmx_domdec_t *dd, int64_t step)
{
int flags, d;
char buf[22];
}
-static void turn_on_dlb(FILE *fplog, const t_commrec *cr, gmx_int64_t step)
+static void turn_on_dlb(FILE *fplog, const t_commrec *cr, int64_t step)
{
gmx_domdec_t *dd = cr->dd;
gmx_domdec_comm_t *comm = dd->comm;
/* Turn off DLB if we're too close to the cell size limit. */
if (cellsize_min < comm->cellsize_limit*1.05)
{
- auto str = gmx::formatString("step %" GMX_PRId64 " Measured %.1f %% performance loss due to load imbalance, "
+ auto str = gmx::formatString("step %" PRId64 " Measured %.1f %% performance loss due to load imbalance, "
"but the minimum cell size is smaller than 1.05 times the cell size limit."
"Will no longer try dynamic load balancing.\n", step, dd_force_imb_perf_loss(dd)*100);
dd_warning(cr, fplog, str.c_str());
}
char buf[STRLEN];
- sprintf(buf, "step %" GMX_PRId64 " Turning on dynamic load balancing, because the performance loss due to load imbalance is %.1f %%.\n", step, dd_force_imb_perf_loss(dd)*100);
+ sprintf(buf, "step %" PRId64 " Turning on dynamic load balancing, because the performance loss due to load imbalance is %.1f %%.\n", step, dd_force_imb_perf_loss(dd)*100);
dd_warning(cr, fplog, buf);
comm->dlbState = edlbsOnCanTurnOff;
}
}
-static void turn_off_dlb(FILE *fplog, const t_commrec *cr, gmx_int64_t step)
+static void turn_off_dlb(FILE *fplog, const t_commrec *cr, int64_t step)
{
gmx_domdec_t *dd = cr->dd;
char buf[STRLEN];
- sprintf(buf, "step %" GMX_PRId64 " Turning off dynamic load balancing, because it is degrading performance.\n", step);
+ sprintf(buf, "step %" PRId64 " Turning off dynamic load balancing, because it is degrading performance.\n", step);
dd_warning(cr, fplog, buf);
dd->comm->dlbState = edlbsOffCanTurnOn;
dd->comm->haveTurnedOffDlb = true;
dd->comm->ddPartioningCountFirstDlbOff = dd->ddp_count;
}
-static void turn_off_dlb_forever(FILE *fplog, const t_commrec *cr, gmx_int64_t step)
+static void turn_off_dlb_forever(FILE *fplog, const t_commrec *cr, int64_t step)
{
GMX_RELEASE_ASSERT(cr->dd->comm->dlbState == edlbsOffCanTurnOn, "Can only turn off DLB forever when it was in the can-turn-on state");
char buf[STRLEN];
- sprintf(buf, "step %" GMX_PRId64 " Will no longer try dynamic load balancing, as it degraded performance.\n", step);
+ sprintf(buf, "step %" PRId64 " Will no longer try dynamic load balancing, as it degraded performance.\n", step);
dd_warning(cr, fplog, buf);
cr->dd->comm->dlbState = edlbsOffForever;
}
}
void dd_partition_system(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
const t_commrec *cr,
gmx_bool bMasterState,
int nstglobalcomm,
gmx_domdec_comm_t *comm;
gmx_ddbox_t ddbox = {0};
t_block *cgs_gl;
- gmx_int64_t step_pcoupl;
+ int64_t step_pcoupl;
rvec cell_ns_x0, cell_ns_x1;
int ncgindex_set, ncg_home_old = -1, ncg_moved, nat_f_novirsum;
gmx_bool bBoxChanged, bNStGlobalComm, bDoDLB, bCheckWhetherToTurnDlbOn, bLogLoad;
* When f!=NULL, *f will be reallocated to the size of state_local.
*/
void dd_partition_system(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
const t_commrec *cr,
gmx_bool bMasterState,
int nstglobalcomm,
*
* When natoms=-1, dump all known atoms.
*/
-void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
+void write_dd_pdb(const char *fn, int64_t step, const char *title,
const gmx_mtop_t *mtop,
const t_commrec *cr,
int natoms, const rvec x[], const matrix box);
/** Which cg distribution is stored on the master node,
* stored as DD partitioning call count.
*/
- gmx_int64_t master_cg_ddp_count;
+ int64_t master_cg_ddp_count;
/** The number of cg's received from the direct neighbors */
int zone_ncg1[DD_MAXZONE];
float cyclesPerStepBeforeDLB; /**< The averaged cycles per step over the last nstlist step before turning on DLB */
float cyclesPerStepDlbExpAverage; /**< The running average of the cycles per step during DLB */
bool haveTurnedOffDlb; /**< Have we turned off DLB (after turning DLB on)? */
- gmx_int64_t dlbSlowerPartitioningCount; /**< The DD step at which we last measured that DLB off was faster than DLB on, 0 if there was no such step */
+ int64_t dlbSlowerPartitioningCount; /**< The DD step at which we last measured that DLB off was faster than DLB on, 0 if there was no such step */
/* Statistics for atoms */
double sum_nat[static_cast<int>(DDAtomRanges::Type::Number)]; /**< The atoms per range, summed over the steps */
double load_pme; /**< Total time on our PME-only rank */
/** The last partition step */
- gmx_int64_t partition_step;
+ int64_t partition_step;
/* Debugging */
int nstDDDump; /**< Step interval for dumping the local+non-local atoms to pdb */
real cellsize_limit, real cutoff_dd,
gmx_bool bInterCGBondeds)
{
- gmx_int64_t nnodes_div, ldiv;
+ int64_t nnodes_div, ldiv;
real limit;
if (MASTER(cr))
gmx_domdec_comm_t *comm;
/* The partioning count, to keep track of the state */
- gmx_int64_t ddp_count;
+ int64_t ddp_count;
/* The managed atom sets that are updated in domain decomposition */
gmx::LocalAtomSetManager * atomSets;
static void print_cg_move(FILE *fplog,
gmx_domdec_t *dd,
- gmx_int64_t step, int cg, int dim, int dir,
+ int64_t step, int cg, int dim, int dir,
gmx_bool bHaveCgcmOld, real limitd,
rvec cm_old, rvec cm_new, real pos_d)
{
[[ noreturn ]]
static void cg_move_error(FILE *fplog,
gmx_domdec_t *dd,
- gmx_int64_t step, int cg, int dim, int dir,
+ int64_t step, int cg, int dim, int dir,
gmx_bool bHaveCgcmOld, real limitd,
rvec cm_old, rvec cm_new, real pos_d)
{
*
* \TODO Rename cg to atomGroup.
*/
-static void calc_cg_move(FILE *fplog, gmx_int64_t step,
+static void calc_cg_move(FILE *fplog, int64_t step,
gmx_domdec_t *dd,
t_state *state,
const ivec tric_dir, matrix tcm,
}
}
-void dd_redistribute_cg(FILE *fplog, gmx_int64_t step,
+void dd_redistribute_cg(FILE *fplog, int64_t step,
gmx_domdec_t *dd, ivec tric_dir,
t_state *state, PaddedRVecVector *f,
t_forcerec *fr,
/*! \brief Redistribute the atoms to their, new, local domains */
void dd_redistribute_cg(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
gmx_domdec_t *dd,
ivec tric_dir,
t_state *state,
/* From flood.xproj compute the Vfl(x) at this point */
-static real flood_energy(t_edpar *edi, gmx_int64_t step)
+static real flood_energy(t_edpar *edi, int64_t step)
{
/* compute flooding energy Vfl
Vfl = Efl * exp( - \frac {kT} {2Efl alpha^2} * sum_i { \lambda_i c_i^2 } )
const rvec x[],
rvec force[],
t_edpar *edi,
- gmx_int64_t step,
+ int64_t step,
matrix box,
const t_commrec *cr,
gmx_bool bNS) /* Are we in a neighbor searching step? */
rvec force[],
const gmx_edsam *ed,
matrix box,
- gmx_int64_t step,
+ int64_t step,
gmx_bool bNS)
{
t_edpar *edi;
}
-static void do_linfix(rvec *xcoll, t_edpar *edi, gmx_int64_t step)
+static void do_linfix(rvec *xcoll, t_edpar *edi, int64_t step)
{
int i, j;
real proj, add;
}
-static void ed_apply_constraints(rvec *xcoll, t_edpar *edi, gmx_int64_t step)
+static void ed_apply_constraints(rvec *xcoll, t_edpar *edi, int64_t step)
{
int i;
void do_edsam(const t_inputrec *ir,
- gmx_int64_t step,
+ int64_t step,
const t_commrec *cr,
rvec xs[],
rvec v[],
* \param box The simulation box.
* \param ed The essential dynamics data.
*/
-void do_edsam(const t_inputrec *ir, gmx_int64_t step,
+void do_edsam(const t_inputrec *ir, int64_t step,
const t_commrec *cr, rvec xs[], rvec v[], matrix box, gmx_edsam *ed);
rvec force[],
const gmx_edsam *ed,
matrix box,
- gmx_int64_t step,
+ int64_t step,
gmx_bool bNS);
/*! \brief Clean up
struct pme_load_balancing_t {
gmx_bool bSepPMERanks; /**< do we have separate PME ranks? */
gmx_bool bActive; /**< is PME tuning active? */
- gmx_int64_t step_rel_stop; /**< stop the tuning after this value of step_rel */
+ int64_t step_rel_stop; /**< stop the tuning after this value of step_rel */
gmx_bool bTriggerOnDLB; /**< trigger balancing only on DD DLB */
gmx_bool bBalance; /**< are we in the balancing phase, i.e. trying different setups? */
int nstage; /**< the current maximum number of stages */
/*! \brief Print descriptive string about what limits PME load balancing */
static void print_loadbal_limited(FILE *fp_err, FILE *fp_log,
- gmx_int64_t step,
+ int64_t step,
pme_load_balancing_t *pme_lb)
{
char buf[STRLEN], sbuf[22];
interaction_const_t *ic,
struct nonbonded_verlet_t *nbv,
struct gmx_pme_t ** pmedata,
- gmx_int64_t step)
+ int64_t step)
{
gmx_bool OK;
pme_setup_t *set;
t_forcerec *fr,
t_state *state,
gmx_wallcycle_t wcycle,
- gmx_int64_t step,
- gmx_int64_t step_rel,
+ int64_t step,
+ int64_t step_rel,
gmx_bool *bPrinting)
{
int n_prev;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
t_forcerec *fr,
t_state *state,
gmx_wallcycle_t wcycle,
- gmx_int64_t step,
- gmx_int64_t step_rel,
+ int64_t step,
+ int64_t step_rel,
gmx_bool *bPrinting);
/*! \brief Finish the PME load balancing and print the settings when fplog!=NULL */
static void reset_pmeonly_counters(gmx_wallcycle_t wcycle,
gmx_walltime_accounting_t walltime_accounting,
t_nrnb *nrnb, t_inputrec *ir,
- gmx_int64_t step,
+ int64_t step,
bool useGpuForPme)
{
/* Reset all the counters related to performance over the run */
real *lambda_q,
real *lambda_lj,
gmx_bool *bEnerVir,
- gmx_int64_t *step,
+ int64_t *step,
ivec *grid_size,
real *ewaldcoeff_q,
real *ewaldcoeff_lj,
float cycles;
int count;
gmx_bool bEnerVir = FALSE;
- gmx_int64_t step;
+ int64_t step;
/* This data will only use with PME tuning, i.e. switching PME grids */
std::vector<gmx_pme_t *> pmedata;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real lambda_q; /**< Free-energy lambda for electrostatics */
real lambda_lj; /**< Free-energy lambda for Lennard-Jones */
unsigned int flags; /**< Control flags */
- gmx_int64_t step; /**< MD integration step number */
+ int64_t step; /**< MD integration step number */
//@{
/*! \brief Used in PME grid tuning */
ivec grid_size;
matrix box, rvec gmx_unused *x,
real lambda_q, real lambda_lj,
int maxshift_x, int maxshift_y,
- gmx_int64_t step)
+ int64_t step)
{
gmx_domdec_t *dd;
gmx_pme_comm_n_box_t *cnb;
void gmx_pme_send_coordinates(const t_commrec *cr, matrix box, rvec *x,
real lambda_q, real lambda_lj,
gmx_bool bEnerVir,
- gmx_int64_t step, gmx_wallcycle *wcycle)
+ int64_t step, gmx_wallcycle *wcycle)
{
wallcycle_start(wcycle, ewcPP_PMESENDX);
#endif
}
-void gmx_pme_send_resetcounters(const t_commrec gmx_unused *cr, gmx_int64_t gmx_unused step)
+void gmx_pme_send_resetcounters(const t_commrec gmx_unused *cr, int64_t gmx_unused step)
{
#if GMX_MPI
gmx_pme_comm_n_box_t cnb;
void gmx_pme_send_coordinates(const t_commrec *cr, matrix box, rvec *x,
real lambda_q, real lambda_lj,
gmx_bool bEnerVir,
- gmx_int64_t step, gmx_wallcycle *wcycle);
+ int64_t step, gmx_wallcycle *wcycle);
/*! \brief Tell our PME-only node to finish */
void gmx_pme_send_finish(const t_commrec *cr);
/*! \brief Tell our PME-only node to reset all cycle and flop counters */
-void gmx_pme_send_resetcounters(const t_commrec *cr, gmx_int64_t step);
+void gmx_pme_send_resetcounters(const t_commrec *cr, int64_t step);
/*! \brief PP nodes receive the long range forces from the PME nodes */
void gmx_pme_receive_f(const t_commrec *cr,
gridValuesMagnitude = std::max(std::fabs(point.second.im), gridValuesMagnitude);
}
// Spline moduli participate 3 times in the computation; 2 is an additional factor for SIMD exp() precision
- gmx_uint64_t gridUlpToleranceFactor = DIM * 2;
+ uint64_t gridUlpToleranceFactor = DIM * 2;
if (method == PmeSolveAlgorithm::LennardJones)
{
// Lennard Jones is more complex and also uses erfc(), relax more
gridUlpToleranceFactor *= 2;
}
- const gmx_uint64_t splineModuliDoublePrecisionUlps
+ const uint64_t splineModuliDoublePrecisionUlps
= getSplineModuliDoublePrecisionUlps(inputRec.pme_order + 1);
auto gridTolerance
= relativeToleranceAsPrecisionDependentUlp(gridValuesMagnitude,
/* Energy */
double energyMagnitude = 10.0;
// TODO This factor is arbitrary, do a proper error-propagation analysis
- gmx_uint64_t energyUlpToleranceFactor = gridUlpToleranceFactor * 2;
+ uint64_t energyUlpToleranceFactor = gridUlpToleranceFactor * 2;
auto energyTolerance
= relativeToleranceAsPrecisionDependentUlp(energyMagnitude,
energyUlpToleranceFactor * c_splineModuliSinglePrecisionUlps,
/* Virial */
double virialMagnitude = 1000.0;
// TODO This factor is arbitrary, do a proper error-propagation analysis
- gmx_uint64_t virialUlpToleranceFactor = energyUlpToleranceFactor * 2;
+ uint64_t virialUlpToleranceFactor = energyUlpToleranceFactor * 2;
auto virialTolerance
= relativeToleranceAsPrecisionDependentUlp(virialMagnitude,
virialUlpToleranceFactor * c_splineModuliSinglePrecisionUlps,
return implemented;
}
-gmx_uint64_t getSplineModuliDoublePrecisionUlps(int splineOrder)
+uint64_t getSplineModuliDoublePrecisionUlps(int splineOrder)
{
/* Arbitrary ulp tolerance for sine/cosine implementation. It's
* hard to know what to pick without testing lots of
* implementations. */
- const gmx_uint64_t sineUlps = 10;
+ const uint64_t sineUlps = 10;
return 4 * (splineOrder - 2) + 2 * sineUlps * splineOrder;
}
bool pmeSupportsInputForMode(const t_inputrec *inputRec, CodePath mode);
//! Spline moduli are computed in double precision, so they're very good in single precision
-constexpr gmx_int64_t c_splineModuliSinglePrecisionUlps = 1;
+constexpr int64_t c_splineModuliSinglePrecisionUlps = 1;
/*! \brief For double precision checks, the recursive interpolation
* and use of trig functions in make_dft_mod require a lot more flops,
* and thus opportunity for deviation between implementations. */
-gmx_uint64_t getSplineModuliDoublePrecisionUlps(int splineOrder);
+uint64_t getSplineModuliDoublePrecisionUlps(int splineOrder);
// PME stages
}
}
-static void do_cpt_step_err(XDR *xd, const char *desc, gmx_int64_t *i, FILE *list)
+static void do_cpt_step_err(XDR *xd, const char *desc, int64_t *i, FILE *list)
{
char buf[STEPSTRSIZE];
char ftime[CPTSTRLEN];
int eIntegrator;
int simulation_part;
- gmx_int64_t step;
+ int64_t step;
double t;
int nnodes;
ivec dd_nc;
{
int idum = 0;
do_cpt_int_err(xd, "step", &idum, list);
- contents->step = static_cast<gmx_int64_t>(idum);
+ contents->step = static_cast<int64_t>(idum);
}
do_cpt_double_err(xd, "t", &contents->t, list);
do_cpt_int_err(xd, "#PP-ranks", &contents->nnodes, list);
ivec domdecCells, int nppnodes,
int eIntegrator, int simulation_part,
gmx_bool bExpanded, int elamstats,
- gmx_int64_t step, double t,
+ int64_t step, double t,
t_state *state, ObservablesHistory *observablesHistory)
{
t_fileio *fp;
void read_checkpoint_part_and_step(const char *filename,
int *simulation_part,
- gmx_int64_t *step)
+ int64_t *step)
{
t_fileio *fp;
}
static void read_checkpoint_data(t_fileio *fp, int *simulation_part,
- gmx_int64_t *step, double *t, t_state *state,
+ int64_t *step, double *t, t_state *state,
std::vector<gmx_file_position_t> *outputfiles)
{
int ret;
{
t_state state;
int simulation_part;
- gmx_int64_t step;
+ int64_t step;
double t;
std::vector<gmx_file_position_t> outputfiles;
fr->natoms = state.natoms;
fr->bStep = TRUE;
- fr->step = gmx_int64_to_int(step,
- "conversion of checkpoint to trajectory");
+ fr->step = int64_to_int(step,
+ "conversion of checkpoint to trajectory");
fr->bTime = TRUE;
fr->time = t;
fr->bLambda = TRUE;
int *simulation_part,
std::vector<gmx_file_position_t> *outputfiles)
{
- gmx_int64_t step = 0;
+ int64_t step = 0;
double t;
t_state state;
ivec domdecCells, int nppnodes,
int eIntegrator, int simulation_part,
gmx_bool bExpanded, int elamstats,
- gmx_int64_t step, double t,
+ int64_t step, double t,
t_state *state, ObservablesHistory *observablesHistory);
/* Loads a checkpoint from fn for run continuation.
* does not exist, or is not readable. */
void read_checkpoint_part_and_step(const char *filename,
int *simulation_part,
- gmx_int64_t *step);
+ int64_t *step);
/* ! \brief Read simulation part and output filenames from a checkpoint file
*
{
fprintf(stderr, "\nWARNING: there may be something wrong with energy file %s\n",
gmx_fio_getname(ef->fio));
- fprintf(stderr, "Found: step=%" GMX_PRId64 ", nre=%d, nblock=%d, time=%g.\n",
+ fprintf(stderr, "Found: step=%" PRId64 ", nre=%d, nblock=%d, time=%g.\n",
fr->step, fr->nre, fr->nblock, fr->t);
}
if (bRead && fr->nre > fr->e_alloc)
float* fval;
double* dval;
int* ival;
- gmx_int64_t* lval;
+ int64_t * lval;
unsigned char* cval;
char** sval;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
bFinished = (fgets2(line, STRLEN, fp) == nullptr);
}
while (!bFinished && (line[0] == '#'));
- sscanf(line, "%15" GMX_SCNd64 "%15lf", &(fr->step), &db1);
+ sscanf(line, "%15" SCNd64 "%15lf", &(fr->step), &db1);
fr->time = db1;
}
else
if (fr->bStep || fr->bTime)
{
/* Officially the time format is %15.9, which is not enough for 10 ns */
- fprintf(out, "TIMESTEP\n%15" GMX_PRId64 "%15.6f\nEND\n", fr->step, fr->time);
+ fprintf(out, "TIMESTEP\n%15" PRId64 "%15.6f\nEND\n", fr->step, fr->time);
}
if (fr->bX)
{
float fvec[DIM];
double dvec[DIM];
int j, m, *iptr, idum;
- gmx_int64_t sdum;
+ int64_t sdum;
real *ptr;
unsigned short us;
double d = 0;
case eioINT64:
if (item && !fio->bRead)
{
- sdum = *(gmx_int64_t *) item;
+ sdum = *(int64_t *) item;
}
res = xdr_int64(fio->xdr, &sdum);
if (item)
{
- *(gmx_int64_t *) item = sdum;
+ *(int64_t *) item = sdum;
}
break;
case eioUCHAR:
return ret;
}
-gmx_bool gmx_fio_doe_int64(t_fileio *fio, gmx_int64_t *item,
+gmx_bool gmx_fio_doe_int64(t_fileio *fio, int64_t *item,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret;
-gmx_bool gmx_fio_ndoe_int64(t_fileio *fio, gmx_int64_t *item, int n,
+gmx_bool gmx_fio_ndoe_int64(t_fileio *fio, int64_t *item, int n,
const char *desc, const char *srcfile, int line)
{
gmx_bool ret = TRUE;
gmx_fio_do_int(fio_, *value);
}
-void FileIOXdrSerializer::doInt64(gmx_int64_t *value)
+void FileIOXdrSerializer::doInt64(int64_t *value)
{
gmx_fio_do_int64(fio_, *value);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_doe_int(struct t_fileio *fio, int *item,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_doe_int64(struct t_fileio *fio, gmx_int64_t *item,
+gmx_bool gmx_fio_doe_int64(struct t_fileio *fio, int64_t *item,
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_doe_uchar(struct t_fileio *fio, unsigned char *item,
const char *desc, const char *srcfile, int line);
const char *desc, const char *srcfile, int line);
gmx_bool gmx_fio_ndoe_int(struct t_fileio *fio, int *item, int n,
const char *desc, const char *srcfile, int line);
-gmx_bool gmx_fio_ndoe_int64(struct t_fileio *fio, gmx_int64_t *item, int n,
+gmx_bool gmx_fio_ndoe_int64(struct t_fileio *fio, int64_t *item, int n,
const char *desc, const char *srcfile,
int line);
gmx_bool gmx_fio_ndoe_uchar(struct t_fileio *fio, unsigned char *item, int n,
virtual void doBool(bool *value);
virtual void doUChar(unsigned char *value);
virtual void doInt(int *value);
- virtual void doInt64(gmx_int64_t *value);
+ virtual void doInt64(int64_t *value);
virtual void doFloat(float *value);
virtual void doDouble(double *value);
virtual void doString(std::string *value);
{
p += 5;
fr->step = 0; // Default value if fr-bStep is false
- fr->bStep = (sscanf(p, "%" GMX_SCNd64, &fr->step) == 1);
+ fr->bStep = (sscanf(p, "%" SCNd64, &fr->step) == 1);
}
if (atoms.nr != fr->natoms)
}
/* Note that sanitizing the trailing part of inp[ii].value was the responsibility of read_inpfile() */
-gmx_int64_t get_eint64(std::vector<t_inpfile> *inp,
- const char *name, gmx_int64_t def,
- warninp_t wi)
+int64_t get_eint64(std::vector<t_inpfile> *inp,
+ const char *name, int64_t def,
+ warninp_t wi)
{
std::vector<t_inpfile> &inpRef = *inp;
char buf[32], *ptr, warn_buf[STRLEN];
if (ii == -1)
{
- sprintf(buf, "%" GMX_PRId64, def);
+ sprintf(buf, "%" PRId64, def);
inpRef.back().value_.assign(buf);
return def;
}
else
{
- gmx_int64_t ret = str_to_int64_t(inpRef[ii].value_.c_str(), &ptr);
+ int64_t ret = str_to_int64_t(inpRef[ii].value_.c_str(), &ptr);
if (*ptr != '\0')
{
sprintf(warn_buf, "Right hand side '%s' for parameter '%s' in parameter file is not an integer value\n", inpRef[ii].value_.c_str(), inpRef[ii].name_.c_str());
int get_eint(std::vector<t_inpfile> *inp, const char *name, int def,
warninp_t wi);
-gmx_int64_t get_eint64(std::vector<t_inpfile> *inp,
- const char *name, gmx_int64_t def,
- warninp_t);
+int64_t get_eint64(std::vector<t_inpfile> *inp,
+ const char *name, int64_t def,
+ warninp_t);
double get_ereal(std::vector<t_inpfile> *inp, const char *name, double def,
warninp_t wi);
static void addTngMoleculeFromTopology(gmx_tng_trajectory_t gmx_tng,
const char *moleculeName,
const t_atoms *atoms,
- gmx_int64_t numMolecules,
+ int64_t numMolecules,
tng_molecule_t *tngMol)
{
tng_trajectory_t tng = gmx_tng->tng;
/* Define pointers to specific writing functions depending on if we
* write float or double data */
typedef tng_function_status (*set_writing_interval_func_pointer)(tng_trajectory_t,
- const gmx_int64_t,
- const gmx_int64_t,
- const gmx_int64_t,
+ const int64_t,
+ const int64_t,
+ const int64_t,
const char*,
const char,
const char);
tng_residue_t res;
tng_atom_t atom;
tng_bond_t tngBond;
- gmx_int64_t nMols;
+ int64_t nMols;
char *groupName;
tng_trajectory_t tng = gmx_tng->tng;
tng_molecule_existing_add(tng, &mol);
tng_molecule_cnt_set(tng, mol, 1);
tng_num_molecule_types_get(tng, &nMols);
- for (gmx_int64_t k = 0; k < nMols; k++)
+ for (int64_t k = 0; k < nMols; k++)
{
tng_molecule_of_index_get(tng, k, &iterMol);
if (iterMol == mol)
void gmx_fwrite_tng(gmx_tng_trajectory_t gmx_tng,
const gmx_bool bUseLossyCompression,
- gmx_int64_t step,
+ int64_t step,
real elapsedPicoSeconds,
real lambda,
const rvec *box,
{
#if GMX_USE_TNG
typedef tng_function_status (*write_data_func_pointer)(tng_trajectory_t,
- const gmx_int64_t,
+ const int64_t,
const double,
const real*,
- const gmx_int64_t,
- const gmx_int64_t,
+ const int64_t,
+ const int64_t,
const char*,
const char,
const char);
static write_data_func_pointer write_data = tng_util_generic_with_time_write;
#endif
double elapsedSeconds = elapsedPicoSeconds * PICO;
- gmx_int64_t nParticles;
+ int64_t nParticles;
char compression;
float gmx_tng_get_time_of_final_frame(gmx_tng_trajectory_t gmx_tng)
{
#if GMX_USE_TNG
- gmx_int64_t nFrames;
+ int64_t nFrames;
double time;
float fTime;
tng_trajectory_t tng = gmx_tng->tng;
tng_trajectory_t *input = (gmx_tng_input && *gmx_tng_input) ? &(*gmx_tng_input)->tng : nullptr;
/* FIXME after 5.0: Currently only standard block types are read */
const int defaultNumIds = 5;
- static gmx_int64_t fallbackIds[defaultNumIds] =
+ static int64_t fallbackIds[defaultNumIds] =
{
TNG_TRAJ_BOX_SHAPE, TNG_TRAJ_POSITIONS,
TNG_TRAJ_VELOCITIES, TNG_TRAJ_FORCES,
};
typedef tng_function_status (*set_writing_interval_func_pointer)(tng_trajectory_t,
- const gmx_int64_t,
- const gmx_int64_t,
- const gmx_int64_t,
+ const int64_t,
+ const int64_t,
+ const int64_t,
const char*,
const char,
const char);
* output tng container based on their respective values int
* the input tng container */
double time, compression_precision;
- gmx_int64_t n_frames_per_frame_set, interval = -1;
+ int64_t n_frames_per_frame_set, interval = -1;
tng_compression_precision_get(*input, &compression_precision);
tng_compression_precision_set(*output, compression_precision);
{
for (j = 0; j < nValues; j++)
{
- to[i*nValues+j] = reinterpret_cast<gmx_int64_t *>(from)[i*nValues+j] * fact;
+ to[i*nValues+j] = reinterpret_cast<int64_t *>(from)[i*nValues+j] * fact;
}
}
break;
real getDistanceScaleFactor(gmx_tng_trajectory_t in)
{
- gmx_int64_t exp = -1;
+ int64_t exp = -1;
real distanceScaleFactor;
// TODO Hopefully, TNG 2.0 will do this kind of thing for us
const char *name)
{
#if GMX_USE_TNG
- gmx_int64_t nAtoms, cnt, nMols;
+ int64_t nAtoms, cnt, nMols;
tng_molecule_t mol, iterMol;
tng_chain_t chain;
tng_residue_t res;
* other molecules to 0 */
tng_molecule_cnt_set(tng, mol, 1);
tng_num_molecule_types_get(tng, &nMols);
- for (gmx_int64_t k = 0; k < nMols; k++)
+ for (int64_t k = 0; k < nMols; k++)
{
tng_molecule_of_index_get(tng, k, &iterMol);
if (iterMol == mol)
* and lose no information. */
gmx_bool gmx_read_next_tng_frame(gmx_tng_trajectory_t gmx_tng_input,
t_trxframe *fr,
- gmx_int64_t *requestedIds,
+ int64_t *requestedIds,
int numRequestedIds)
{
#if GMX_USE_TNG
tng_trajectory_t input = gmx_tng_input->tng;
gmx_bool bOK = TRUE;
tng_function_status stat;
- gmx_int64_t numberOfAtoms = -1, frameNumber = -1;
- gmx_int64_t nBlocks, blockId, *blockIds = nullptr, codecId;
+ int64_t numberOfAtoms = -1, frameNumber = -1;
+ int64_t nBlocks, blockId, *blockIds = nullptr, codecId;
char datatype = -1;
void *values = nullptr;
double frameTime = -1.0;
int size, blockDependency;
double prec;
const int defaultNumIds = 5;
- static gmx_int64_t fallbackRequestedIds[defaultNumIds] =
+ static int64_t fallbackRequestedIds[defaultNumIds] =
{
TNG_TRAJ_BOX_SHAPE, TNG_TRAJ_POSITIONS,
TNG_TRAJ_VELOCITIES, TNG_TRAJ_FORCES,
&frameNumber,
&nBlocks,
&blockIds);
- gmx::unique_cptr<gmx_int64_t, gmx::free_wrapper> blockIdsGuard(blockIds);
+ gmx::unique_cptr<int64_t, gmx::free_wrapper> blockIdsGuard(blockIds);
if (!nextFrameExists)
{
return FALSE;
return FALSE;
}
- for (gmx_int64_t i = 0; i < nBlocks; i++)
+ for (int64_t i = 0; i < nBlocks; i++)
{
blockId = blockIds[i];
tng_data_block_dependency_get(input, blockId, &blockDependency);
switch (datatype)
{
case TNG_INT_DATA:
- size = sizeof(gmx_int64_t);
+ size = sizeof(int64_t);
break;
case TNG_FLOAT_DATA:
size = sizeof(float);
FILE *stream)
{
#if GMX_USE_TNG
- gmx_int64_t nMolecules, nChains, nResidues, nAtoms, nFramesRead;
- gmx_int64_t strideLength, nParticlesRead, nValuesPerFrameRead, *molCntList;
+ int64_t nMolecules, nChains, nResidues, nAtoms, nFramesRead;
+ int64_t strideLength, nParticlesRead, nValuesPerFrameRead, *molCntList;
tng_molecule_t molecule;
tng_chain_t chain;
tng_residue_t residue;
/* Can the number of particles change in the trajectory or is it constant? */
tng_num_particles_variable_get(input, &varNAtoms);
- for (gmx_int64_t i = 0; i < nMolecules; i++)
+ for (int64_t i = 0; i < nMolecules; i++)
{
tng_molecule_of_index_get(input, i, &molecule);
tng_molecule_name_get(input, molecule, str, 256);
tng_molecule_num_chains_get(input, molecule, &nChains);
if (nChains > 0)
{
- for (gmx_int64_t j = 0; j < nChains; j++)
+ for (int64_t j = 0; j < nChains; j++)
{
tng_molecule_chain_of_index_get(input, molecule, j, &chain);
tng_chain_name_get(input, chain, str, 256);
fprintf(stream, "\tChain: %s\n", str);
tng_chain_num_residues_get(input, chain, &nResidues);
- for (gmx_int64_t k = 0; k < nResidues; k++)
+ for (int64_t k = 0; k < nResidues; k++)
{
tng_chain_residue_of_index_get(input, chain, k, &residue);
tng_residue_name_get(input, residue, str, 256);
fprintf(stream, "\t\tResidue: %s\n", str);
tng_residue_num_atoms_get(input, residue, &nAtoms);
- for (gmx_int64_t l = 0; l < nAtoms; l++)
+ for (int64_t l = 0; l < nAtoms; l++)
{
tng_residue_atom_of_index_get(input, residue, l, &atom);
tng_atom_name_get(input, atom, str, 256);
tng_molecule_num_residues_get(input, molecule, &nResidues);
if (nResidues > 0)
{
- for (gmx_int64_t k = 0; k < nResidues; k++)
+ for (int64_t k = 0; k < nResidues; k++)
{
tng_molecule_residue_of_index_get(input, molecule, k, &residue);
tng_residue_name_get(input, residue, str, 256);
fprintf(stream, "\t\tResidue: %s\n", str);
tng_residue_num_atoms_get(input, residue, &nAtoms);
- for (gmx_int64_t l = 0; l < nAtoms; l++)
+ for (int64_t l = 0; l < nAtoms; l++)
{
tng_residue_atom_of_index_get(input, residue, l, &atom);
tng_atom_name_get(input, atom, str, 256);
else
{
tng_molecule_num_atoms_get(input, molecule, &nAtoms);
- for (gmx_int64_t l = 0; l < nAtoms; l++)
+ for (int64_t l = 0; l < nAtoms; l++)
{
tng_molecule_atom_of_index_get(input, molecule, l, &atom);
tng_atom_name_get(input, atom, str, 256);
datatype);
fprintf(stream, "Atom Charges (%d):\n", int(nAtoms));
- for (gmx_int64_t i = 0; i < nAtoms; i += 10)
+ for (int64_t i = 0; i < nAtoms; i += 10)
{
fprintf(stream, "Atom Charges [%8d-]=[", int(i));
- for (gmx_int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
+ for (int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
{
fprintf(stream, " %12.5e", atomCharges[i + j]);
}
datatype);
fprintf(stream, "Atom Masses (%d):\n", int(nAtoms));
- for (gmx_int64_t i = 0; i < nAtoms; i += 10)
+ for (int64_t i = 0; i < nAtoms; i += 10)
{
fprintf(stream, "Atom Masses [%8d-]=[", int(i));
- for (gmx_int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
+ for (int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
{
fprintf(stream, " %12.5e", atomMasses[i + j]);
}
gmx_bool gmx_get_tng_data_block_types_of_next_frame(gmx_tng_trajectory_t gmx_tng_input,
int frame,
int nRequestedIds,
- gmx_int64_t *requestedIds,
- gmx_int64_t *nextFrame,
- gmx_int64_t *nBlocks,
- gmx_int64_t **blockIds)
+ int64_t *requestedIds,
+ int64_t *nextFrame,
+ int64_t *nBlocks,
+ int64_t **blockIds)
{
#if GMX_USE_TNG
tng_function_status stat;
}
gmx_bool gmx_get_tng_data_next_frame_of_block_type(gmx_tng_trajectory_t gmx_tng_input,
- gmx_int64_t blockId,
+ int64_t blockId,
real **values,
- gmx_int64_t *frameNumber,
+ int64_t *frameNumber,
double *frameTime,
- gmx_int64_t *nValuesPerFrame,
- gmx_int64_t *nAtoms,
+ int64_t *nValuesPerFrame,
+ int64_t *nAtoms,
real *prec,
char *name,
int maxLen,
#if GMX_USE_TNG
tng_function_status stat;
char datatype = -1;
- gmx_int64_t codecId;
+ int64_t codecId;
int blockDependency;
void *data = nullptr;
double localPrec;
* (that component). box can only be NULL if x is also NULL. */
void gmx_fwrite_tng(gmx_tng_trajectory_t tng,
const gmx_bool bUseLossyCompression,
- gmx_int64_t step,
+ int64_t step,
real elapsedPicoSeconds,
real lambda,
const rvec *box,
/*! \brief Read the first/next TNG frame. */
gmx_bool gmx_read_next_tng_frame(gmx_tng_trajectory_t input,
struct t_trxframe *fr,
- gmx_int64_t *requestedIds,
+ int64_t *requestedIds,
int numRequestedIds);
/*! \brief Print the molecule system to stream */
gmx_bool gmx_get_tng_data_block_types_of_next_frame(gmx_tng_trajectory_t input,
int frame,
int nRequestedIds,
- gmx_int64_t *requestedIds,
- gmx_int64_t *nextFrame,
- gmx_int64_t *nBlocks,
- gmx_int64_t **blockIds);
+ int64_t *requestedIds,
+ int64_t *nextFrame,
+ int64_t *nBlocks,
+ int64_t **blockIds);
/*! \brief Get data of the next frame with data from the data block
* with the specified block ID. */
gmx_bool gmx_get_tng_data_next_frame_of_block_type(gmx_tng_trajectory_t input,
- gmx_int64_t blockId,
+ int64_t blockId,
real **values,
- gmx_int64_t *frameNumber,
+ int64_t *frameNumber,
double *frameTime,
- gmx_int64_t *nValuesPerFrame,
- gmx_int64_t *nAtoms,
+ int64_t *nValuesPerFrame,
+ int64_t *nAtoms,
real *prec,
char *name,
int maxLen,
*/
enum tpxv {
tpxv_ComputationalElectrophysiology = 96, /**< support for ion/water position swaps (computational electrophysiology) */
- tpxv_Use64BitRandomSeed, /**< change ld_seed from int to gmx_int64_t */
+ tpxv_Use64BitRandomSeed, /**< change ld_seed from int to int64_t */
tpxv_RestrictedBendingAndCombinedAngleTorsionPotentials, /**< potentials for supporting coarse-grained force fields */
tpxv_InteractiveMolecularDynamics, /**< interactive molecular dynamics (IMD) */
tpxv_RemoveObsoleteParameters1, /**< remove optimize_fft, dihre_fc, nstcheckpoint */
}
static gmx_bool
-do_trr_frame(t_fileio *fio, bool bRead, gmx_int64_t *step, real *t, real *lambda,
+do_trr_frame(t_fileio *fio, bool bRead, int64_t *step, real *t, real *lambda,
rvec *box, int *natoms, rvec *x, rvec *v, rvec *f)
{
gmx_trr_header_t *sh;
return do_trr_frame_header(fio, true, header, bOK);
}
-void gmx_trr_write_single_frame(const char *fn, gmx_int64_t step, real t, real lambda,
+void gmx_trr_write_single_frame(const char *fn, int64_t step, real t, real lambda,
const rvec *box, int natoms, const rvec *x, const rvec *v, const rvec *f)
{
t_fileio *fio = gmx_trr_open(fn, "w");
gmx_trr_close(fio);
}
-void gmx_trr_read_single_frame(const char *fn, gmx_int64_t *step, real *t, real *lambda,
+void gmx_trr_read_single_frame(const char *fn, int64_t *step, real *t, real *lambda,
rvec *box, int *natoms, rvec *x, rvec *v, rvec *f)
{
t_fileio *fio = gmx_trr_open(fn, "r");
gmx_trr_close(fio);
}
-void gmx_trr_write_frame(t_fileio *fio, gmx_int64_t step, real t, real lambda,
+void gmx_trr_write_frame(t_fileio *fio, int64_t step, real t, real lambda,
const rvec *box, int natoms, const rvec *x, const rvec *v, const rvec *f)
{
if (!do_trr_frame(fio, false, &step, &t, &lambda, const_cast<rvec *>(box), &natoms, const_cast<rvec *>(x), const_cast<rvec *>(v), const_cast<rvec *>(f)))
}
-gmx_bool gmx_trr_read_frame(t_fileio *fio, gmx_int64_t *step, real *t, real *lambda,
+gmx_bool gmx_trr_read_frame(t_fileio *fio, int64_t *step, real *t, real *lambda,
rvec *box, int *natoms, rvec *x, rvec *v, rvec *f)
{
return do_trr_frame(fio, true, step, t, lambda, box, natoms, x, v, f);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* fix the fact that after 2^31 frames, step numbers will wrap to be
* negative. Fortunately, this tends not to cause serious problems,
* and we've fixed it in TNG. Meanwhile, the implementation pretends
- * to the rest of GROMACS that it functions with gmx_int64_t like all
+ * to the rest of GROMACS that it functions with int64_t like all
* other step numbers, but the actual range in practice depends on the
* defaults of the implementation in use now (or when the file was
* written).
int f_size; /* Non zero if forces are present */
int natoms; /* The total number of atoms */
- gmx_int64_t step; /* Current step number */
+ int64_t step; /* Current step number */
int nre; /* Backward compatibility */
real t; /* Current time */
real lambda; /* Current value of lambda */
* Return FALSE on error
*/
-gmx_bool gmx_trr_read_frame(struct t_fileio *fio, gmx_int64_t *step, real *t, real *lambda,
+gmx_bool gmx_trr_read_frame(struct t_fileio *fio, int64_t *step, real *t, real *lambda,
rvec *box, int *natoms, rvec *x, rvec *v, rvec *f);
/* Read a trr frame, including the header from fp. box, x, v, f may
* be NULL, in which case the data will be skipped over.
* return FALSE on error
*/
-void gmx_trr_write_frame(struct t_fileio *fio, gmx_int64_t step, real t, real lambda,
+void gmx_trr_write_frame(struct t_fileio *fio, int64_t step, real t, real lambda,
const rvec *box, int natoms, const rvec *x, const rvec *v, const rvec *f);
/* Write a trr frame to file fp, box, x, v, f may be NULL */
/* Read the header of a trr file from fn, and close the file afterwards.
*/
-void gmx_trr_read_single_frame(const char *fn, gmx_int64_t *step, real *t, real *lambda,
+void gmx_trr_read_single_frame(const char *fn, int64_t *step, real *t, real *lambda,
rvec *box, int *natoms, rvec *x, rvec *v, rvec *f);
/* Read a single trr frame from file fn, which is closed afterwards
*/
-void gmx_trr_write_single_frame(const char *fn, gmx_int64_t step, real t, real lambda,
+void gmx_trr_write_single_frame(const char *fn, int64_t step, real t, real lambda,
const rvec *box, int natoms, const rvec *x, const rvec *v, const rvec *f);
/* Write a single trr frame to file fn, which is closed afterwards */
fr->step = 0;
step = std::strstr(title, " step= ");
- fr->bStep = (step && sscanf(step+7, "%" GMX_SCNd64, &fr->step) == 1);
+ fr->bStep = (step && sscanf(step+7, "%" SCNd64, &fr->step) == 1);
dbl = 0.0;
time = std::strstr(title, " t= ");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#endif
}
-int xdr_int64(XDR *xdrs, gmx_int64_t *i)
+int xdr_int64(XDR *xdrs, int64_t *i)
{
/* This routine stores values compatible with xdr_int64_t */
- int imaj, imin;
- int ret;
+ int imaj, imin;
+ int ret;
- static const gmx_int64_t two_p32_m1 = 0xFFFFFFFF;
- gmx_int64_t imaj64, imin64;
+ static const int64_t two_p32_m1 = 0xFFFFFFFF;
+ int64_t imaj64, imin64;
imaj64 = ((*i)>>32) & two_p32_m1;
imin64 = (*i) & two_p32_m1;
ret = xdr_int(xdrs, &imaj);
ret |= xdr_int(xdrs, &imin);
- *i = ((static_cast<gmx_int64_t>(imaj) << 32) | (static_cast<gmx_int64_t>(imin) & two_p32_m1));
+ *i = ((static_cast<int64_t>(imaj) << 32) | (static_cast<int64_t>(imin) & two_p32_m1));
return ret;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int xdr3drcoord(XDR *xdrs, real *fp, int *size, real *precision);
-int xdr_int64(XDR *xdrs, gmx_int64_t *i);
-/* Read or write a gmx_int64_t value.
+int xdr_int64(XDR *xdrs, int64_t *i);
+/* Read or write a int64_t value.
* When warn!=NULL a warning will be written to stderr
* when a value does not fit,
* the first line is:
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#define XTC_CHECK(s, b) xtc_check(s, b, __FILE__, __LINE__)
-static int xtc_header(XDR *xd, int *magic, int *natoms, gmx_int64_t *step, real *time,
+static int xtc_header(XDR *xd, int *magic, int *natoms, int64_t *step, real *time,
gmx_bool bRead, gmx_bool *bOK)
{
int result;
int write_xtc(t_fileio *fio,
- int natoms, gmx_int64_t step, real time,
+ int natoms, int64_t step, real time,
const rvec *box, const rvec *x, real prec)
{
int magic_number = XTC_MAGIC;
return bOK; /* 0 if bad, 1 if writing went well */
}
-int read_first_xtc(t_fileio *fio, int *natoms, gmx_int64_t *step, real *time,
+int read_first_xtc(t_fileio *fio, int *natoms, int64_t *step, real *time,
matrix box, rvec **x, real *prec, gmx_bool *bOK)
{
int magic;
}
int read_next_xtc(t_fileio* fio,
- int natoms, gmx_int64_t *step, real *time,
+ int natoms, int64_t *step, real *time,
matrix box, rvec *x, real *prec, gmx_bool *bOK)
{
int magic;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Close the file for xdr I/O */
int read_first_xtc(struct t_fileio *fio,
- int *natoms, gmx_int64_t *step, real *time,
+ int *natoms, int64_t *step, real *time,
matrix box, rvec **x, real *prec, gmx_bool *bOK);
/* Open xtc file, read xtc file first time, allocate memory for x */
int read_next_xtc(struct t_fileio *fio,
- int natoms, gmx_int64_t *step, real *time,
+ int natoms, int64_t *step, real *time,
matrix box, rvec *x, real *prec, gmx_bool *bOK);
/* Read subsequent frames */
int write_xtc(struct t_fileio *fio,
- int natoms, gmx_int64_t step, real time,
+ int natoms, int64_t step, real time,
const rvec *box, const rvec *x, real prec);
/* Write a frame to xtc file */
int i, s;
double minval, maxval;
int nbin;
- gmx_int64_t *histo;
+ int64_t *histo;
minval = val[0][0];
maxval = val[0][0];
unsigned int *bin[2]; /* the (forward + reverse) histogram values */
double dx[2]; /* the histogram spacing. The reverse
dx is the negative of the forward dx.*/
- gmx_int64_t x0[2]; /* the (forward + reverse) histogram start
- point(s) as int */
+ int64_t x0[2]; /* the (forward + reverse) histogram start
+ point(s) as int */
int nbin[2]; /* the (forward+reverse) number of bins */
- gmx_int64_t sum; /* the total number of counts. Must be
- the same for forward + reverse. */
+ int64_t sum; /* the total number of counts. Must be
+ the same for forward + reverse. */
int nhist; /* number of hist datas (forward or reverse) */
double start_time, delta_time; /* start time, end time of histogram */
size_t ndu_alloc, nt_alloc; /* pre-allocated sizes */
hist_t *hist_alloc; /* allocated hist */
- gmx_int64_t ntot; /* total number of samples */
+ int64_t ntot; /* total number of samples */
const char *filename; /* the file name this sample comes from */
} samples_t;
sample_range_t *r; /* the sample ranges */
int nsamples_alloc; /* number of allocated samples */
- gmx_int64_t ntot; /* total number of samples in the ranges of
- this collection */
+ int64_t ntot; /* total number of samples in the ranges of
+ this collection */
struct sample_coll_t *next, *prev; /* next and previous in the list */
} sample_coll_t;
{
int j;
- gmx_int64_t ntot_start;
- gmx_int64_t ntot_end;
- gmx_int64_t ntot_so_far;
+ int64_t ntot_start;
+ int64_t ntot_end;
+ int64_t ntot_so_far;
*sc = *sc_orig; /* just copy all fields */
/* now fix start and end fields */
/* the casts avoid possible overflows */
- ntot_start = static_cast<gmx_int64_t>(sc_orig->ntot*static_cast<double>(i)/static_cast<double>(ni));
- ntot_end = static_cast<gmx_int64_t>(sc_orig->ntot*static_cast<double>(i+1)/static_cast<double>(ni));
+ ntot_start = static_cast<int64_t>(sc_orig->ntot*static_cast<double>(i)/static_cast<double>(ni));
+ ntot_end = static_cast<int64_t>(sc_orig->ntot*static_cast<double>(i+1)/static_cast<double>(ni));
ntot_so_far = 0;
for (j = 0; j < sc->nsamples; j++)
{
- gmx_int64_t ntot_add;
- gmx_int64_t new_start, new_end;
+ int64_t ntot_add;
+ int64_t new_start, new_end;
if (sc->r[j].use)
{
for (i = 0; i < nhist; i++)
{
- gmx_int64_t sum = 0;
+ int64_t sum = 0;
for (j = 0; j < s->hist->nbin[i]; j++)
{
FILE *fp, *log;
int nf = 0, i, i1, i2, j;
- gmx_int64_t nrms = 0;
+ int64_t nrms = 0;
matrix box;
rvec *xtps, *usextps, *x1, **xx = nullptr;
else /* !bReadMat */
{
rms = init_mat(nf, method == m_diagonalize);
- nrms = (static_cast<gmx_int64_t>(nf)*static_cast<gmx_int64_t>(nf-1))/2;
+ nrms = (static_cast<int64_t>(nf)*static_cast<int64_t>(nf-1))/2;
if (!bRMSdist)
{
fprintf(stderr, "Computing %dx%d RMS deviation matrix\n", nf, nf);
set_mat_entry(rms, i1, i2, rmsd);
}
nrms -= nf-i1-1;
- fprintf(stderr, "\r# RMSD calculations left: " "%" GMX_PRId64 " ", nrms);
+ fprintf(stderr, "\r# RMSD calculations left: " "%" PRId64 " ", nrms);
fflush(stderr);
}
sfree(x1);
set_mat_entry(rms, i1, i2, rms_dist(isize, d1, d2));
}
nrms -= nf-i1-1;
- fprintf(stderr, "\r# RMSD calculations left: " "%" GMX_PRId64 " ", nrms);
+ fprintf(stderr, "\r# RMSD calculations left: " "%" PRId64 " ", nrms);
fflush(stderr);
}
/* Clean up work arrays */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
real xj, *w_rls = nullptr;
real min, max, *axis;
int natoms, nat, nframes0, nframes, nlevels;
- gmx_int64_t ndim, i, j, k, l;
+ int64_t ndim, i, j, k, l;
int WriteXref;
const char *fitfile, *trxfile, *ndxfile;
const char *eigvalfile, *eigvecfile, *averfile, *logfile;
snew(x, natoms);
snew(xav, natoms);
ndim = natoms*DIM;
- if (std::sqrt(static_cast<real>(GMX_INT64_MAX)) < static_cast<real>(ndim))
+ if (std::sqrt(static_cast<real>(INT64_MAX)) < static_cast<real>(ndim))
{
gmx_fatal(FARGS, "Number of degrees of freedoms to large for matrix.\n");
}
static void update_ee_sum(int nre,
- gmx_int64_t *ee_sum_step,
- gmx_int64_t *ee_sum_nsteps,
- gmx_int64_t *ee_sum_nsum,
+ int64_t *ee_sum_step,
+ int64_t *ee_sum_nsteps,
+ int64_t *ee_sum_nsum,
t_energy *ee_sum,
t_enxframe *fr, int out_step)
{
- gmx_int64_t nsteps, nsum, fr_nsum;
+ int64_t nsteps, nsum, fr_nsum;
int i;
nsteps = *ee_sum_nsteps;
gmx_enxnm_t *enm = NULL;
#endif
t_enxframe *fr, *fro;
- gmx_int64_t ee_sum_step = 0, ee_sum_nsteps, ee_sum_nsum;
+ int64_t ee_sum_step = 0, ee_sum_nsteps, ee_sum_nsum;
t_energy *ee_sum;
- gmx_int64_t lastfilestep, laststep, startstep_file = 0;
+ int64_t lastfilestep, laststep, startstep_file = 0;
int noutfr;
int nre, nremax, this_nre, i, kkk, nset, *set = nullptr;
double last_t;
}
else
{
- fro->nsum = gmx_int64_to_int(ee_sum_nsum,
- "energy average summation");
+ fro->nsum = int64_to_int(ee_sum_nsum,
+ "energy average summation");
/* Copy the energy sums */
for (i = 0; i < nre; i++)
{
} enerdat_t;
typedef struct {
- gmx_int64_t nsteps;
- gmx_int64_t npoints;
+ int64_t nsteps;
+ int64_t npoints;
int nframes;
int *step;
int *steps;
}
typedef struct {
- gmx_int64_t np;
+ int64_t np;
double sum;
double sav;
double sav2;
typedef struct {
int b;
ee_sum_t sum;
- gmx_int64_t nst;
- gmx_int64_t nst_min;
+ int64_t nst;
+ int64_t nst_min;
} ener_ee_t;
static void clear_ee_sum(ee_sum_t *ees)
{
int nb, i, f, nee;
double sum, sum2, sump, see2;
- gmx_int64_t np, p, bound_nb;
+ int64_t np, p, bound_nb;
enerdat_t *ed;
exactsum_t *es;
gmx_bool bAllZero;
const char *eviscofn, const char *eviscoifn,
gmx_bool bFee, gmx_bool bSum, gmx_bool bFluct,
gmx_bool bVisco, const char *visfn, int nmol,
- gmx_int64_t start_step, double start_t,
- gmx_int64_t step, double t,
+ int64_t start_step, double start_t,
+ int64_t step, double t,
real reftemp,
enerdata_t *edat,
int nset, const int set[], const gmx_bool *bIsEner,
real integral, intBulk, Temp = 0, Pres = 0;
real pr_aver, pr_stddev, pr_errest;
double beta = 0, expE, expEtot, *fee = nullptr;
- gmx_int64_t nsteps;
+ int64_t nsteps;
int nexact, nnotexact;
int i, j, nout;
char buf[256], eebuf[100];
/* write the data */
if (nblock_hist > 0)
{
- gmx_int64_t sum = 0;
+ int64_t sum = 0;
/* histograms */
for (i = 0; i < fr->nblock; i++)
{
if (blk->id == enxDHHIST)
{
double foreign_lambda, dx;
- gmx_int64_t x0;
+ int64_t x0;
int nhist, derivative;
/* check the block types etc. */
int cur = 0;
#define NEXT (1-cur)
int nre, nfr;
- gmx_int64_t start_step;
+ int64_t start_step;
real start_t;
gmx_bool bDHDL;
gmx_bool bFoundStart, bCont, bVisco;
int i, ei, nw;
real rmin2;
rvec dx;
- gmx_int64_t maxrand;
+ int64_t maxrand;
gmx::UniformIntDistribution<int> dist(0, *nwater-1);
nw = *nwater;
typedef struct
{
- gmx_int64_t orig_sim_steps; /* Number of steps to be done in the real simulation */
+ int64_t orig_sim_steps; /* Number of steps to be done in the real simulation */
int n_entries; /* Number of entries in arrays */
real volume; /* The volume of the box */
matrix recipbox; /* The reciprocal box */
return (ibox[2]*(ibox[1]*x+y)+z);
}
-static gmx_int64_t indexn(int ndim, const int *ibox, const int *nxyz)
+static int64_t indexn(int ndim, const int *ibox, const int *nxyz)
{
- gmx_int64_t d, dd;
+ int64_t d, dd;
int k, kk;
/* Compute index in 1-D array */
}
typedef struct {
- gmx_int64_t index;
+ int64_t index;
real ener;
} t_minimum;
void print_minimum(FILE *fp, int num, const t_minimum *min)
{
fprintf(fp,
- "Minimum %d at index " "%" GMX_PRId64 " energy %10.3f\n",
+ "Minimum %d at index " "%" PRId64 " energy %10.3f\n",
num, min->index, min->ener);
}
real *rmin, *rmax;
const char *fn_ge, *fn_ene;
gmx_output_env_t *oenv;
- gmx_int64_t num_grid_points;
+ int64_t num_grid_points;
t_filenm fnm[] = {
{ efXVG, "-f", "graph", ffREAD },
num_grid_points = ibox[0];
for (i = 1; i < nset; i++)
{
- gmx_int64_t result;
+ int64_t result;
if (!check_int_multiply_for_overflow(num_grid_points, ibox[i], &result))
{
gmx_fatal(FARGS,
}
num_grid_points = result;
}
- /* The number of grid points fits in a gmx_int64_t. */
+ /* The number of grid points fits in a int64_t. */
do_sham(opt2fn("-dist", NFILE, fnm), opt2fn("-bin", NFILE, fnm),
opt2fn("-lp", NFILE, fnm),
}
if (frout.bStep)
{
- sprintf(stepstr, " step= %" GMX_PRId64, frout.step);
+ sprintf(stepstr, " step= %" PRId64, frout.step);
}
else
{
typedef struct
{
int nr_inputfiles; /* The number of tpr and mdp input files */
- gmx_int64_t orig_sim_steps; /* Number of steps to be done in the real simulation */
- gmx_int64_t orig_init_step; /* Init step for the real simulation */
+ int64_t orig_sim_steps; /* Number of steps to be done in the real simulation */
+ int64_t orig_init_step; /* Init step for the real simulation */
real *rcoulomb; /* The coulomb radii [0...nr_inputfiles] */
real *rvdw; /* The vdW radii */
real *rlist; /* Neighbourlist cutoff radius */
};
static int parse_logfile(const char *logfile, const char *errfile,
- t_perf *perfdata, int test_nr, int presteps, gmx_int64_t cpt_steps,
+ t_perf *perfdata, int test_nr, int presteps, int64_t cpt_steps,
int nnodes)
{
FILE *fp;
float dum1, dum2, dum3, dum4;
int ndum;
int npme;
- gmx_int64_t resetsteps = -1;
+ int64_t resetsteps = -1;
gmx_bool bFoundResetStr = FALSE;
gmx_bool bResetChecked = FALSE;
{
if (std::strstr(line, matchstrcr) != nullptr)
{
- sprintf(dumstring, "step %s", "%" GMX_SCNd64);
+ sprintf(dumstring, "step %s", "%" SCNd64);
sscanf(line, dumstring, &resetsteps);
bFoundResetStr = TRUE;
if (resetsteps == presteps+cpt_steps)
}
else
{
- sprintf(dumstring, "%" GMX_PRId64, resetsteps);
- sprintf(dumstring2, "%" GMX_PRId64, presteps+cpt_steps);
+ sprintf(dumstring, "%" PRId64, resetsteps);
+ sprintf(dumstring2, "%" PRId64, presteps+cpt_steps);
fprintf(stderr, "WARNING: Time step counters were reset at step %s,\n"
" though they were supposed to be reset at step %s!\n",
dumstring, dumstring2);
static void modify_PMEsettings(
- gmx_int64_t simsteps, /* Set this value as number of time steps */
- gmx_int64_t init_step, /* Set this value as init_step */
+ int64_t simsteps, /* Set this value as number of time steps */
+ int64_t init_step, /* Set this value as init_step */
const char *fn_best_tpr, /* tpr file with the best performance */
const char *fn_sim_tpr) /* name of tpr file to be launched */
{
ir->init_step = init_step;
/* Write the tpr file which will be launched */
- sprintf(buf, "Writing optimized simulation file %s with nsteps=%s.\n", fn_sim_tpr, "%" GMX_PRId64);
+ sprintf(buf, "Writing optimized simulation file %s with nsteps=%s.\n", fn_sim_tpr, "%" PRId64);
fprintf(stdout, buf, ir->nsteps);
fflush(stdout);
write_tpx_state(fn_sim_tpr, ir, &state, &mtop);
static void make_benchmark_tprs(
const char *fn_sim_tpr, /* READ : User-provided tpr file */
char *fn_bench_tprs[], /* WRITE: Names of benchmark tpr files */
- gmx_int64_t benchsteps, /* Number of time steps for benchmark runs */
- gmx_int64_t statesteps, /* Step counter in checkpoint file */
+ int64_t benchsteps, /* Number of time steps for benchmark runs */
+ int64_t statesteps, /* Step counter in checkpoint file */
real rmin, /* Minimal Coulomb radius */
real rmax, /* Maximal Coulomb radius */
real bScaleRvdw, /* Scale rvdw along with rcoulomb */
sprintf(buf, "Making benchmark tpr file%s with %s time step%s",
- *ntprs > 1 ? "s" : "", "%" GMX_PRId64, benchsteps > 1 ? "s" : "");
+ *ntprs > 1 ? "s" : "", "%" PRId64, benchsteps > 1 ? "s" : "");
fprintf(stdout, buf, benchsteps);
if (statesteps > 0)
{
- sprintf(buf, " (adding %s steps from checkpoint file)", "%" GMX_PRId64);
+ sprintf(buf, " (adding %s steps from checkpoint file)", "%" PRId64);
fprintf(stdout, buf, statesteps);
benchsteps += statesteps;
}
sprintf(buf, "_bench%.2d.tpr", j);
std::strcat(fn_bench_tprs[j], buf);
fprintf(stdout, "Writing benchmark tpr %s with nsteps=", fn_bench_tprs[j]);
- fprintf(stdout, "%" GMX_PRId64, ir->nsteps);
+ fprintf(stdout, "%" PRId64, ir->nsteps);
if (j > 0)
{
fprintf(stdout, ", scaling factor %f\n", fac);
const t_filenm *fnm, /* List of filenames from command line */
int nfile, /* Number of files specified on the cmdl. */
int presteps, /* DLB equilibration steps, is checked */
- gmx_int64_t cpt_steps, /* Time step counter in the checkpoint */
+ int64_t cpt_steps, /* Time step counter in the checkpoint */
gmx_bool bCheck, /* Check whether benchmark mdrun works */
const char *eligible_gpu_ids) /* GPU IDs for
* constructing mdrun command lines */
real maxPMEfraction,
real minPMEfraction,
int npme_fixed,
- gmx_int64_t bench_nsteps,
+ int64_t bench_nsteps,
const t_filenm *fnm,
int nfile,
int sim_part,
if (bench_nsteps > 10000 || bench_nsteps < 100)
{
fprintf(stderr, "WARNING: steps=");
- fprintf(stderr, "%" GMX_PRId64, bench_nsteps);
+ fprintf(stderr, "%" PRId64, bench_nsteps);
fprintf(stderr, ". Are you sure you want to perform so %s steps for each benchmark?\n", (bench_nsteps < 100) ? "few" : "many");
}
real rmin = 0.0, rmax = 0.0; /* min and max value for rcoulomb if scaling is requested */
real rcoulomb = -1.0; /* Coulomb radius as set in .tpr file */
gmx_bool bScaleRvdw = TRUE;
- gmx_int64_t bench_nsteps = BENCHSTEPS;
- gmx_int64_t new_sim_nsteps = -1; /* -1 indicates: not set by the user */
- gmx_int64_t cpt_steps = 0; /* Step counter in .cpt input file */
+ int64_t bench_nsteps = BENCHSTEPS;
+ int64_t new_sim_nsteps = -1; /* -1 indicates: not set by the user */
+ int64_t cpt_steps = 0; /* Step counter in .cpt input file */
int presteps = 1500; /* Do a full cycle reset after presteps steps */
gmx_bool bOverwrite = FALSE, bKeepTPR;
gmx_bool bLaunch = FALSE;
fprintf(fp, "The mdrun command is : %s\n", cmd_mdrun);
fprintf(fp, "mdrun args benchmarks : %s\n", cmd_args_bench);
fprintf(fp, "Benchmark steps : ");
- fprintf(fp, "%" GMX_PRId64, bench_nsteps);
+ fprintf(fp, "%" PRId64, bench_nsteps);
fprintf(fp, "\n");
fprintf(fp, "dlb equilibration steps : %d\n", presteps);
if (sim_part > 1)
{
fprintf(fp, "Checkpoint time step : ");
- fprintf(fp, "%" GMX_PRId64, cpt_steps);
+ fprintf(fp, "%" PRId64, cpt_steps);
fprintf(fp, "\n");
}
fprintf(fp, "mdrun args at launchtime: %s\n", cmd_args_launch);
{
bOverwrite = TRUE;
fprintf(stderr, "Note: Simulation input file %s will have ", opt2fn("-so", NFILE, fnm));
- fprintf(stderr, "%" GMX_PRId64, new_sim_nsteps+cpt_steps);
+ fprintf(stderr, "%" PRId64, new_sim_nsteps+cpt_steps);
fprintf(stderr, " steps.\n");
fprintf(fp, "Simulation steps : ");
- fprintf(fp, "%" GMX_PRId64, new_sim_nsteps);
+ fprintf(fp, "%" PRId64, new_sim_nsteps);
fprintf(fp, "\n");
}
if (repeats > 1)
sscanf(ptr, fmtlf, &time); /* printf("Time %f\n",time); */
/* Round time to fs */
- time = 1.0/1000*( static_cast<gmx_int64_t> (time*1000+0.5) );
+ time = 1.0/1000*( static_cast<int64_t> (time*1000+0.5) );
/* get time step of pdo file */
if (count == 0)
for (i = 0; i < nt; i++)
{
/* Do you want that time frame? */
- t = 1.0/1000*( static_cast<gmx_int64_t> ((y[0][i]*1000) + 0.5)); /* round time to fs */
+ t = 1.0/1000*( static_cast<int64_t> ((y[0][i]*1000) + 0.5)); /* round time to fs */
/* get time step of pdo file and get dstep from opt->dt */
if (i == 0)
int nthreads;
gmx::DefaultRandomEngine *trng = nullptr;
#endif
- gmx_int64_t mc = 0, mc_max;
+ int64_t mc = 0, mc_max;
gmx::DefaultRandomEngine rng(seed);
/* allocate memory for pr */
/* Special case for setting automaticaly number of mc iterations to 1% of total number of direct iterations */
if (mcover == -1)
{
- mc_max = static_cast<gmx_int64_t>(std::floor(0.5*0.01*isize*(isize-1)));
+ mc_max = static_cast<int64_t>(std::floor(0.5*0.01*isize*(isize-1)));
}
else
{
- mc_max = static_cast<gmx_int64_t>(std::floor(0.5*mcover*isize*(isize-1)));
+ mc_max = static_cast<int64_t>(std::floor(0.5*mcover*isize*(isize-1)));
}
#if GMX_OPENMP
nthreads = gmx_omp_get_max_threads();
#endif
}
-void gmx_sumli(int gmx_unused nr, gmx_int64_t gmx_unused r[], const t_commrec gmx_unused *cr)
+void gmx_sumli(int gmx_unused nr, int64_t gmx_unused r[], const t_commrec gmx_unused *cr)
{
#if !GMX_MPI
gmx_call("gmx_sumli");
#endif
}
-void gmx_sumli_sim(int gmx_unused nr, gmx_int64_t gmx_unused r[], const gmx_multisim_t gmx_unused *ms)
+void gmx_sumli_sim(int gmx_unused nr, int64_t gmx_unused r[], const gmx_multisim_t gmx_unused *ms)
{
#if !GMX_MPI
gmx_call("gmx_sumli_sim");
void gmx_sumi(int nr, int r[], const struct t_commrec *cr);
/* Calculate the global sum of an array of ints */
-void gmx_sumli(int nr, gmx_int64_t r[], const struct t_commrec *cr);
+void gmx_sumli(int nr, int64_t r[], const struct t_commrec *cr);
/* Calculate the global sum of an array of large ints */
void gmx_sumf(int nr, float r[], const struct t_commrec *cr);
void gmx_sumi_sim(int nr, int r[], const struct gmx_multisim_t *ms);
/* Calculate the sum over the simulations of an array of ints */
-void gmx_sumli_sim(int nr, gmx_int64_t r[], const struct gmx_multisim_t *ms);
+void gmx_sumli_sim(int nr, int64_t r[], const struct gmx_multisim_t *ms);
/* Calculate the sum over the simulations of an array of large ints */
void gmx_sumf_sim(int nr, float r[], const struct gmx_multisim_t *ms);
}
void print_perf(FILE *out, double time_per_thread, double time_per_node,
- gmx_int64_t nsteps, double delta_t,
+ int64_t nsteps, double delta_t,
double nbfs, double mflop)
{
double wallclocktime;
*/
void print_perf(FILE *out, double nodetime, double realtime,
- gmx_int64_t nsteps, double delta_t,
+ int64_t nsteps, double delta_t,
double nbfs, double mflop);
/* Prints the performance, nbfs and mflop come from print_flop */
if (ir->ld_seed == -1)
{
ir->ld_seed = static_cast<int>(gmx::makeRandomSeed());
- fprintf(stderr, "Setting the LD random seed to %" GMX_PRId64 "\n", ir->ld_seed);
+ fprintf(stderr, "Setting the LD random seed to %" PRId64 "\n", ir->ld_seed);
}
if (ir->expandedvals->lmc_seed == -1)
s += gmx::formatString(" Numa nodes:\n");
for (auto &n : hwTop.machine().numa.nodes)
{
- s += gmx::formatString(" Node %2d (%" GMX_PRIu64 " bytes mem):", n.id, n.memory);
+ s += gmx::formatString(" Node %2d (%" PRIu64 " bytes mem):", n.id, n.memory);
for (auto &l : n.logicalProcessorId)
{
s += gmx::formatString(" %3d", l);
s += gmx::formatString(" Caches:\n");
for (auto &c : hwTop.machine().caches)
{
- s += gmx::formatString(" L%d: %" GMX_PRIu64 " bytes, linesize %d bytes, assoc. %d, shared %d ways\n",
+ s += gmx::formatString(" L%d: %" PRIu64 " bytes, linesize %d bytes, assoc. %d, shared %d ways\n",
c.level, c.size, c.linesize, c.associativity, c.shared);
}
}
*/
typedef struct
{
- gmx_int32_t tstep; /**< time step */
- float T_abs; /**< absolute temperature */
- float E_tot; /**< total energy */
- float E_pot; /**< potential energy */
- float E_vdw; /**< van der Waals energy */
- float E_coul; /**< Coulomb interaction energy */
- float E_bond; /**< bonds energy */
- float E_angle; /**< angles energy */
- float E_dihe; /**< dihedrals energy */
- float E_impr; /**< improper dihedrals energy */
+ int32_t tstep; /**< time step */
+ float T_abs; /**< absolute temperature */
+ float E_tot; /**< total energy */
+ float E_pot; /**< potential energy */
+ float E_vdw; /**< van der Waals energy */
+ float E_coul; /**< Coulomb interaction energy */
+ float E_bond; /**< bonds energy */
+ float E_angle; /**< angles energy */
+ float E_dihe; /**< dihedrals energy */
+ float E_impr; /**< improper dihedrals energy */
} IMDEnergyBlock;
*/
typedef struct
{
- gmx_int32_t type; /**< Type of IMD message, see IMDType_t above */
- gmx_int32_t length; /**< Length */
+ int32_t type; /**< Type of IMD message, see IMDType_t above */
+ int32_t length; /**< Length */
} IMDHeader;
IMDEnergyBlock *energies; /**< Pointer to energies we send back. */
- gmx_int32_t vmd_nforces; /**< Number of VMD forces. */
- gmx_int32_t *vmd_f_ind; /**< VMD forces indices. */
+ int32_t vmd_nforces; /**< Number of VMD forces. */
+ int32_t *vmd_f_ind; /**< VMD forces indices. */
float *vmd_forces; /**< The VMD forces flat in memory. */
int nforces; /**< Number of actual MD forces;
this gets communicated to the clients. */
/*! \brief Fills the header with message and the length argument. */
-static void fill_header(IMDHeader *header, IMDMessageType type, gmx_int32_t length)
+static void fill_header(IMDHeader *header, IMDMessageType type, int32_t length)
{
/* We (ab-)use htonl network function for the correct endianness */
- header->type = htonl((gmx_int32_t) type);
+ header->type = htonl((int32_t) type);
header->length = htonl(length);
}
/*! \brief Reads multiple bytes from socket. */
-static gmx_int32_t imd_read_multiple(IMDSocket *socket, char *datptr, gmx_int32_t toread)
+static int32_t imd_read_multiple(IMDSocket *socket, char *datptr, int32_t toread)
{
- gmx_int32_t leftcount, countread;
+ int32_t leftcount, countread;
leftcount = toread;
/*! \brief Writes multiple bytes to socket in analogy to imd_read_multiple. */
-static gmx_int32_t imd_write_multiple(IMDSocket *socket, const char *datptr, gmx_int32_t towrite)
+static int32_t imd_write_multiple(IMDSocket *socket, const char *datptr, int32_t towrite)
{
- gmx_int32_t leftcount, countwritten;
+ int32_t leftcount, countwritten;
leftcount = towrite;
/*! \brief Send energies using the energy block and the send buffer. */
static int imd_send_energies(IMDSocket *socket, const IMDEnergyBlock *energies, char *buffer)
{
- gmx_int32_t recsize;
+ int32_t recsize;
recsize = HEADERSIZE + sizeof(IMDEnergyBlock);
/*! \brief Receive IMD header from socket, sets the length and returns the IMD message. */
-static IMDMessageType imd_recv_header(IMDSocket *socket, gmx_int32_t *length)
+static IMDMessageType imd_recv_header(IMDSocket *socket, int32_t *length)
{
IMDHeader header;
*
* The number of forces was previously communicated via the header.
*/
-static int imd_recv_mdcomm(IMDSocket *socket, gmx_int32_t nforces, gmx_int32_t *forcendx, float *forces)
+static int imd_recv_mdcomm(IMDSocket *socket, int32_t nforces, int32_t *forcendx, float *forces)
{
int retsize, retbytes;
/* reading indices */
- retsize = sizeof(gmx_int32_t) * nforces;
+ retsize = sizeof(int32_t) * nforces;
retbytes = imd_read_multiple(socket, (char *) forcendx, retsize);
if (retbytes != retsize)
{
*/
static int imd_send_rvecs(IMDSocket *socket, int nat, rvec *x, char *buffer)
{
- gmx_int32_t size;
+ int32_t size;
int i;
float sendx[3];
int tuplesize = 3 * sizeof(float);
size = HEADERSIZE + 3 * sizeof(float) * nat;
/* Prepare header */
- fill_header((IMDHeader *) buffer, IMD_FCOORDS, (gmx_int32_t) nat);
+ fill_header((IMDHeader *) buffer, IMD_FCOORDS, (int32_t) nat);
for (i = 0; i < nat; i++)
{
sendx[0] = (float) x[i][0] * NM2A;
int i;
int nat_total;
t_gmx_IMD_setup *IMDsetup;
- gmx_int32_t bufxsize;
+ int32_t bufxsize;
gmx_bool bIMD = FALSE;
if (MASTER(cr))
{
/* we allocate memory for our IMD energy structure */
- gmx_int32_t recsize = HEADERSIZE + sizeof(IMDEnergyBlock);
+ int32_t recsize = HEADERSIZE + sizeof(IMDEnergyBlock);
snew(IMDsetup->energysendbuf, recsize);
/* Shall we wait for a connection? */
gmx_bool do_IMD(gmx_bool bIMD,
- gmx_int64_t step,
+ int64_t step,
const t_commrec *cr,
gmx_bool bNS,
matrix box,
void IMD_fill_energy_record(gmx_bool bIMD, t_IMD *imd, gmx_enerdata_t *enerd,
- gmx_int64_t step, gmx_bool bHaveNewEnergies)
+ int64_t step, gmx_bool bHaveNewEnergies)
{
IMDEnergyBlock *ene;
t_gmx_IMD *IMDsetup;
void IMD_prep_energies_send_positions(gmx_bool bIMD, gmx_bool bIMDstep,
t_IMD *imd, gmx_enerdata_t *enerd,
- gmx_int64_t step, gmx_bool bHaveNewEnergies,
+ int64_t step, gmx_bool bHaveNewEnergies,
gmx_wallcycle *wcycle)
{
if (bIMD)
*
* \returns Whether or not we have to do IMD communication at this step.
*/
-gmx_bool do_IMD(gmx_bool bIMD, gmx_int64_t step, const t_commrec *cr,
+gmx_bool do_IMD(gmx_bool bIMD, int64_t step, const t_commrec *cr,
gmx_bool bNS,
matrix box, rvec x[], t_inputrec *ir, double t,
gmx_wallcycle *wcycle);
*
*/
void IMD_fill_energy_record(gmx_bool bIMD, t_IMD *imd, gmx_enerdata_t *enerd,
- gmx_int64_t step, gmx_bool bHaveNewEnergies);
+ int64_t step, gmx_bool bHaveNewEnergies);
/*! \brief Send positions and energies to the client.
*/
void IMD_prep_energies_send_positions(gmx_bool bIMD, gmx_bool bIMDstep,
t_IMD *imd, gmx_enerdata_t *enerd,
- gmx_int64_t step, gmx_bool bHaveNewEnergies,
+ int64_t step, gmx_bool bHaveNewEnergies,
gmx_wallcycle *wcycle);
/*! \brief Finalize IMD and do some cleaning up.
gmx_bool
-check_int_multiply_for_overflow(gmx_int64_t a,
- gmx_int64_t b,
- gmx_int64_t *result)
+check_int_multiply_for_overflow(int64_t a,
+ int64_t b,
+ int64_t *result)
{
- gmx_int64_t sign = 1;
+ int64_t sign = 1;
if ((0 == a) || (0 == b))
{
*result = 0;
b = -b;
sign = -sign;
}
- if (GMX_INT64_MAX / b < a)
+ if (INT64_MAX / b < a)
{
- *result = (sign > 0) ? GMX_INT64_MAX : GMX_INT64_MIN;
+ *result = (sign > 0) ? INT64_MAX : INT64_MIN;
return FALSE;
}
*result = sign * a * b;
* \return False iff overflow occurred
*/
gmx_bool
-check_int_multiply_for_overflow(gmx_int64_t a,
- gmx_int64_t b,
- gmx_int64_t *result);
+check_int_multiply_for_overflow(int64_t a,
+ int64_t b,
+ int64_t *result);
/*! \brief Find greatest common divisor of two numbers
*
}
BoxDeformation::BoxDeformation(double timeStep,
- gmx_int64_t initialStep,
+ int64_t initialStep,
const tensor &deformationTensor,
const matrix &referenceBox)
: timeStep_(timeStep),
void
BoxDeformation::apply(ArrayRef<RVec> x,
matrix box,
- gmx_int64_t step)
+ int64_t step)
{
matrix updatedBox, invbox, mu;
public:
//! Trivial constructor.
BoxDeformation(double timeStep,
- gmx_int64_t initialStep,
+ int64_t initialStep,
const tensor &deformationTensor,
const matrix &referenceBox);
//! Deform \c x and \c box at this \c step;
void apply(ArrayRef<RVec> x,
matrix box,
- gmx_int64_t step);
+ int64_t step);
private:
//! The integrator time step.
double timeStep_;
//! The initial step number (from the .tpr, which permits checkpointing to work correctly).
- gmx_int64_t initialStep_;
+ int64_t initialStep_;
//! Non-zero elements provide a scaling factor for deformation in that box dimension.
tensor deformationTensor_;
//! The initial box, ie from the .tpr file.
const t_mdatoms &md);
bool apply(bool bLog,
bool bEner,
- gmx_int64_t step,
+ int64_t step,
int delta_step,
real step_scaling,
rvec *x,
}
//! Writes out domain contents to help diagnose crashes.
-static void dump_confs(FILE *log, gmx_int64_t step, const gmx_mtop_t &mtop,
+static void dump_confs(FILE *log, int64_t step, const gmx_mtop_t &mtop,
int start, int homenr, const t_commrec *cr,
const rvec x[], rvec xprime[], matrix box)
{
bool
Constraints::apply(bool bLog,
bool bEner,
- gmx_int64_t step,
+ int64_t step,
int delta_step,
real step_scaling,
rvec *x,
bool
Constraints::Impl::apply(bool bLog,
bool bEner,
- gmx_int64_t step,
+ int64_t step,
int delta_step,
real step_scaling,
rvec *x,
{
char buf[STRLEN];
sprintf(buf,
- "\nstep " "%" GMX_PRId64 ": One or more water molecules can not be settled.\n"
+ "\nstep " "%" PRId64 ": One or more water molecules can not be settled.\n"
"Check for bad contacts and/or reduce the timestep if appropriate.\n",
step);
if (log)
*/
bool apply(bool bLog,
bool bEner,
- gmx_int64_t step,
+ int64_t step,
int delta_step,
real step_scaling,
rvec *x,
}
}
-void parrinellorahman_pcoupl(FILE *fplog, gmx_int64_t step,
+void parrinellorahman_pcoupl(FILE *fplog, int64_t step,
const t_inputrec *ir, real dt, const tensor pres,
tensor box, tensor box_rel, tensor boxv,
tensor M, matrix mu, gmx_bool bFirstStep)
mmul_ur0(invbox, t1, mu);
}
-void berendsen_pcoupl(FILE *fplog, gmx_int64_t step,
+void berendsen_pcoupl(FILE *fplog, int64_t step,
const t_inputrec *ir, real dt,
const tensor pres, const matrix box,
const matrix force_vir, const matrix constraint_vir,
}
}
-void andersen_tcoupl(t_inputrec *ir, gmx_int64_t step,
+void andersen_tcoupl(t_inputrec *ir, int64_t step,
const t_commrec *cr, const t_mdatoms *md, t_state *state, real rate, const gmx_bool *randomize, const real *boltzfac)
{
const int *gatindex = (DOMAINDECOMP(cr) ? cr->dd->globalAtomIndices.data() : nullptr);
}
}
-void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind,
+void trotter_update(t_inputrec *ir, int64_t step, gmx_ekindata_t *ekind,
gmx_enerdata_t *enerd, t_state *state,
tensor vir, t_mdatoms *md,
t_extmass *MassQ, int **trotter_seqlist, int trotter_seqno)
int n, i, d, ngtc, gc = 0, t;
t_grp_tcstat *tcstat;
t_grpopts *opts;
- gmx_int64_t step_eff;
+ int64_t step_eff;
real dt;
double *scalefac, dtc;
int *trotter_seq;
}
static real vrescale_resamplekin(real kk, real sigma, real ndeg, real taut,
- gmx_int64_t step, gmx_int64_t seed)
+ int64_t step, int64_t seed)
{
/*
* Generates a new value for the kinetic energy,
return ekin_new;
}
-void vrescale_tcoupl(t_inputrec *ir, gmx_int64_t step,
+void vrescale_tcoupl(t_inputrec *ir, int64_t step,
gmx_ekindata_t *ekind, real dt,
double therm_integral[])
{
typedef struct {
int nener;
gmx_enxnm_t *enm;
- gmx_int64_t nsteps;
- gmx_int64_t nsum;
+ int64_t nsteps;
+ int64_t nsum;
t_energy *e;
- gmx_int64_t nsteps_sim;
- gmx_int64_t nsum_sim;
+ int64_t nsteps_sim;
+ int64_t nsum_sim;
t_energy *e_sim;
} t_ebin;
return bIfFlat;
}
-static gmx_bool CheckIfDoneEquilibrating(int nlim, t_expanded *expand, df_history_t *dfhist, gmx_int64_t step)
+static gmx_bool CheckIfDoneEquilibrating(int nlim, t_expanded *expand, df_history_t *dfhist, int64_t step)
{
int i, totalsamples;
}
static gmx_bool UpdateWeights(int nlim, t_expanded *expand, df_history_t *dfhist,
- int fep_state, real *scaled_lamee, real *weighted_lamee, gmx_int64_t step)
+ int fep_state, real *scaled_lamee, real *weighted_lamee, int64_t step)
{
gmx_bool bSufficientSamples;
int i;
}
static int ChooseNewLambda(int nlim, t_expanded *expand, df_history_t *dfhist, int fep_state, real *weighted_lamee, double *p_k,
- gmx_int64_t seed, gmx_int64_t step)
+ int64_t seed, int64_t step)
{
/* Choose new lambda value, and update transition matrix */
/* print out the weights to the log, along with current state */
void PrintFreeEnergyInfoToFile(FILE *outfile, t_lambda *fep, t_expanded *expand, t_simtemp *simtemp, df_history_t *dfhist,
- int fep_state, int frequency, gmx_int64_t step)
+ int fep_state, int frequency, int64_t step)
{
int nlim, i, ifep, jfep;
real dw, dg, dv, Tprint;
int ExpandedEnsembleDynamics(FILE *log, t_inputrec *ir, gmx_enerdata_t *enerd,
t_state *state, t_extmass *MassQ, int fep_state, df_history_t *dfhist,
- gmx_int64_t step,
+ int64_t step,
rvec *v, t_mdatoms *mdatoms)
/* Note that the state variable is only needed for simulated tempering, not
Hamiltonian expanded ensemble. May be able to remove it after integrator refactoring. */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
int ExpandedEnsembleDynamics(FILE *log, t_inputrec *ir, gmx_enerdata_t *enerd,
t_state *state, t_extmass *MassQ, int fep_state, df_history_t *dfhist,
- gmx_int64_t step,
+ int64_t step,
rvec *v, t_mdatoms *mdatoms);
void PrintFreeEnergyInfoToFile(FILE *outfile, t_lambda *fep, t_expanded *expand, t_simtemp *simtemp, df_history_t *dfhist,
- int fep_state, int frequency, gmx_int64_t step);
+ int fep_state, int frequency, int64_t step);
#endif
const t_inputrec *inputrec,
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
- gmx_int64_t step,
+ int64_t step,
t_nrnb *nrnb,
gmx_wallcycle *wcycle,
// TODO top can be const when the group scheme no longer
const t_atoms *atoms, *atoms_tpi;
const t_blocka *excl;
int nmolc, i, j, tpi, tpj, j1, j2, k, nexcl, q;
- gmx_int64_t npair, npair_ij, tmpi, tmpj;
+ int64_t npair, npair_ij, tmpi, tmpj;
double csix, ctwelve;
int ntp, *typecount;
gmx_bool bBHAM;
bool constrain_lincs(bool computeRmsd,
const t_inputrec &ir,
- gmx_int64_t step,
+ int64_t step,
Lincs *lincsd, const t_mdatoms &md,
const t_commrec *cr,
const gmx_multisim_t &ms,
bool
constrain_lincs(bool computeRmsd,
const t_inputrec &ir,
- gmx_int64_t step,
+ int64_t step,
Lincs *lincsd, const t_mdatoms &md,
const t_commrec *cr,
const gmx_multisim_t &ms,
// TODO move this to multi-sim module
void check_multi_int64(FILE *log, const gmx_multisim_t *ms,
- gmx_int64_t val, const char *name,
+ int64_t val, const char *name,
gmx_bool bQuiet)
{
- gmx_int64_t *ibuf;
+ int64_t *ibuf;
int p;
gmx_bool bCompatible;
char strbuf[255];
/* first make the format string */
snprintf(strbuf, 255, " subsystem %%d: %s\n",
- "%" GMX_PRId64);
+ "%" PRId64);
fprintf(log, strbuf, p, ibuf[p]);
}
}
int val, const char *name,
gmx_bool bQuiet);
void check_multi_int64(FILE *log, const gmx_multisim_t *ms,
- gmx_int64_t val, const char *name,
+ int64_t val, const char *name,
gmx_bool bQuiet);
/* Check if val is the same on all processors for a mdrun -multidir run
* The string name is used to print to the log file and in a fatal error
// TODO move this to multi-sim module
bool multisim_int_all_are_equal(const gmx_multisim_t *ms,
- gmx_int64_t value)
+ int64_t value)
{
bool allValuesAreEqual = true;
- gmx_int64_t *buf;
+ int64_t *buf;
GMX_RELEASE_ASSERT(ms, "Invalid use of multi-simulation pointer");
}
}
-void setCurrentLambdasRerun(gmx_int64_t step, const t_lambda *fepvals,
+void setCurrentLambdasRerun(int64_t step, const t_lambda *fepvals,
const t_trxframe *rerun_fr, const double *lam0,
t_state *globalState)
{
}
}
-void setCurrentLambdasLocal(gmx_int64_t step, const t_lambda *fepvals,
+void setCurrentLambdasLocal(int64_t step, const t_lambda *fepvals,
const double *lam0, t_state *state)
/* find the current lambdas. If rerunning, we either read in a state, or a lambda value,
requiring different logic. */
*
* \todo This duplicates some of check_multi_int. Consolidate. */
bool multisim_int_all_are_equal(const gmx_multisim_t *ms,
- gmx_int64_t value);
+ int64_t value);
void rerun_parallel_comm(t_commrec *cr, t_trxframe *fr,
gmx_bool *bLastStep);
/* Set the lambda values in the global state from a frame read with rerun */
-void setCurrentLambdasRerun(gmx_int64_t step, const t_lambda *fepvals,
+void setCurrentLambdasRerun(int64_t step, const t_lambda *fepvals,
const t_trxframe *rerun_fr, const double *lam0,
t_state *globalState);
/* Set the lambda values at each step of mdrun when they change */
-void setCurrentLambdasLocal(gmx_int64_t step, const t_lambda *fepvals,
+void setCurrentLambdasLocal(int64_t step, const t_lambda *fepvals,
const double *lam0, t_state *state);
int multisim_min(const gmx_multisim_t *ms, int nmin, int n);
fprintf(log, "\n");
}
-void print_ebin_header(FILE *log, gmx_int64_t steps, double time)
+void print_ebin_header(FILE *log, int64_t steps, double time)
{
char buf[22];
// both .edr and .log output for both per-time and time-average data.
void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
FILE *log,
- gmx_int64_t step, double time,
+ int64_t step, double time,
int mode,
t_mdebin *md, t_fcdata *fcd,
gmx_groups_t *groups, t_grpopts *opts,
void upd_mdebin_step(t_mdebin *md);
/* Updates only the step count in md */
-void print_ebin_header(FILE *log, gmx_int64_t steps, double time);
+void print_ebin_header(FILE *log, int64_t steps, double time);
void print_ebin(ener_file_t fp_ene, gmx_bool bEne, gmx_bool bDR, gmx_bool bOR,
FILE *log,
- gmx_int64_t step, double time,
+ int64_t step, double time,
int mode,
t_mdebin *md, t_fcdata *fcd,
gmx_groups_t *groups, t_grpopts *opts,
Get this start value in number of histogram dxs from zero,
as an integer.*/
- dh->x0[hi] = (gmx_int64_t)floor(min_dh/dx);
+ dh->x0[hi] = (int64_t)floor(min_dh/dx);
min_dh_hist = (dh->x0[hi])*dx;
max_dh_hist = (dh->x0[hi] + dh->nbins + 1)*dx;
double dx; /* the histogram spacing in kJ/mol. This is the
same for the two histograms? */
unsigned int nbins; /* the number of bins in the histograms*/
- gmx_int64_t x0[2]; /* the starting point in units of spacing
- of the histogram */
+ int64_t x0[2]; /* the starting point in units of spacing
+ of the histogram */
unsigned int maxbin[2]; /* highest bin number with data */
int type; /* the block type according to dhbtDH, etc. */
int nlambda; /* length of the lambda vector */
gmx_bool written; /* whether this data has already been written out */
- gmx_int64_t subblock_meta_l[5]; /* metadata for an mdebin subblock for
- I/O: for histogram counts, etc.*/
+ int64_t subblock_meta_l[5]; /* metadata for an mdebin subblock for
+ I/O: for histogram counts, etc.*/
double *subblock_meta_d; /* metadata subblock for I/O, used for
communicating doubles (i.e. the lambda
vector) */
gmx_mdoutf_t of,
int mdof_flags,
gmx_mtop_t *top_global,
- gmx_int64_t step, double t,
+ int64_t step, double t,
t_state *state_local, t_state *state_global,
ObservablesHistory *observablesHistory,
gmx::ArrayRef<gmx::RVec> f_local)
gmx_mdoutf_t of,
int mdof_flags,
gmx_mtop_t *top_global,
- gmx_int64_t step, double t,
+ int64_t step, double t,
t_state *state_local, t_state *state_global,
ObservablesHistory *observablesHistory,
gmx::ArrayRef<gmx::RVec> f_local);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Options for checkpointing th simulation
CheckpointOptions checkpointOptions;
//! Number of steps to run, -2 is use inputrec, -1 is infinite
- gmx_int64_t numStepsCommandline;
+ int64_t numStepsCommandline;
//! Maximum duration of this simulation in wall-clock hours, -1 is no limit
real maximumHoursToRun;
//! Options for timing the run
int natpair_lj; /* Total number of atom pairs for LJ kernel */
int natpair_q; /* Total number of atom pairs for Q kernel */
t_nblist **nbl_fep; /* List of free-energy atom pair interactions */
- gmx_int64_t outerListCreationStep; /* Step at which the outer list was created */
+ int64_t outerListCreationStep; /* Step at which the outer list was created */
} nbnxn_pairlist_set_t;
enum {
real *simd_4xn_diagonal_j_minus_i;
real *simd_2xnn_diagonal_j_minus_i;
/* Filters for topology exclusion masks for the SIMD kernels. */
- gmx_uint32_t *simd_exclusion_filter;
- gmx_uint64_t *simd_exclusion_filter64; //!< Used for double w/o SIMD int32 logical support
+ uint32_t *simd_exclusion_filter;
+ uint64_t *simd_exclusion_filter64; //!< Used for double w/o SIMD int32 logical support
real *simd_interaction_array; /* Array of masks needed for exclusions */
int nout; /* The number of force arrays */
nbnxn_atomdata_output_t *out; /* Output data structures */
struct gmx_repl_ex *re,
const gmx_enerdata_t *enerd,
real vol,
- gmx_int64_t step,
+ int64_t step,
real time)
{
int m, i, j, a, b, ap, bp, i0, i1, tmp;
gmx::UniformIntDistribution<int> uniformNreplDist(0, re->nrepl-1);
bMultiEx = (re->nex > 1); /* multiple exchanges at each state */
- fprintf(fplog, "Replica exchange at step %" GMX_PRId64 " time %.5f\n", step, time);
+ fprintf(fplog, "Replica exchange at step %" PRId64 " time %.5f\n", step, time);
if (re->bNPT)
{
gmx_bool replica_exchange(FILE *fplog, const t_commrec *cr,
const gmx_multisim_t *ms, struct gmx_repl_ex *re,
t_state *state, const gmx_enerdata_t *enerd,
- t_state *state_local, gmx_int64_t step, real time)
+ t_state *state_local, int64_t step, real time)
{
int j;
int replica_id = 0;
gmx_repl_ex_t re,
t_state *state, const gmx_enerdata_t *enerd,
t_state *state_local,
- gmx_int64_t step, real time);
+ int64_t step, real time);
/* Attempts replica exchange, should be called on all ranks.
* Returns TRUE if this state has been exchanged.
* When running each replica in parallel,
}
}
-static void print_epot(FILE *fp, gmx_int64_t mdstep, int count, real epot, real df,
+static void print_epot(FILE *fp, int64_t mdstep, int count, real epot, real df,
int ndir, real sf_dir)
{
char buf[22];
const t_inputrec *ir,
const t_commrec *cr,
int dd_ac1,
- gmx_int64_t step,
+ int64_t step,
const t_mdatoms *md,
int end,
rvec *x_old,
const gmx_multisim_t *ms,
gmx_bool bVerbose,
gmx_enfrot *enforcedRotation,
- gmx_int64_t mdstep,
+ int64_t mdstep,
const t_inputrec *inputrec,
gmx_bool bDoNS,
int force_flags,
std::copy(force[Min].begin(), force[Min].end(), f.begin());
}
-void done_shellfc(FILE *fplog, gmx_shellfc_t *shfc, gmx_int64_t numSteps)
+void done_shellfc(FILE *fplog, gmx_shellfc_t *shfc, int64_t numSteps)
{
if (shfc && fplog && numSteps > 0)
{
const gmx_multisim_t *ms,
gmx_bool bVerbose,
gmx_enfrot *enforcedRotation,
- gmx_int64_t mdstep,
+ int64_t mdstep,
const t_inputrec *inputrec,
gmx_bool bDoNS,
int force_flags,
DdCloseBalanceRegionAfterForceComputation ddCloseBalanceRegion);
/* Print some final output */
-void done_shellfc(FILE *fplog, gmx_shellfc_t *shellfc, gmx_int64_t numSteps);
+void done_shellfc(FILE *fplog, gmx_shellfc_t *shellfc, int64_t numSteps);
#endif
void print_time(FILE *out,
gmx_walltime_accounting_t walltime_accounting,
- gmx_int64_t step,
+ int64_t step,
t_inputrec *ir,
const t_commrec *cr)
{
static void print_large_forces(FILE *fp,
const t_mdatoms *md,
const t_commrec *cr,
- gmx_int64_t step,
+ int64_t step,
real forceTolerance,
const rvec *x,
const rvec *f)
bool nonFinite = !std::isfinite(force2);
if (force2 >= force2Tolerance || nonFinite)
{
- fprintf(fp, "step %" GMX_PRId64 " atom %6d x %8.3f %8.3f %8.3f force %12.5e\n",
+ fprintf(fp, "step %" PRId64 " atom %6d x %8.3f %8.3f %8.3f force %12.5e\n",
step,
ddglatnr(cr->dd, i), x[i][XX], x[i][YY], x[i][ZZ], std::sqrt(force2));
}
* the printing on other ranks. But we can only avoid that with
* an expensive MPI barrier that we would need at each step.
*/
- gmx_fatal(FARGS, "At step %" GMX_PRId64 " detected non-finite forces on %ju atoms", step, numNonFinite);
+ gmx_fatal(FARGS, "At step %" PRId64 " detected non-finite forces on %ju atoms", step, numNonFinite);
}
}
static void post_process_forces(const t_commrec *cr,
- gmx_int64_t step,
+ int64_t step,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle,
const gmx_localtop_t *top,
gmx_enerdata_t *enerd,
int flags, int ilocality,
int clearF,
- gmx_int64_t step,
+ int64_t step,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle)
{
* \param[in] enerd The energy data; the non-bonded group energies need to be added to enerd.term[F_EPOT] before calling this routine
* \param[in] inputrec The input record
*/
-static void checkPotentialEnergyValidity(gmx_int64_t step,
+static void checkPotentialEnergyValidity(int64_t step,
const gmx_enerdata_t &enerd,
const t_inputrec &inputrec)
{
if (energyIsNotFinite || (averageKineticEnergy > 0 &&
enerd.term[F_EPOT] > c_thresholdFactor*averageKineticEnergy))
{
- gmx_fatal(FARGS, "Step %" GMX_PRId64 ": The total potential energy is %g, which is %s. The LJ and electrostatic contributions to the energy are %g and %g, respectively. A %s potential energy can be caused by overlapping interactions in bonded interactions or very large%s coordinate values. Usually this is caused by a badly- or non-equilibrated initial configuration, incorrect interactions or parameters in the topology.",
+ gmx_fatal(FARGS, "Step %" PRId64 ": The total potential energy is %g, which is %s. The LJ and electrostatic contributions to the energy are %g and %g, respectively. A %s potential energy can be caused by overlapping interactions in bonded interactions or very large%s coordinate values. Usually this is caused by a badly- or non-equilibrated initial configuration, incorrect interactions or parameters in the topology.",
step,
enerd.term[F_EPOT],
energyIsNotFinite ? "not finite" : "extremely high",
const t_inputrec *inputrec,
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
- gmx_int64_t step,
+ int64_t step,
double t,
gmx_wallcycle_t wcycle,
ForceProviders *forceProviders,
static inline void launchGpuRollingPruning(const t_commrec *cr,
const nonbonded_verlet_t *nbv,
const t_inputrec *inputrec,
- const gmx_int64_t step)
+ const int64_t step)
{
/* We should not launch the rolling pruning kernel at a search
* step or just before search steps, since that's useless.
const t_inputrec *inputrec,
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
- gmx_int64_t step,
+ int64_t step,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle,
const gmx_localtop_t *top,
const t_inputrec *inputrec,
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
- gmx_int64_t step,
+ int64_t step,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
const t_inputrec *inputrec,
gmx::Awh *awh,
gmx_enfrot *enforcedRotation,
- gmx_int64_t step,
+ int64_t step,
t_nrnb *nrnb,
gmx_wallcycle_t wcycle,
gmx_localtop_t *top,
t_state *state)
{
int i, m, start, end;
- gmx_int64_t step;
+ int64_t step;
real dt = ir->delta_t;
real dvdl_dum;
rvec *savex;
gmx_bool bSumEkinhOld, int flags);
/* All-reduce energy-like quantities over cr->mpi_comm_mysim */
-int do_per_step(gmx_int64_t step, gmx_int64_t nstep);
+int do_per_step(int64_t step, int64_t nstep);
/* Return TRUE if io should be done */
/* ROUTINES from sim_util.c */
void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
- gmx_int64_t step, t_inputrec *ir, const t_commrec *cr);
+ int64_t step, t_inputrec *ir, const t_commrec *cr);
/*! \brief Print date, time, MPI rank and a description of this point
* in time.
}
}
-int do_per_step(gmx_int64_t step, gmx_int64_t nstep)
+int do_per_step(int64_t step, int64_t nstep)
{
if (nstep != 0)
{
t_commrec *cr,
int nfile,
const t_filenm fnm[],
- gmx_int64_t step,
- gmx_int64_t step_rel,
+ int64_t step,
+ int64_t step_rel,
double t,
t_inputrec *ir,
t_state *state,
struct t_commrec *cr,
int nfile,
const t_filenm fnm[],
- gmx_int64_t step,
- gmx_int64_t step_rel,
+ int64_t step,
+ int64_t step_rel,
double t,
t_inputrec *ir,
t_state *state,
PaddedRVecVector xp;
/* Variables for the deform algorithm */
- gmx_int64_t deformref_step;
+ int64_t deformref_step;
matrix deformref_box;
//! Box deformation handler (or nullptr if inactive).
gmx::BoxDeformation *deform;
};
-static bool isTemperatureCouplingStep(gmx_int64_t step, const t_inputrec *ir)
+static bool isTemperatureCouplingStep(int64_t step, const t_inputrec *ir)
{
/* We should only couple after a step where energies were determined (for leapfrog versions)
or the step energies are determined, for velocity verlet versions */
do_per_step(step + ir->nsttcouple - offset, ir->nsttcouple));
}
-static bool isPressureCouplingStep(gmx_int64_t step, const t_inputrec *ir)
+static bool isPressureCouplingStep(int64_t step, const t_inputrec *ir)
{
GMX_ASSERT(ir->epc != epcMTTK, "MTTK pressure coupling is not handled here");
/*! \brief Handles the Leap-frog MD x and v integration */
static void do_update_md(int start,
int nrend,
- gmx_int64_t step,
+ int64_t step,
real dt,
const t_inputrec * ir,
const t_mdatoms * md,
const unsigned short cFREEZE[], const unsigned short cACC[],
const unsigned short cTC[],
const rvec x[], rvec xprime[], rvec v[], const rvec f[],
- gmx_int64_t step, int seed, const int *gatindex)
+ int64_t step, int seed, const int *gatindex)
{
if (updateType != SDUpdate::FrictionAndNoiseOnly)
{
const unsigned short cFREEZE[], const unsigned short cTC[],
const rvec x[], rvec xprime[], rvec v[],
const rvec f[], real friction_coefficient,
- const real *rf, gmx_int64_t step, int seed,
+ const real *rf, int64_t step, int seed,
const int* gatindex)
{
/* note -- these appear to be full step velocities . . . */
}
}
-void update_tcouple(gmx_int64_t step,
+void update_tcouple(int64_t step,
t_inputrec *inputrec,
t_state *state,
gmx_ekindata_t *ekind,
}
void update_pcouple_before_coordinates(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
const t_inputrec *inputrec,
t_state *state,
matrix parrinellorahmanMu,
}
}
-void constrain_velocities(gmx_int64_t step,
+void constrain_velocities(int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
t_state *state,
tensor vir_part,
}
}
-void constrain_coordinates(gmx_int64_t step,
+void constrain_coordinates(int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
t_state *state,
tensor vir_part,
}
void
-update_sd_second_half(gmx_int64_t step,
+update_sd_second_half(int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
const t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
}
void update_pcouple_after_coordinates(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
const t_inputrec *inputrec,
const t_mdatoms *md,
const matrix pressure,
}
}
-void update_coords(gmx_int64_t step,
+void update_coords(int64_t step,
t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
t_state *state,
}
-extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_int64_t step, const t_commrec *cr,
+extern gmx_bool update_randomize_velocities(t_inputrec *ir, int64_t step, const t_commrec *cr,
t_mdatoms *md, t_state *state, gmx_update_t *upd, gmx::Constraints *constr)
{
* as a reference state for simulations with box deformation.
*/
void set_deform_reference_box(gmx_update_t *upd,
- gmx_int64_t step, matrix box);
+ int64_t step, matrix box);
-void update_tcouple(gmx_int64_t step,
+void update_tcouple(int64_t step,
t_inputrec *inputrec,
t_state *state,
gmx_ekindata_t *ekind,
/* Update Parrinello-Rahman, to be called before the coordinate update */
void update_pcouple_before_coordinates(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
const t_inputrec *inputrec,
t_state *state,
matrix parrinellorahmanMu,
* When the deform option is used, scales coordinates and box here.
*/
void update_pcouple_after_coordinates(FILE *fplog,
- gmx_int64_t step,
+ int64_t step,
const t_inputrec *inputrec,
const t_mdatoms *md,
const matrix pressure,
t_nrnb *nrnb,
gmx_update_t *upd);
-void update_coords(gmx_int64_t step,
+void update_coords(int64_t step,
t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
t_state *state,
/* Return TRUE if OK, FALSE in case of Shake Error */
-extern gmx_bool update_randomize_velocities(t_inputrec *ir, gmx_int64_t step, const t_commrec *cr, t_mdatoms *md, t_state *state, gmx_update_t *upd, gmx::Constraints *constr);
+extern gmx_bool update_randomize_velocities(t_inputrec *ir, int64_t step, const t_commrec *cr, t_mdatoms *md, t_state *state, gmx_update_t *upd, gmx::Constraints *constr);
-void constrain_velocities(gmx_int64_t step,
+void constrain_velocities(int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
t_state *state,
tensor vir_part,
bool do_log,
bool do_ene);
-void constrain_coordinates(gmx_int64_t step,
+void constrain_coordinates(int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
t_state *state,
tensor vir_part,
bool do_log,
bool do_ene);
-void update_sd_second_half(gmx_int64_t step,
+void update_sd_second_half(int64_t step,
real *dvdlambda, /* the contribution to be added to the bonded interactions */
const t_inputrec *inputrec, /* input record and box stuff */
t_mdatoms *md,
void berendsen_tcoupl(const t_inputrec *ir, const gmx_ekindata_t *ekind, real dt,
std::vector<double> &therm_integral);
-void andersen_tcoupl(t_inputrec *ir, gmx_int64_t step,
+void andersen_tcoupl(t_inputrec *ir, int64_t step,
const t_commrec *cr, const t_mdatoms *md, t_state *state, real rate, const gmx_bool *randomize, const real *boltzfac);
void nosehoover_tcoupl(t_grpopts *opts, gmx_ekindata_t *ekind, real dt,
double xi[], double vxi[], t_extmass *MassQ);
-void trotter_update(t_inputrec *ir, gmx_int64_t step, gmx_ekindata_t *ekind,
+void trotter_update(t_inputrec *ir, int64_t step, gmx_ekindata_t *ekind,
gmx_enerdata_t *enerd, t_state *state, tensor vir, t_mdatoms *md,
t_extmass *MassQ, int **trotter_seqlist, int trotter_seqno);
void NBaroT_trotter(t_grpopts *opts, real dt,
double xi[], double vxi[], real *veta, t_extmass *MassQ);
-void vrescale_tcoupl(t_inputrec *ir, gmx_int64_t step,
+void vrescale_tcoupl(t_inputrec *ir, int64_t step,
gmx_ekindata_t *ekind, real dt,
double therm_integral[]);
/* Compute temperature scaling. For V-rescale it is done in update. */
* The unit of pressure is bar.
*/
-void parrinellorahman_pcoupl(FILE *fplog, gmx_int64_t step,
+void parrinellorahman_pcoupl(FILE *fplog, int64_t step,
const t_inputrec *ir, real dt, const tensor pres,
tensor box, tensor box_rel, tensor boxv,
tensor M, matrix mu,
gmx_bool bFirstStep);
-void berendsen_pcoupl(FILE *fplog, gmx_int64_t step,
+void berendsen_pcoupl(FILE *fplog, int64_t step,
const t_inputrec *ir, real dt,
const tensor pres, const matrix box,
const matrix force_vir, const matrix constraint_vir,
//! Resets all the counters.
static void reset_all_counters(FILE *fplog, const gmx::MDLogger &mdlog, t_commrec *cr,
- gmx_int64_t step,
- gmx_int64_t *step_rel, t_inputrec *ir,
+ int64_t step,
+ int64_t *step_rel, t_inputrec *ir,
gmx_wallcycle_t wcycle, t_nrnb *nrnb,
gmx_walltime_accounting_t walltime_accounting,
struct nonbonded_verlet_t *nbv,
// will go away eventually.
t_inputrec *ir = inputrec;
gmx_mdoutf *outf = nullptr;
- gmx_int64_t step, step_rel;
+ int64_t step, step_rel;
double elapsed_time;
double t, t0, lam0[efptNR];
gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
* until after load balancing completes,
* e.g. https://gerrit.gromacs.org/#/c/4964/2 */
gmx_fatal(FARGS, "PME tuning was still active when attempting to "
- "reset mdrun counters at step %" GMX_PRId64 ". Try "
+ "reset mdrun counters at step %" PRId64 ". Try "
"resetting counters later in the run, e.g. with gmx "
"mdrun -resetstep.", step);
}
//! Print message about convergence of the EM
static void print_converged(FILE *fp, const char *alg, real ftol,
- gmx_int64_t count, gmx_bool bDone, gmx_int64_t nsteps,
+ int64_t count, gmx_bool bDone, int64_t nsteps,
const em_state_t *ems, double sqrtNumAtoms)
{
char buf[STEPSTRSIZE];
gmx_mdoutf_t outf,
gmx_bool bX, gmx_bool bF, const char *confout,
gmx_mtop_t *top_global,
- t_inputrec *ir, gmx_int64_t step,
+ t_inputrec *ir, int64_t step,
em_state_t *state,
t_state *state_global,
ObservablesHistory *observablesHistory)
em_state_t *ems1, real a, const PaddedRVecVector *force,
em_state_t *ems2,
gmx::Constraints *constr,
- gmx_int64_t count)
+ int64_t count)
{
t_state *s1, *s2;
*/
void run(em_state_t *ems, rvec mu_tot,
tensor vir, tensor pres,
- gmx_int64_t count, gmx_bool bFirst);
+ int64_t count, gmx_bool bFirst);
//! Handles logging.
FILE *fplog;
//! Handles communication.
void
EnergyEvaluator::run(em_state_t *ems, rvec mu_tot,
tensor vir, tensor pres,
- gmx_int64_t count, gmx_bool bFirst)
+ int64_t count, gmx_bool bFirst)
{
real t;
gmx_bool bNS;
size_t atom = atom_index[aid];
for (size_t d = 0; d < DIM; d++)
{
- gmx_int64_t step = 0;
+ int64_t step = 0;
int force_flags = GMX_FORCE_STATECHANGED | GMX_FORCE_ALLFORCES;
double t = 0;
* with value passed on the command line (if any)
*/
static void override_nsteps_cmdline(const gmx::MDLogger &mdlog,
- gmx_int64_t nsteps_cmdline,
+ int64_t nsteps_cmdline,
t_inputrec *ir)
{
assert(ir);
gmx_wallcycle_t wcycle;
gmx_walltime_accounting_t walltime_accounting = nullptr;
int rc;
- gmx_int64_t reset_counters;
+ int64_t reset_counters;
int nthreads_pme = 1;
gmx_membed_t * membed = nullptr;
gmx_hw_info_t *hwinfo = nullptr;
rvec *x_mol;
rvec mu_tot, x_init, dx, x_tp;
int nnodes, frame;
- gmx_int64_t frame_step_prev, frame_step;
- gmx_int64_t nsteps, stepblocksize = 0, step;
- gmx_int64_t seed;
+ int64_t frame_step_prev, frame_step;
+ int64_t nsteps, stepblocksize = 0, step;
+ int64_t seed;
int i;
FILE *fp_tpi = nullptr;
char *ptr, *dump_pdb, **leg, str[STRLEN], str2[STRLEN];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Grid point state history data.
struct AwhPointStateHistory
{
- double bias; /**< Current biasing function estimate */
- double free_energy; /**< Current estimate of the convolved free energy/PMF. */
- double target; /**< Current target distribution, normalized to 1 */
- double weightsum_iteration; /**< Accumulated weight this iteration (1 replica) */
- double weightsum_covering; /**< Accumulated weights for covering checks */
- double weightsum_tot; /**< Accumulated weights, never reset */
- double weightsum_ref; /**< The reference weight histogram determining the f updates */
- gmx_int64_t last_update_index; /**< The last update that was performed at this point. */
- double log_pmfsum; /**< Logarithm of the PMF histogram (for 1 replica) */
- double visits_iteration; /**< Visits to this bin this iteration (1 replica) */
- double visits_tot; /**< Accumulated visits to this bin */
+ double bias; /**< Current biasing function estimate */
+ double free_energy; /**< Current estimate of the convolved free energy/PMF. */
+ double target; /**< Current target distribution, normalized to 1 */
+ double weightsum_iteration; /**< Accumulated weight this iteration (1 replica) */
+ double weightsum_covering; /**< Accumulated weights for covering checks */
+ double weightsum_tot; /**< Accumulated weights, never reset */
+ double weightsum_ref; /**< The reference weight histogram determining the f updates */
+ int64_t last_update_index; /**< The last update that was performed at this point. */
+ double log_pmfsum; /**< Logarithm of the PMF histogram (for 1 replica) */
+ double visits_iteration; /**< Visits to this bin this iteration (1 replica) */
+ double visits_tot; /**< Accumulated visits to this bin */
};
//! The global AWH bias history state, contains most data of the corresponding struct in awh.h.
double histSize; /**< Size of reference weight histogram. */
double logScaledSampleWeight; /**< The log of the current sample weight, scaled because of the histogram rescaling. */
double maxLogScaledSampleWeight; /**< Maximum sample weight obtained for previous (smaller) histogram sizes. */
- gmx_int64_t numUpdates; /**< The number of updates. */
+ int64_t numUpdates; /**< The number of updates. */
/*! \brief Constructor. */
AwhBiasStateHistory() : umbrellaGridpoint(0),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// TODO: Turn awhBiasParams into a std::vector when moved into AWH module
int numBias; /**< The number of AWH biases.*/
AwhBiasParams *awhBiasParams; /**< AWH bias parameters.*/
- gmx_int64_t seed; /**< Random seed.*/
+ int64_t seed; /**< Random seed.*/
int nstOut; /**< Output step interval.*/
int nstSampleCoord; /**< Number of samples per coordinate sample (also used for PMF) */
int numSamplesUpdateFreeEnergy; /**< Number of samples per free energy update. */
int *ibuf; /* for ints */
int ibuf_alloc;
- gmx_int64_t *libuf;
+ int64_t *libuf;
int libuf_alloc;
float *fbuf; /* for floats */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
class energyhistory_t
{
public:
- gmx_int64_t nsteps; //! The number of steps in the history
- gmx_int64_t nsum; //! Nr. of steps in the ener_ave and ener_sum
+ int64_t nsteps; //! The number of steps in the history
+ int64_t nsum; //! Nr. of steps in the ener_ave and ener_sum
std::vector<double> ener_ave; //! Energy terms difference^2 sum to get fluctuations
std::vector<double> ener_sum; //! Energy terms sum
- gmx_int64_t nsteps_sim; //! The number of steps in ener_sum_sim
- gmx_int64_t nsum_sim; //! The number of frames in ener_sum_sim
+ int64_t nsteps_sim; //! The number of steps in ener_sum_sim
+ int64_t nsum_sim; //! The number of frames in ener_sum_sim
std::vector<double> ener_sum_sim; //! Energy term history sum of the whole sim
//! History for energy difference for foreign lambdas (useful for BAR)
//! Integration method
int eI;
//! Number of steps to be taken
- gmx_int64_t nsteps;
+ int64_t nsteps;
//! Used in checkpointing to separate chunks
int simulation_part;
//! Start at a stepcount >0 (used w. convert-tpr)
- gmx_int64_t init_step;
+ int64_t init_step;
//! Frequency of energy calc. and T/P coupl. upd.
int nstcalcenergy;
//! Group or verlet cutoffs
//! Friction coefficient for BD (amu/ps)
real bd_fric;
//! Random seed for SD and BD
- gmx_int64_t ld_seed;
+ int64_t ld_seed;
//! The number of walls
int nwall;
//! The type of walls
* Int64OptionStorage
*/
-std::string Int64OptionStorage::formatSingleValue(const gmx_int64_t &value) const
+std::string Int64OptionStorage::formatSingleValue(const int64_t &value) const
{
return toString(value);
}
void Int64OptionStorage::initConverter(ConverterType *converter)
{
- converter->addConverter<std::string>(&fromStdString<gmx_int64_t>);
+ converter->addConverter<std::string>(&fromStdString<int64_t>);
}
/********************************************************************
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* \inpublicapi
*/
-class Int64Option : public OptionTemplate<gmx_int64_t, Int64Option>
+class Int64Option : public OptionTemplate<int64_t, Int64Option>
{
public:
//! OptionInfo subclass corresponding to this option type.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \internal \brief
* Converts, validates, and stores integer values.
*/
-class Int64OptionStorage : public OptionStorageTemplateSimple<gmx_int64_t>
+class Int64OptionStorage : public OptionStorageTemplateSimple<int64_t>
{
public:
//! \copydoc BooleanOptionStorage::BooleanOptionStorage()
virtual OptionInfo &optionInfo() { return info_; }
virtual std::string typeString() const { return "int"; }
- virtual std::string formatSingleValue(const gmx_int64_t &value) const;
+ virtual std::string formatSingleValue(const int64_t &value) const;
private:
virtual void initConverter(ConverterType *converter);
fprintf(out, "\n");
}
-void pull_print_output(struct pull_t *pull, gmx_int64_t step, double time)
+void pull_print_output(struct pull_t *pull, int64_t step, double time)
{
GMX_ASSERT(pull->numExternalPotentialsStillToBeAppliedThisStep == 0, "pull_print_output called before all external pull potentials have been applied");
* if they needed to participate up to 20 decompositions ago.
* This avoids frequent rebuilds due to atoms jumping back and forth.
*/
- const gmx_int64_t history_count = 20;
+ const int64_t history_count = 20;
gmx_bool bWillParticipate;
int count[2];
* \param step Time step number.
* \param time Time.
*/
-void pull_print_output(struct pull_t *pull, gmx_int64_t step, double time);
+void pull_print_output(struct pull_t *pull, int64_t step, double time);
/*! \brief Calculates centers of mass all pull groups.
int nparticipate; /* The number of ranks participating */
bool isMasterRank; /* Tells whether our rank is the master rank and thus should add the pull virial */
- gmx_int64_t setup_count; /* The number of decomposition calls */
- gmx_int64_t must_count; /* The last count our rank needed to be part */
+ int64_t setup_count; /* The number of decomposition calls */
+ int64_t must_count; /* The last count our rank needed to be part */
rvec *rbuf; /* COM calculation buffer */
dvec *dbuf; /* COM calculation buffer */
/* Reduce potential angle fit data for this group at this time step? */
-static inline gmx_bool bPotAngle(const gmx_enfrot *er, const t_rotgrp *rotg, gmx_int64_t step)
+static inline gmx_bool bPotAngle(const gmx_enfrot *er, const t_rotgrp *rotg, int64_t step)
{
return ( (erotgFitPOT == rotg->eFittype) && (do_per_step(step, er->nstsout) || do_per_step(step, er->nstrout)) );
}
/* Reduce slab torqe data for this group at this time step? */
-static inline gmx_bool bSlabTau(const gmx_enfrot *er, const t_rotgrp *rotg, gmx_int64_t step)
+static inline gmx_bool bSlabTau(const gmx_enfrot *er, const t_rotgrp *rotg, int64_t step)
{
return ( (ISFLEX(rotg)) && do_per_step(step, er->nstsout) );
}
/* Output rotation energy, torques, etc. for each rotation group */
static void reduce_output(const t_commrec *cr,
- gmx_enfrot *er, real t, gmx_int64_t step)
+ gmx_enfrot *er, real t, int64_t step)
{
int i, islab, nslabs = 0;
int count; /* MPI element counter */
/* Add the forces from enforced rotation potential to the local forces.
* Should be called after the SR forces have been evaluated */
real add_rot_forces(gmx_enfrot *er,
- rvec f[], const t_commrec *cr, gmx_int64_t step, real t)
+ rvec f[], const t_commrec *cr, int64_t step, real t)
{
real Vrot = 0.0; /* If more than one rotation group is present, Vrot
assembles the local parts from all groups */
matrix box,
rvec x[],
real t,
- gmx_int64_t step,
+ int64_t step,
gmx_bool bNS)
{
gmx_bool outstep_slab, outstep_rot;
matrix box,
rvec x[],
real t,
- gmx_int64_t step,
+ int64_t step,
gmx_bool bNS);
* \returns The potential energy of the rotation potentials.
*/
real add_rot_forces(gmx_enfrot *er,
- rvec f[], const t_commrec *cr, gmx_int64_t step, real t);
+ rvec f[], const t_commrec *cr, int64_t step, real t);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
namespace gmx
{
-gmx_uint64_t
+uint64_t
makeRandomSeed()
{
std::random_device rd;
- gmx_uint64_t result;
+ uint64_t result;
std::size_t deviceBits = std::numeric_limits<std::random_device::result_type>::digits;
- std::size_t resultBits = std::numeric_limits<gmx_uint64_t>::digits;
+ std::size_t resultBits = std::numeric_limits<uint64_t>::digits;
- result = static_cast<gmx_uint64_t>(rd());
+ result = static_cast<uint64_t>(rd());
for (std::size_t bits = deviceBits; bits < resultBits; bits += deviceBits)
{
- result = (result << deviceBits) | static_cast<gmx_uint64_t>(rd());
+ result = (result << deviceBits) | static_cast<uint64_t>(rd());
}
return result;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* \return 64-bit unsigned integer with random bits.
*/
-gmx_uint64_t
+uint64_t
makeRandomSeed();
/*! \brief Random device
// also avoids drawing multiple 32-bit random numbers
// even if we just call this routine for a single
// result.
- savedRandomBits_ = static_cast<gmx_uint64_t>(g());
+ savedRandomBits_ = static_cast<uint64_t>(g());
savedRandomBitsLeft_ = std::numeric_limits<typename Rng::result_type>::digits;
}
result_type value = c_table_[savedRandomBits_ & ( (1ULL << tableBits) - 1 ) ];
/*! \brief Array with tabluated values of normal distribution */
static const std::array<RealType, 1 << tableBits> c_table_;
/*! \brief Saved output from random engine, shifted tableBits right each time */
- gmx_uint64_t savedRandomBits_;
+ uint64_t savedRandomBits_;
/*! \brief Number of valid bits remaining i savedRandomBits_ */
unsigned int savedRandomBitsLeft_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// if you execute the unit tests once per second you might have to run them
// an extra time rougly once per 300 billion years - apologies in advance!
- gmx_uint64_t i0 = makeRandomSeed();
- gmx_uint64_t i1 = makeRandomSeed();
+ uint64_t i0 = makeRandomSeed();
+ uint64_t i1 = makeRandomSeed();
EXPECT_NE(i0, i1);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
namespace
{
-class ThreeFry2x64Test : public ::testing::TestWithParam<std::vector<gmx_uint64_t> >
+class ThreeFry2x64Test : public ::testing::TestWithParam<std::vector<uint64_t> >
{
};
{
gmx::test::TestReferenceData data;
gmx::test::TestReferenceChecker checker(data.rootChecker());
- const std::vector<gmx_uint64_t> input = GetParam();
- std::vector<gmx_uint64_t> result;
+ const std::vector<uint64_t> input = GetParam();
+ std::vector<uint64_t> result;
gmx::ThreeFry2x64<0> rng(input[2], input[3]);
rng.restart(input[0], input[1]);
{
gmx::test::TestReferenceData data;
gmx::test::TestReferenceChecker checker(data.rootChecker());
- const std::vector<gmx_uint64_t> input = GetParam();
- std::vector<gmx_uint64_t> result;
+ const std::vector<uint64_t> input = GetParam();
+ std::vector<uint64_t> result;
gmx::ThreeFry2x64Fast<0> rng(input[2], input[3]);
rng.restart(input[0], input[1]);
{
gmx::test::TestReferenceData data;
gmx::test::TestReferenceChecker checker(data.rootChecker());
- const std::vector<gmx_uint64_t> input = GetParam();
- std::vector<gmx_uint64_t> result;
+ const std::vector<uint64_t> input = GetParam();
+ std::vector<uint64_t> result;
gmx::ThreeFry2x64General<40, 0> rng(input[2], input[3]);
rng.restart(input[0], input[1]);
* The 2x64 flavors of ThreeFry64 will use the first four values, while
* the 4x64 version uses all eight.
*/
-const std::vector<gmx_uint64_t> bitsZero {{
- 0, 0, 0, 0
- }};
+const std::vector<uint64_t> bitsZero {{
+ 0, 0, 0, 0
+ }};
/*! \brief Constant array of integers with all bits set to one.
* The 2x64 flavors of ThreeFry64 will use the first four values, while
* the 4x64 version uses all eight.
*/
-const std::vector<gmx_uint64_t> bitsOne {{
- 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
- 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL
- }};
+const std::vector<uint64_t> bitsOne {{
+ 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL,
+ 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL
+ }};
/*! \brief Constant array of integers with bitpattern from Pi.
*
* The 2x64 flavors of ThreeFry64 will use the first four values, while
* the 4x64 version uses all eight.
*/
-const std::vector<gmx_uint64_t> bitsPi {{
- 0x243f6a8885a308d3ULL, 0x13198a2e03707344ULL,
- 0xa4093822299f31d0ULL, 0x082efa98ec4e6c89ULL
- }};
+const std::vector<uint64_t> bitsPi {{
+ 0x243f6a8885a308d3ULL, 0x13198a2e03707344ULL,
+ 0xa4093822299f31d0ULL, 0x082efa98ec4e6c89ULL
+ }};
// Test the known ansers for the ThreeFry random function when the argument
// is (1) all zero, (2) all ones, (3) the bits of pi, for a bunch of different flavors of ThreeFry.
// 66 bits of internal counter means the first four increments (giving 2*4=8 results)
// correspond to incrementing word 0, and then we should carry over to word 1.
gmx::ThreeFry2x64<66> rngA(123456, gmx::RandomDomain::Other);
- std::vector<gmx_uint64_t> result;
+ std::vector<uint64_t> result;
for (int i = 0; i < 16; i++)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
// result_type must be lower case to be compatible with C++11 standard library
/*! \brief Integer type for output. */
- typedef gmx_uint64_t result_type;
+ typedef uint64_t result_type;
/*! \brief Use array for counter & key states so it is allocated on the stack */
typedef std::array<result_type, 2> counter_type;
* \throws InternalError if the high bits needed to encode the number of counter
* bits are nonzero.
*/
- ThreeFry2x64General(gmx_uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other)
+ ThreeFry2x64General(uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other)
{
seed(key0, domain);
}
* \throws InternalError if the high bits needed to encode the number of counter
* bits are nonzero. To test arbitrary values, use 0 internal counter bits.
*/
- ThreeFry2x64General(gmx_uint64_t key0, gmx_uint64_t key1)
+ ThreeFry2x64General(uint64_t key0, uint64_t key1)
{
seed(key0, key1);
}
* when using e.g. a random device, we just ignore them.
*/
void
- seed(gmx_uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other)
+ seed(uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other)
{
- seed(key0, static_cast<gmx_uint64_t>(domain));
+ seed(key0, static_cast<uint64_t>(domain));
}
/*! \brief Seed random engine from 2x64-bit unsigned integers
* bits are nonzero. To test arbitrary values, use 0 internal counter bits.
*/
void
- seed(gmx_uint64_t key0, gmx_uint64_t key1)
+ seed(uint64_t key0, uint64_t key1)
{
const unsigned int internalCounterBitsBits = (internalCounterBits > 0) ? ( StaticLog2<internalCounterBits>::value + 1 ) : 0;
* reserved bits is to the last template parameter to the class.
*/
void
- restart(gmx_uint64_t ctr0 = 0, gmx_uint64_t ctr1 = 0)
+ restart(uint64_t ctr0 = 0, uint64_t ctr1 = 0)
{
counter_ = {{ctr0, ctr1}};
* \throws InternalError if the internal counter space is exhausted.
*/
void
- discard(gmx_uint64_t n)
+ discard(uint64_t n)
{
index_ += n % c_resultsPerCounter_;
n /= c_resultsPerCounter_;
* \throws InternalError if the high bits needed to encode the number of counter
* bits are nonzero.
*/
- ThreeFry2x64(gmx_uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other) : ThreeFry2x64General<20, internalCounterBits>(key0, domain) {}
+ ThreeFry2x64(uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other) : ThreeFry2x64General<20, internalCounterBits>(key0, domain) {}
/*! \brief Construct random engine from 2x64-bit unsigned integers, 20 rounds
*
* \throws InternalError if the high bits needed to encode the number of counter
* bits are nonzero. To test arbitrary values, use 0 internal counter bits.
*/
- ThreeFry2x64(gmx_uint64_t key0, gmx_uint64_t key1) : ThreeFry2x64General<20, internalCounterBits>(key0, key1) {}
+ ThreeFry2x64(uint64_t key0, uint64_t key1) : ThreeFry2x64General<20, internalCounterBits>(key0, key1) {}
};
/*! \brief ThreeFry2x64 random engine with 13 iteractions.
* \throws InternalError if the high bits needed to encode the number of counter
* bits are nonzero.
*/
- ThreeFry2x64Fast(gmx_uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other) : ThreeFry2x64General<13, internalCounterBits>(key0, domain) {}
+ ThreeFry2x64Fast(uint64_t key0 = 0, RandomDomain domain = RandomDomain::Other) : ThreeFry2x64General<13, internalCounterBits>(key0, domain) {}
/*! \brief Construct ThreeFry random engine from 2x64-bit unsigned integers, 13 rounds.
*
* \throws InternalError if the high bits needed to encode the number of counter
* bits are nonzero. To test arbitrary values, use 0 internal counter bits.
*/
- ThreeFry2x64Fast(gmx_uint64_t key0, gmx_uint64_t key1) : ThreeFry2x64General<13, internalCounterBits>(key0, key1) {}
+ ThreeFry2x64Fast(uint64_t key0, uint64_t key1) : ThreeFry2x64General<13, internalCounterBits>(key0, key1) {}
};
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
result_type
operator()(Rng &g, const param_type ¶m)
{
- static_assert(sizeof(typename Rng::result_type) >= sizeof(gmx_uint32_t),
+ static_assert(sizeof(typename Rng::result_type) >= sizeof(uint32_t),
"The random engine result_type should be 32 or 64 bits");
result_type range = param.b() - param.a();
}
else
{
- if (sizeof(result_type) == sizeof(gmx_uint32_t))
+ if (sizeof(result_type) == sizeof(uint32_t))
{
- rangeBits = log2I(static_cast<gmx_uint32_t>(range));
+ rangeBits = log2I(static_cast<uint32_t>(range));
}
else
{
{
if (savedRandomBitsLeft_ < rangeBits)
{
- savedRandomBits_ = static_cast<gmx_uint64_t>(g());
+ savedRandomBits_ = static_cast<uint64_t>(g());
savedRandomBitsLeft_ = std::numeric_limits<typename Rng::result_type>::digits;
- if (sizeof(typename Rng::result_type) == sizeof(gmx_uint32_t))
+ if (sizeof(typename Rng::result_type) == sizeof(uint32_t))
{
- savedRandomBits_ <<= std::numeric_limits<gmx_uint32_t>::digits;
+ savedRandomBits_ <<= std::numeric_limits<uint32_t>::digits;
savedRandomBits_ |= g();
- savedRandomBitsLeft_ += std::numeric_limits<gmx_uint32_t>::digits;
+ savedRandomBitsLeft_ += std::numeric_limits<uint32_t>::digits;
}
}
result = savedRandomBits_;
/*! \brief Internal value for parameters, can be overridden at generation time. */
param_type param_;
/*! \brief Saved output from random engine, shifted tableBits right each time */
- gmx_uint64_t savedRandomBits_;
+ uint64_t savedRandomBits_;
/*! \brief Number of valid bits remaining i savedRandomBits_ */
unsigned int savedRandomBitsLeft_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
generateCanonical(Rng &g)
{
// No point in using more bits than fit in RealType
- const gmx_uint64_t digits = std::numeric_limits<RealType>::digits;
- const gmx_uint64_t realBits = std::min(digits, static_cast<gmx_uint64_t>(Bits));
- const gmx_uint64_t range = Rng::max() - Rng::min() + gmx_uint64_t(1);
- gmx_uint64_t log2R = (range == 0) ? std::numeric_limits<gmx_uint64_t>::digits : log2I(range);
- gmx_uint64_t k = realBits / log2R + (realBits % log2R != 0) + (realBits == 0);
+ const uint64_t digits = std::numeric_limits<RealType>::digits;
+ const uint64_t realBits = std::min(digits, static_cast<uint64_t>(Bits));
+ const uint64_t range = Rng::max() - Rng::min() + uint64_t(1);
+ uint64_t log2R = (range == 0) ? std::numeric_limits<uint64_t>::digits : log2I(range);
+ uint64_t k = realBits / log2R + (realBits % log2R != 0) + (realBits == 0);
RealType r = Rng::max() - Rng::min() + RealType(1);
RealType s = g() - Rng::min();
RealType base = r;
RealType result;
- for (gmx_uint64_t i = 1; i < k; ++i)
+ for (uint64_t i = 1; i < k; ++i)
{
s += RealType(g()-Rng::min()) * base;
base *= r;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
typedef std::vector<TestPosition> TestPositionList;
- NeighborhoodSearchTestData(gmx_uint64_t seed, real cutoff);
+ NeighborhoodSearchTestData(uint64_t seed, real cutoff);
gmx::AnalysisNeighborhoodPositions refPositions() const
{
testPositions_.emplace_back(x);
}
gmx::RVec generateRandomPosition();
- std::vector<int> generateIndex(int count, gmx_uint64_t seed) const;
+ std::vector<int> generateIndex(int count, uint64_t seed) const;
void generateRandomRefPositions(int count);
void generateRandomTestPositions(int count);
void useRefPositionsAsTestPositions();
//! Shorthand for a collection of reference pairs.
typedef std::vector<NeighborhoodSearchTestData::RefPair> RefPairList;
-NeighborhoodSearchTestData::NeighborhoodSearchTestData(gmx_uint64_t seed, real cutoff)
+NeighborhoodSearchTestData::NeighborhoodSearchTestData(uint64_t seed, real cutoff)
: rng_(seed), cutoff_(cutoff), refPosCount_(0)
{
clear_mat(box_);
return x;
}
-std::vector<int> NeighborhoodSearchTestData::generateIndex(int count, gmx_uint64_t seed) const
+std::vector<int> NeighborhoodSearchTestData::generateIndex(int count, uint64_t seed) const
{
gmx::DefaultRandomEngine rngIndex(seed);
gmx::UniformRealDistribution<real> dist;
const NeighborhoodSearchTestData &data);
void testPairSearchIndexed(gmx::AnalysisNeighborhood *nb,
const NeighborhoodSearchTestData &data,
- gmx_uint64_t seed);
+ uint64_t seed);
void testPairSearchFull(gmx::AnalysisNeighborhoodSearch *search,
const NeighborhoodSearchTestData &data,
const gmx::AnalysisNeighborhoodPositions &pos,
void NeighborhoodSearchTest::testPairSearchIndexed(
gmx::AnalysisNeighborhood *nb,
const NeighborhoodSearchTestData &data,
- gmx_uint64_t seed)
+ uint64_t seed)
{
std::vector<int> refIndices(data.generateIndex(data.refPos_.size(), seed++));
std::vector<int> testIndices(data.generateIndex(data.testPositions_.size(), seed++));
t_swapcoords *sc,
real cyl0_r2,
real cyl1_r2,
- gmx_int64_t step,
+ int64_t step,
gmx_bool bRerun,
FILE *fpout)
{
t_commrec *cr,
t_swapcoords *sc,
const matrix box,
- gmx_int64_t step,
+ int64_t step,
FILE *fpout,
gmx_bool bRerun,
gmx_bool bIsSolvent)
{
fprintf(stderr, "\n"
"%s Warning: %d atoms were detected as being in both channels! Probably your split\n"
- "%s cylinder is way too large, or one compartment has collapsed (step %" GMX_PRId64 ")\n",
+ "%s cylinder is way too large, or one compartment has collapsed (step %" PRId64 ")\n",
SwS, g->nCylBoth, SwS, step);
fprintf(s->fpout, "Warning: %d atoms were assigned to both channels!\n", g->nCylBoth);
gmx_bool do_swapcoords(
t_commrec *cr,
- gmx_int64_t step,
+ int64_t step,
double t,
t_inputrec *ir,
gmx_wallcycle *wcycle,
if (nswaps && bVerbose)
{
- fprintf(stderr, "%s Performed %d swap%s in step %" GMX_PRId64 " for iontype %s.\n",
+ fprintf(stderr, "%s Performed %d swap%s in step %" PRId64 " for iontype %s.\n",
SwS, nswaps, nswaps > 1 ? "s" : "", step, g->molname);
}
}
*/
gmx_bool do_swapcoords(
t_commrec *cr,
- gmx_int64_t step,
+ int64_t step,
double t,
t_inputrec *ir,
gmx_wallcycle *wcycle,
#endif
int ewc_prev;
gmx_cycles_t cycle_prev;
- gmx_int64_t reset_counters;
+ int64_t reset_counters;
#if GMX_MPI
MPI_Comm mpi_comm_mygroup;
#endif
}
}
-extern gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc)
+extern int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc)
{
if (wc == nullptr)
{
return wc->reset_counters;
}
-extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_counters)
+extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, int64_t reset_counters)
{
if (wc == nullptr)
{
void wallcycle_scale_by_num_threads(gmx_wallcycle_t wc, bool isPmeRank, int nthreads_pp, int nthreads_pme);
/* Scale the cycle counts to reflect how many threads run for that number of cycles */
-gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc);
+int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc);
/* Return reset_counters from wc struct */
-void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_counters);
+void wcycle_set_reset_counters(gmx_wallcycle_t wc, int64_t reset_counters);
/* Set reset_counters */
void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs);
* with respect to parallelism implementation. */
int numOpenMPThreads;
//! Set by integrators to report the amount of work they did
- gmx_int64_t nsteps_done;
+ int64_t nsteps_done;
//! Whether the simulation has finished in a way valid for walltime reporting.
bool isValidFinish;
} t_gmx_walltime_accounting;
return walltime_accounting->start_time_stamp;
}
-gmx_int64_t
+int64_t
walltime_accounting_get_nsteps_done(gmx_walltime_accounting_t walltime_accounting)
{
return walltime_accounting->nsteps_done;
void
walltime_accounting_set_nsteps_done(gmx_walltime_accounting_t walltime_accounting,
- gmx_int64_t nsteps_done)
+ int64_t nsteps_done)
{
walltime_accounting->nsteps_done = nsteps_done;
}
walltime_accounting_get_start_time_stamp(gmx_walltime_accounting_t walltime_accounting);
//! Get the number of integration steps done
-gmx_int64_t
+int64_t
walltime_accounting_get_nsteps_done(gmx_walltime_accounting_t walltime_accounting);
/*! \brief Set the number of integration steps done
* TODO consider whether this should get done in walltime_accounting_end */
void
walltime_accounting_set_nsteps_done(gmx_walltime_accounting_t walltime_accounting,
- gmx_int64_t nsteps_done);
+ int64_t nsteps_done);
//! Record that the simulation finished in a way valid for reporting walltime.
void
const char *top_fn;
int i;
- gmx_int64_t nsteps_req, run_step;
+ int64_t nsteps_req, run_step;
double run_t, state_t;
gmx_bool bSel;
gmx_bool bNsteps, bExtend, bUntil;
return 0;
}
- /* Convert int to gmx_int64_t */
+ /* Convert int to int64_t */
nsteps_req = nsteps_req_int;
bNsteps = opt2parg_bSet("-nsteps", asize(pa), pa);
bExtend = opt2parg_bSet("-extend", asize(pa), pa);
/* Determine total number of steps remaining */
if (bExtend)
{
- ir->nsteps = ir->nsteps - (run_step - ir->init_step) + (gmx_int64_t)(extend_t/ir->delta_t + 0.5);
+ ir->nsteps = ir->nsteps - (run_step - ir->init_step) + (int64_t)(extend_t/ir->delta_t + 0.5);
printf("Extending remaining runtime of by %g ps (now %s steps)\n",
extend_t, gmx_step_str(ir->nsteps, buf));
}
gmx_step_str(ir->nsteps, buf),
gmx_step_str(run_step, buf2),
run_t, until_t);
- ir->nsteps = (gmx_int64_t)((until_t - run_t)/ir->delta_t + 0.5);
+ ir->nsteps = (int64_t)((until_t - run_t)/ir->delta_t + 0.5);
printf("Extending remaining runtime until %g ps (now %s steps)\n",
until_t, gmx_step_str(ir->nsteps, buf));
}
}
state_t = ir->init_t + ir->init_step*ir->delta_t;
- sprintf(buf, "Writing statusfile with starting step %s%s and length %s%s steps...\n", "%10", GMX_PRId64, "%10", GMX_PRId64);
+ sprintf(buf, "Writing statusfile with starting step %s%s and length %s%s steps...\n", "%10", PRId64, "%10", PRId64);
fprintf(stderr, buf, ir->init_step, ir->nsteps);
fprintf(stderr, " time %10.3f and length %10.3f ps\n",
state_t, ir->nsteps*ir->delta_t);
indent = 0;
indent = pr_title(stdout, indent, buf);
pr_indent(stdout, indent);
- fprintf(stdout, "natoms=%10d step=%10" GMX_PRId64 " time=%12.7e lambda=%10g\n",
+ fprintf(stdout, "natoms=%10d step=%10" PRId64 " time=%12.7e lambda=%10g\n",
trrheader.natoms, trrheader.step, trrheader.t, trrheader.lambda);
if (trrheader.box_size)
{
rvec *x;
matrix box;
int nframe, natoms;
- gmx_int64_t step;
+ int64_t step;
real prec, time;
gmx_bool bOK;
indent = 0;
indent = pr_title(stdout, indent, buf);
pr_indent(stdout, indent);
- fprintf(stdout, "natoms=%10d step=%10" GMX_PRId64 " time=%12.7e prec=%10g\n",
+ fprintf(stdout, "natoms=%10d step=%10" PRId64 " time=%12.7e prec=%10g\n",
natoms, step, time, prec);
pr_rvecs(stdout, indent, "box", box, DIM);
pr_rvecs(stdout, indent, "x", x, natoms);
static void list_tng_inner(const char *fn,
gmx_bool bFirstFrame,
real *values,
- gmx_int64_t step,
+ int64_t step,
double frame_time,
- gmx_int64_t n_values_per_frame,
- gmx_int64_t n_atoms,
+ int64_t n_values_per_frame,
+ int64_t n_atoms,
real prec,
- gmx_int64_t nframe,
+ int64_t nframe,
char *block_name)
{
char buf[256];
if (bFirstFrame)
{
- sprintf(buf, "%s frame %" GMX_PRId64, fn, nframe);
+ sprintf(buf, "%s frame %" PRId64, fn, nframe);
indent = 0;
indent = pr_title(stdout, indent, buf);
pr_indent(stdout, indent);
- fprintf(stdout, "natoms=%10" GMX_PRId64 " step=%10" GMX_PRId64 " time=%12.7e",
+ fprintf(stdout, "natoms=%10" PRId64 " step=%10" PRId64 " time=%12.7e",
n_atoms, step, frame_time);
if (prec > 0)
{
{
#ifdef GMX_USE_TNG
gmx_tng_trajectory_t tng;
- gmx_int64_t nframe = 0;
- gmx_int64_t i, *block_ids = nullptr, step, ndatablocks;
+ int64_t nframe = 0;
+ int64_t i, *block_ids = nullptr, step, ndatablocks;
gmx_bool bOK;
real *values = nullptr;
{
double frame_time;
real prec;
- gmx_int64_t n_values_per_frame, n_atoms;
+ int64_t n_values_per_frame, n_atoms;
char block_name[STRLEN];
gmx_get_tng_data_next_frame_of_block_type(tng, block_ids[i], &values,
std::string EnergyFrame::frameName() const
{
- return formatString("Time %f Step %" GMX_PRId64, time_, step_);
+ return formatString("Time %f Step %" PRId64, time_, step_);
}
const real &EnergyFrame::at(const std::string &name) const
struct t_enxframe
{
double t; /* Timestamp of this frame */
- gmx_int64_t step; /* MD step */
- gmx_int64_t nsteps; /* The number of steps between frames */
+ int64_t step; /* MD step */
+ int64_t nsteps; /* The number of steps between frames */
double dt; /* The MD time step */
int nsum; /* The number of terms for the sums in ener */
int nre; /* Number of energies */
std::string TrajectoryFrame::frameName() const
{
- return formatString("Time %f Step %" GMX_PRId64, frame_.time, frame_.step);
+ return formatString("Time %f Step %" PRId64, frame_.time, frame_.step);
}
std::int64_t TrajectoryFrame::step() const
gmx_bool bDouble; /* Double precision? */
int natoms; /* number of atoms (atoms, x, v, f, index) */
gmx_bool bStep;
- gmx_int64_t step; /* MD step number */
+ int64_t step; /* MD step number */
gmx_bool bTime;
real time; /* time of the frame */
gmx_bool bLambda;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* <H3>Implementation helpers</H3>
*
* The header basedefinitions.h contains common definitions and macros used
- * throughout \Gromacs. It includes fixed-width integer types (`gmx_int64_t`
- * and friends), `gmx_bool` for C code, some macros for compiler-specific
- * attributes, and ::GMX_UNUSED_VALUE and ::GMX_IGNORE_RETURN_VALUE for
- * handling warnings about unused values.
+ * throughout \Gromacs. It includes `gmx_bool` for C code, some macros for
+ * compiler-specific attributes, and ::GMX_UNUSED_VALUE and ::GMX_IGNORE_RETURN_VALUE
+ * for handling warnings about unused values.
*
* The header classhelpers.h implements a gmx::PrivateImplPointer template for easily
* writing classes that use the private implementation idiom. This header also
#define GMX_UTILITY_BASEDEFINITIONS_H
#include <stdint.h>
-#ifndef _MSC_VER
-#include <inttypes.h>
-#endif
#if defined __cplusplus
+#include <cinttypes>
#include <cstddef>
#else
#include <stdbool.h>
}
#endif
-/*! \name Fixed-width integer types
- *
- * These types and macros provide the equivalent of 32- and 64-bit integer
- * types from C99 headers `stdint.h` and `inttypes.h`. These headers are also
- * there in C++11. The types and macros from here should be used instead of
- * `int32_t` etc.
- *
- * (MSVC 2015 still doesn't support the format strings.)
- */
-/*! \{ */
-typedef int32_t gmx_int32_t;
-typedef int64_t gmx_int64_t;
-typedef uint32_t gmx_uint32_t;
-typedef uint64_t gmx_uint64_t;
-
-#ifdef _MSC_VER
-#define GMX_PRId32 "I32d"
-#define GMX_SCNd32 "I32d"
-
-#define GMX_PRId64 "I64d"
-#define GMX_SCNd64 "I64d"
-
-#define GMX_PRIu32 "I32u"
-#define GMX_SCNu32 "I32u"
-
-#define GMX_PRIu64 "I64u"
-#define GMX_SCNu64 "I64u"
-#else
-#define GMX_PRId32 PRId32
-#define GMX_SCNd32 SCNd32
-
-#define GMX_PRId64 PRId64
-#define GMX_SCNd64 SCNd64
-
-#define GMX_PRIu32 PRIu32
-#define GMX_SCNu32 SCNu32
-
-#define GMX_PRIu64 PRIu64
-#define GMX_SCNu64 SCNu64
-#endif
-
-#define GMX_INT32_MAX INT32_MAX
-#define GMX_INT32_MIN INT32_MIN
-
-#define GMX_INT64_MAX INT64_MAX
-#define GMX_INT64_MIN INT64_MIN
-
-#define GMX_UINT32_MAX UINT32_MAX
-#define GMX_UINT32_MIN UINT32_MIN
-
-#define GMX_UINT64_MAX UINT64_MAX
-#define GMX_UINT64_MIN UINT64_MIN
-/*! \} */
-
/* ICC, GCC, MSVC, Pathscale, PGI, XLC support __restrict.
* Any other compiler can be added here. */
/*! \brief
#if BITMASK_SIZE <= 64 || defined DOXYGEN
#if BITMASK_SIZE == 32
-typedef gmx_uint32_t gmx_bitmask_t;
+typedef uint32_t gmx_bitmask_t;
#else
-typedef gmx_uint64_t gmx_bitmask_t; /**< bitmask type */
+typedef uint64_t gmx_bitmask_t; /**< bitmask type */
#endif
/*! \brief Initialize all bits to 0 */
}
#else
#define BITMASK_ALEN (BITMASK_SIZE/64)
-typedef gmx_uint64_t gmx_bitmask_t[BITMASK_ALEN];
+typedef uint64_t gmx_bitmask_t[BITMASK_ALEN];
inline static void bitmask_clear(gmx_bitmask_t* m)
{
inline static void bitmask_set_bit(gmx_bitmask_t* m, int b)
{
- (*m)[b/64] |= ((gmx_uint64_t)1 << (b%64));
+ (*m)[b/64] |= ((uint64_t)1 << (b%64));
}
inline static void bitmask_init_bit(gmx_bitmask_t* m, int b)
{
bitmask_clear(m);
- (*m)[b/64] = ((gmx_uint64_t)1 << (b%64));
+ (*m)[b/64] = ((uint64_t)1 << (b%64));
}
inline static void bitmask_init_low_bits(gmx_bitmask_t* m, int b)
{
memset(*m, 255, b/64*8);
- (*m)[b/64] = ((gmx_uint64_t)1 << (b%64)) - 1;
+ (*m)[b/64] = ((uint64_t)1 << (b%64)) - 1;
memset(&(*m)[b/64+1], 0, (BITMASK_ALEN-b/64-1)*8);
}
inline static bool bitmask_is_set(gmx_bitmask_t m, int b)
{
- return (m[b/64] & ((gmx_uint64_t)1 << (b%64))) != 0;
+ return (m[b/64] & ((uint64_t)1 << (b%64))) != 0;
}
inline static bool bitmask_is_disjoint(gmx_bitmask_t a, gmx_bitmask_t b)
}
}
-void cmp_int64(FILE *fp, const char *s, gmx_int64_t i1, gmx_int64_t i2)
+void cmp_int64(FILE *fp, const char *s, int64_t i1, int64_t i2)
{
if (i1 != i2)
{
fprintf(fp, "%s (", s);
- fprintf(fp, "%" GMX_PRId64, i1);
+ fprintf(fp, "%" PRId64, i1);
fprintf(fp, " - ");
- fprintf(fp, "%" GMX_PRId64, i2);
+ fprintf(fp, "%" PRId64, i2);
fprintf(fp, ")\n");
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void cmp_int(FILE *fp, const char *s, int index, int i1, int i2);
//! Compares two 64-bit integers and prints differences.
-void cmp_int64(FILE *fp, const char *s, gmx_int64_t i1, gmx_int64_t i2);
+void cmp_int64(FILE *fp, const char *s, int64_t i1, int64_t i2);
//! Compares two unsigned short values and prints differences.
void cmp_us(FILE *fp, const char *s, int index, unsigned short i1, unsigned short i2);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return b2;
}
-gmx_int64_t
+int64_t
str_to_int64_t(const char *str, char **endptr)
{
#ifndef _MSC_VER
#endif
}
-char *gmx_step_str(gmx_int64_t i, char *buf)
+char *gmx_step_str(int64_t i, char *buf)
{
- sprintf(buf, "%" GMX_PRId64, i);
+ sprintf(buf, "%" PRId64, i);
return buf;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx_bool bIndentFirst);
/*! \brief
- * Convert a string to gmx_int64_t.
+ * Convert a string to int64_t.
*
* This method works as the standard library function strtol(), except that it
* does not support different bases.
*/
-gmx_int64_t str_to_int64_t(const char *str, char **endptr);
+int64_t str_to_int64_t(const char *str, char **endptr);
/** Minimum size of buffer to pass to gmx_step_str(). */
#define STEPSTRSIZE 22
/*! \brief
- * Prints a gmx_int64_t value in buf and returns the pointer to buf.
+ * Prints a int64_t value in buf and returns the pointer to buf.
*
* buf should be large enough to contain i: STEPSTRSIZE (22) chars.
- * When multiple gmx_int64_t values are printed in the same printf call,
+ * When multiple int64_t values are printed in the same printf call,
* be sure to call gmx_step_str with different buffers.
*/
-char *gmx_step_str(gmx_int64_t i, char *buf);
+char *gmx_step_str(int64_t i, char *buf);
#ifdef __cplusplus
}
#endif
/** \Gromacs definition to use instead of `off_t`. */
-typedef gmx_int64_t gmx_off_t;
+typedef int64_t gmx_off_t;
/*! \brief
* Turn off buffering for output files (which is default) for debugging
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
impl_->doValue(*value);
}
-void InMemorySerializer::doInt64(gmx_int64_t *value)
+void InMemorySerializer::doInt64(int64_t *value)
{
impl_->doValue(*value);
}
impl_->doValue(value);
}
-void InMemoryDeserializer::doInt64(gmx_int64_t *value)
+void InMemoryDeserializer::doInt64(int64_t *value)
{
impl_->doValue(value);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
virtual void doBool(bool *value);
virtual void doUChar(unsigned char *value);
virtual void doInt(int *value);
- virtual void doInt64(gmx_int64_t *value);
+ virtual void doInt64(int64_t *value);
virtual void doFloat(float *value);
virtual void doDouble(double *value);
virtual void doString(std::string *value);
virtual void doBool(bool *value);
virtual void doUChar(unsigned char *value);
virtual void doInt(int *value);
- virtual void doInt64(gmx_int64_t *value);
+ virtual void doInt64(int64_t *value);
virtual void doFloat(float *value);
virtual void doDouble(double *value);
virtual void doString(std::string *value);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/basedefinitions.h"
-int gmx_int64_to_int(gmx_int64_t step, const char *warn)
+int int64_to_int(int64_t step, const char *warn)
{
int i;
i = static_cast<int>(step);
- if (warn != nullptr && (static_cast<gmx_int64_t>(i) != step))
+ if (warn != nullptr && (static_cast<int64_t>(i) != step))
{
fprintf(stderr, "\nWARNING during %s:\n", warn);
fprintf(stderr, "int64 value ");
- fprintf(stderr, "%" GMX_PRId64, step);
+ fprintf(stderr, "%" PRId64, step);
fprintf(stderr, " does not fit in int, converted to %d\n\n", i);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/futil.h"
-/*! \brief Convert a gmx_int64_t value to int.
+/*! \brief Convert a int64_t value to int.
*
* \param[in] step The step number (or other int64)
* \param[in] warn If warn!=NULL a warning message will be written
* "WARNING during %s:", where warn is printed in %s.
* \return the truncated step number.
*/
-int gmx_int64_to_int(gmx_int64_t step, const char *warn);
+int int64_to_int(int64_t step, const char *warn);
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
virtual void doBool(bool *value) = 0;
virtual void doUChar(unsigned char *value) = 0;
virtual void doInt(int *value) = 0;
- virtual void doInt64(gmx_int64_t *value) = 0;
+ virtual void doInt64(int64_t *value) = 0;
virtual void doFloat(float *value) = 0;
virtual void doDouble(double *value) = 0;
virtual void doString(std::string *value) = 0;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
return value1.cast<int>() == value2.cast<int>();
}
- else if (value1.isType<gmx_int64_t>())
+ else if (value1.isType<int64_t>())
{
- return value1.cast<gmx_int64_t>() == value2.cast<gmx_int64_t>();
+ return value1.cast<int64_t>() == value2.cast<int64_t>();
}
else if (value1.isType<double>())
{
};
template <>
-struct SerializationTraits<gmx_int64_t>
+struct SerializationTraits<int64_t>
{
- static void serialize(gmx_int64_t value, ISerializer *serializer)
+ static void serialize(int64_t value, ISerializer *serializer)
{
serializer->doInt64(&value);
}
static void deserialize(KeyValueTreeValueBuilder *builder, ISerializer *serializer)
{
- gmx_int64_t value;
+ int64_t value;
serializer->doInt64(&value);
- builder->setValue<gmx_int64_t>(value);
+ builder->setValue<int64_t>(value);
}
};
SERIALIZER('s', std::string),
SERIALIZER('b', bool),
SERIALIZER('i', int),
- SERIALIZER('l', gmx_int64_t),
+ SERIALIZER('l', int64_t),
SERIALIZER('f', float),
SERIALIZER('d', double),
};
if ((p = malloc(size)) == nullptr)
{
gmx_fatal(errno, __FILE__, __LINE__,
- "Not enough memory. Failed to malloc %" GMX_PRId64 " bytes for %s\n"
+ "Not enough memory. Failed to malloc %" PRId64 " bytes for %s\n"
"(called from file %s, line %d)",
- (gmx_int64_t)size, name, file, line);
+ (int64_t)size, name, file, line);
}
(void) memset(p, 0, size);
}
if ((p = malloc((size_t)nelem*(size_t)elsize)) == NULL)
{
gmx_fatal(errno, __FILE__, __LINE__,
- "Not enough memory. Failed to calloc %" GMX_PRId64
- " elements of size %" GMX_PRId64
+ "Not enough memory. Failed to calloc %" PRId64
+ " elements of size %" PRId64
" for %s\n(called from file %s, line %d)",
- (gmx_int64_t)nelem, (gmx_int64_t)elsize,
+ (int64_t)nelem, (int64_t)elsize,
name, file, line);
}
memset(p, 0, (size_t) (nelem * elsize));
if ((p = calloc((size_t)nelem, (size_t)elsize)) == nullptr)
{
gmx_fatal(errno, __FILE__, __LINE__,
- "Not enough memory. Failed to calloc %" GMX_PRId64
- " elements of size %" GMX_PRId64
+ "Not enough memory. Failed to calloc %" PRId64
+ " elements of size %" PRId64
" for %s\n(called from file %s, line %d)",
- (gmx_int64_t)nelem, (gmx_int64_t)elsize, name, file, line);
+ (int64_t)nelem, (int64_t)elsize, name, file, line);
}
#endif
}
if (p == nullptr)
{
gmx_fatal(errno, __FILE__, __LINE__,
- "Not enough memory. Failed to realloc %" GMX_PRId64 " bytes for %s, %s=%x\n"
+ "Not enough memory. Failed to realloc %" PRId64 " bytes for %s, %s=%x\n"
"(called from file %s, line %d)",
- (gmx_int64_t)size, name, name, ptr, file, line);
+ (int64_t)size, name, name, ptr, file, line);
}
}
return p;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return value;
}
-gmx_int64_t int64FromString(const char *str)
+int64_t int64FromString(const char *str)
{
errno = 0;
char *endptr;
- const gmx_int64_t value = str_to_int64_t(str, &endptr);
+ const int64_t value = str_to_int64_t(str, &endptr);
if (errno == ERANGE)
{
GMX_THROW(InvalidInputError("Invalid value: '" + std::string(str)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Also checks for overflow.
*/
-gmx_int64_t int64FromString(const char *str);
+int64_t int64FromString(const char *str);
/*! \brief
* Parses a float value from a string.
*
int fromString<int>(const char *str) { return intFromString(str); }
//! Implementation for 64-bit integer values.
template <> inline
-gmx_int64_t fromString<gmx_int64_t>(const char *str) { return int64FromString(str); }
+int64_t fromString<int64_t>(const char *str) { return int64FromString(str); }
//! Implementation for float values.
template <> inline
float fromString<float>(const char *str) { return floatFromString(str); }
return formatString("%d", t);
}
//! \copydoc intToString(int)
-static inline std::string int64ToString(gmx_int64_t t)
+static inline std::string int64ToString(int64_t t)
{
- return formatString("%" GMX_PRId64, t);
+ return formatString("%" PRId64, t);
}
//! \copydoc intToString(int)
static inline std::string doubleToString(double t)
*/
static inline std::string toString(bool t) { return boolToString(t); }
static inline std::string toString(int t) { return intToString(t); }
-static inline std::string toString(gmx_int64_t t) { return int64ToString(t); }
+static inline std::string toString(int64_t t) { return int64ToString(t); }
static inline std::string toString(float t) { return doubleToString(t); }
static inline std::string toString(double t) { return doubleToString(t); }
static inline std::string toString(std::string t) { return t; }
ArrayRef<unsigned int>,
ArrayRef<long>,
ArrayRef<unsigned long>,
- ArrayRef<gmx_int64_t>,
- ArrayRef<gmx_uint64_t>,
+ ArrayRef<int64_t>,
+ ArrayRef<uint64_t>,
ArrayRef<float>,
ArrayRef<double>,
ArrayRef<const char>,
ArrayRef<const unsigned int>,
ArrayRef<const long>,
ArrayRef<const unsigned long>,
- ArrayRef<const gmx_int64_t>,
- ArrayRef<const gmx_uint64_t>,
+ ArrayRef<const int64_t>,
+ ArrayRef<const uint64_t>,
ArrayRef<const float>,
ArrayRef<const double>
> ArrayRefTypes;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
checker_.checkInteger(*value, nullptr);
}
- virtual void doInt64(gmx_int64_t *value)
+ virtual void doInt64(int64_t *value)
{
checker_.checkInt64(*value, nullptr);
}
fprintf(fp, "%-30s = %d\n", title, i);
}
-void pr_int64(FILE *fp, int indent, const char *title, gmx_int64_t i)
+void pr_int64(FILE *fp, int indent, const char *title, int64_t i)
{
char buf[STEPSTRSIZE];
void pr_reals_of_dim(FILE *fp, int indent, const char *title, const real *vec, int n, int dim);
//! Prints an integer value.
void pr_int(FILE *fp, int indent, const char *title, int i);
-//! Prints a gmx_int64_t value.
-void pr_int64(FILE *fp, int indent, const char *title, gmx_int64_t i);
+//! Prints a int64_t value.
+void pr_int64(FILE *fp, int indent, const char *title, int64_t i);
//! Prints a floating-point value.
void pr_real(FILE *fp, int indent, const char *title, real r);
//! Prints a double-precision floating-point value.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
return toString(value.cast<int>());
}
- else if (value.isType<gmx_int64_t>())
+ else if (value.isType<int64_t>())
{
- return toString(value.cast<gmx_int64_t>());
+ return toString(value.cast<int64_t>());
}
else if (value.isType<std::string>())
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
ExactStringChecker(formatString("%d", value))));
}
-void TestReferenceChecker::checkInt64(gmx_int64_t value, const char *id)
+void TestReferenceChecker::checkInt64(int64_t value, const char *id)
{
EXPECT_PLAIN(impl_->processItem(Impl::cInt64NodeName, id,
- ExactStringChecker(formatString("%" GMX_PRId64, value))));
+ ExactStringChecker(formatString("%" PRId64, value))));
}
-void TestReferenceChecker::checkUInt64(gmx_uint64_t value, const char *id)
+void TestReferenceChecker::checkUInt64(uint64_t value, const char *id)
{
EXPECT_PLAIN(impl_->processItem(Impl::cUInt64NodeName, id,
- ExactStringChecker(formatString("%" GMX_PRIu64, value))));
+ ExactStringChecker(formatString("%" PRIu64, value))));
}
void TestReferenceChecker::checkDouble(double value, const char *id)
{
checkInteger(variant.cast<int>(), id);
}
- else if (variant.isType<gmx_int64_t>())
+ else if (variant.isType<int64_t>())
{
- checkInt64(variant.cast<gmx_int64_t>(), id);
+ checkInt64(variant.cast<int64_t>(), id);
}
else if (variant.isType<float>())
{
}
-gmx_int64_t TestReferenceChecker::readInt64(const char *id)
+int64_t TestReferenceChecker::readInt64(const char *id)
{
if (impl_->shouldIgnore())
{
GMX_THROW(TestException("Trying to read from non-existent reference data value"));
}
- gmx_int64_t value = 0;
+ int64_t value = 0;
EXPECT_PLAIN(impl_->processItem(Impl::cInt64NodeName, id,
- ValueExtractor<gmx_int64_t>(&value)));
+ ValueExtractor<int64_t>(&value)));
return value;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! Check a single integer value.
void checkInteger(int value, const char *id);
//! Check a single int64 value.
- void checkInt64(gmx_int64_t value, const char *id);
+ void checkInt64(int64_t value, const char *id);
//! Check a single uint64 value.
- void checkUInt64(gmx_uint64_t value, const char *id);
+ void checkUInt64(uint64_t value, const char *id);
//! Check a single single-precision floating point value.
void checkFloat(float value, const char *id);
//! Check a single double-precision floating point value.
//! Reads an integer value.
int readInteger(const char *id);
//! Reads a 64-bit integer value.
- gmx_int64_t readInt64(const char *id);
+ int64_t readInt64(const char *id);
//! Reads a float value.
float readFloat(const char *id);
//! Reads a double value.
checkInteger(value, id);
}
//! Check a single integer value.
- void checkValue(gmx_int64_t value, const char *id)
+ void checkValue(int64_t value, const char *id)
{
checkInt64(value, id);
}
//! Check a single integer value.
- void checkValue(gmx_uint64_t value, const char *id)
+ void checkValue(uint64_t value, const char *id)
{
checkUInt64(value, id);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* treating also values of different sign.
*/
template <typename FloatType>
-gmx_uint64_t calculateUlpDifference(const FloatingPoint<FloatType> &value1,
- const FloatingPoint<FloatType> &value2)
+uint64_t calculateUlpDifference(const FloatingPoint<FloatType> &value1,
+ const FloatingPoint<FloatType> &value2)
{
typename FloatingPoint<FloatType>::Bits biased1
= floatingPointToBiasedInteger(value1);
*/
template <typename FloatType>
void initDifference(FloatType raw1, FloatType raw2, double *absoluteDifference,
- gmx_uint64_t *ulpDifference, bool *bSignDifference)
+ uint64_t *ulpDifference, bool *bSignDifference)
{
FloatingPoint<FloatType> value1(raw1);
FloatingPoint<FloatType> value2(raw2);
* Converts a relative tolerance into an ULP difference.
*/
template <typename FloatType>
-gmx_uint64_t relativeToleranceToUlp(FloatType tolerance)
+uint64_t relativeToleranceToUlp(FloatType tolerance)
{
FloatingPoint<FloatType> m(1.0);
FloatingPoint<FloatType> t(1.0 + tolerance);
relDiffStr = formatString("Inf");
}
- return formatString("%g (%" GMX_PRIu64 " %s-prec. ULPs, rel. %s)%s",
+ return formatString("%g (%" PRIu64 " %s-prec. ULPs, rel. %s)%s",
absoluteDifference_, ulpDifference_,
isDouble() ? "double" : "single",
relDiffStr.c_str(),
return true;
}
- const gmx_uint64_t ulpTolerance
+ const uint64_t ulpTolerance
= difference.isDouble() ? doubleUlpTolerance_ : singleUlpTolerance_;
- if (ulpTolerance < GMX_UINT64_MAX && difference.asUlps() <= ulpTolerance)
+ if (ulpTolerance < UINT64_MAX && difference.asUlps() <= ulpTolerance)
{
return true;
}
= difference.isDouble() ? doubleAbsoluteTolerance_ : singleAbsoluteTolerance_;
const double relativeTolerance
= difference.isDouble() ? doubleRelativeTolerance_ : singleRelativeTolerance_;
- const gmx_uint64_t ulpTolerance
+ const uint64_t ulpTolerance
= difference.isDouble() ? doubleUlpTolerance_ : singleUlpTolerance_;
if (absoluteTolerance > 0.0)
}
result.append(formatString("rel. %.3g", relativeTolerance));
}
- if (ulpTolerance < GMX_UINT64_MAX)
+ if (ulpTolerance < UINT64_MAX)
{
if (!result.empty())
{
result.append(", ");
}
- result.append(formatString("%" GMX_PRIu64 " ULPs", ulpTolerance));
+ result.append(formatString("%" PRIu64 " ULPs", ulpTolerance));
}
if (bSignMustMatch_)
{
const double absoluteTolerance = std::abs(magnitude) * tolerance;
return FloatingPointTolerance(absoluteTolerance, absoluteTolerance,
tolerance, tolerance,
- GMX_UINT64_MAX, GMX_UINT64_MAX,
+ UINT64_MAX, UINT64_MAX,
false);
}
//! \endcond
* constructor used to initialize the difference.
* The ULP difference between 0.0 and -0.0 is zero.
*/
- gmx_uint64_t asUlps() const { return ulpDifference_; }
+ uint64_t asUlps() const { return ulpDifference_; }
/*! \brief
* Whether the compared values were of different sign.
*
double termMagnitude_;
//! Stores the absolute difference, or NaN if one or both values were NaN.
double absoluteDifference_;
- gmx_uint64_t ulpDifference_;
+ uint64_t ulpDifference_;
bool bSignDifference_;
/*! \brief
* Whether the difference was computed for single or double precision.
* - _ULP tolerance_: ULP (units of least precision) difference between the
* values must be smaller than the given tolerance for the check to pass.
* Setting the ULP tolerance to zero requires exact match.
- * Setting the ULP tolerance to GMX_UINT64_MAX disables the ULP check.
+ * Setting the ULP tolerance to UINT64_MAX disables the ULP check.
* `0.0` and `-0.0` are treated as equal for the ULP check.
* - _sign check_: if set, any values that are of different signs fail the
* check (note that this also applies to `0.0` and `-0.0`: a value with a
double doubleAbsoluteTolerance,
float singleRelativeTolerance,
double doubleRelativeTolerance,
- gmx_uint64_t singleUlpTolerance,
- gmx_uint64_t doubleUlpTolerance,
+ uint64_t singleUlpTolerance,
+ uint64_t doubleUlpTolerance,
bool bSignMustMatch)
: singleAbsoluteTolerance_(singleAbsoluteTolerance),
doubleAbsoluteTolerance_(doubleAbsoluteTolerance),
double doubleAbsoluteTolerance_;
float singleRelativeTolerance_;
double doubleRelativeTolerance_;
- gmx_uint64_t singleUlpTolerance_;
- gmx_uint64_t doubleUlpTolerance_;
+ uint64_t singleUlpTolerance_;
+ uint64_t doubleUlpTolerance_;
bool bSignMustMatch_;
};
* \related FloatingPointTolerance
*/
static inline FloatingPointTolerance
-ulpTolerance(gmx_uint64_t ulpDiff)
+ulpTolerance(uint64_t ulpDiff)
{
return FloatingPointTolerance(0.0, 0.0, 0.0, 0.0, ulpDiff, ulpDiff, false);
}
*/
static inline FloatingPointTolerance
relativeToleranceAsPrecisionDependentUlp(double magnitude,
- gmx_uint64_t singleUlpDiff,
- gmx_uint64_t doubleUlpDiff)
+ uint64_t singleUlpDiff,
+ uint64_t doubleUlpDiff)
{
return FloatingPointTolerance(magnitude*singleUlpDiff*GMX_FLOAT_EPS,
magnitude*doubleUlpDiff*GMX_DOUBLE_EPS,
absoluteTolerance(double tolerance)
{
return FloatingPointTolerance(tolerance, tolerance, 0.0, 0.0,
- GMX_UINT64_MAX, GMX_UINT64_MAX, false);
+ UINT64_MAX, UINT64_MAX, false);
}
/*! \brief
* \related FloatingPointTolerance
*/
static inline FloatingPointTolerance
-relativeToleranceAsUlp(double magnitude, gmx_uint64_t ulpDiff)
+relativeToleranceAsUlp(double magnitude, uint64_t ulpDiff)
{
return relativeToleranceAsPrecisionDependentUlp(magnitude, ulpDiff, ulpDiff);
}
namespace
{
//! Default tolerance in ULPs for two floating-point values to compare equal.
-static gmx_uint64_t g_defaultUlpTolerance = 4;
+static uint64_t g_defaultUlpTolerance = 4;
}
/*! \brief