From: ejjordan Date: Wed, 21 Apr 2021 16:46:11 +0000 (+0200) Subject: Finish removing t_mdatoms from update module X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=fdf8f26527dd2fed43a3c87c78070159f325f480;p=alexxy%2Fgromacs.git Finish removing t_mdatoms from update module Remove t_atoms from finish_update and only pass needed params. Also cleaned up the includes and forward declares a bit. --- diff --git a/src/gromacs/mdlib/tests/leapfrogtestrunners.cpp b/src/gromacs/mdlib/tests/leapfrogtestrunners.cpp index 0db80fc685..5badaad272 100644 --- a/src/gromacs/mdlib/tests/leapfrogtestrunners.cpp +++ b/src/gromacs/mdlib/tests/leapfrogtestrunners.cpp @@ -87,8 +87,12 @@ void LeapFrogHostTestRunner::integrate(LeapFrogTestData* testData, int numSteps) etrtNONE, nullptr, false); - testData->update_->finish_update( - testData->inputRecord_, &testData->mdAtoms_, &testData->state_, nullptr, false); + testData->update_->finish_update(testData->inputRecord_, + testData->mdAtoms_.havePartiallyFrozenAtoms, + testData->mdAtoms_.homenr, + &testData->state_, + nullptr, + false); } const auto xp = makeArrayRef(*testData->update_->xp()).subArray(0, testData->numAtoms_); for (int i = 0; i < testData->numAtoms_; i++) diff --git a/src/gromacs/mdlib/update.cpp b/src/gromacs/mdlib/update.cpp index ac2c566d71..c75ff3c614 100644 --- a/src/gromacs/mdlib/update.cpp +++ b/src/gromacs/mdlib/update.cpp @@ -46,21 +46,17 @@ #include #include "gromacs/domdec/domdec_struct.h" -#include "gromacs/fileio/confio.h" #include "gromacs/gmxlib/network.h" #include "gromacs/gmxlib/nrnb.h" #include "gromacs/listed_forces/disre.h" #include "gromacs/listed_forces/orires.h" #include "gromacs/math/functions.h" -#include "gromacs/math/invertmatrix.h" #include "gromacs/math/paddedvector.h" #include "gromacs/math/units.h" #include "gromacs/math/vec.h" -#include "gromacs/math/vecdump.h" #include "gromacs/mdlib/boxdeformation.h" #include "gromacs/mdlib/constr.h" #include "gromacs/mdlib/gmx_omp_nthreads.h" -#include "gromacs/mdlib/mdatoms.h" #include "gromacs/mdlib/stat.h" #include "gromacs/mdlib/tgroup.h" #include "gromacs/mdtypes/commrec.h" @@ -68,9 +64,7 @@ #include "gromacs/mdtypes/group.h" #include "gromacs/mdtypes/inputrec.h" #include "gromacs/mdtypes/md_enums.h" -#include "gromacs/mdtypes/mdatom.h" #include "gromacs/mdtypes/state.h" -#include "gromacs/pbcutil/boxutilities.h" #include "gromacs/pbcutil/pbc.h" #include "gromacs/pulling/pull.h" #include "gromacs/random/tabulatednormaldistribution.h" @@ -82,7 +76,6 @@ #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/futil.h" #include "gromacs/utility/gmxassert.h" -#include "gromacs/utility/gmxomp.h" #include "gromacs/utility/smalloc.h" using namespace gmx; // TODO: Remove when this file is moved into gmx namespace @@ -136,11 +129,13 @@ public: const t_commrec* cr, bool haveConstraints); - void finish_update(const t_inputrec& inputRecord, - const t_mdatoms* md, - t_state* state, - gmx_wallcycle* wcycle, - bool haveConstraints); + void finish_update(const t_inputrec& inputRecord, + bool havePartiallyFrozenAtoms, + int homenr, + gmx::ArrayRef cFREEZE, + t_state* state, + gmx_wallcycle* wcycle, + bool haveConstraints); void update_sd_second_half(const t_inputrec& inputRecord, int64_t step, @@ -248,12 +243,14 @@ void Update::update_coords(const t_inputrec& inputRecord, } void Update::finish_update(const t_inputrec& inputRecord, - const t_mdatoms* md, + const bool havePartiallyFrozenAtoms, + const int homenr, t_state* state, gmx_wallcycle* wcycle, const bool haveConstraints) { - return impl_->finish_update(inputRecord, md, state, wcycle, haveConstraints); + return impl_->finish_update( + inputRecord, havePartiallyFrozenAtoms, homenr, impl_->cFREEZE_, state, wcycle, haveConstraints); } void Update::update_sd_second_half(const t_inputrec& inputRecord, @@ -1462,11 +1459,13 @@ void Update::Impl::update_sd_second_half(const t_inputrec& input } } -void Update::Impl::finish_update(const t_inputrec& inputRecord, - const t_mdatoms* md, - t_state* state, - gmx_wallcycle* wcycle, - const bool haveConstraints) +void Update::Impl::finish_update(const t_inputrec& inputRecord, + const bool havePartiallyFrozenAtoms, + const int homenr, + gmx::ArrayRef cFREEZE, + t_state* state, + gmx_wallcycle* wcycle, + const bool haveConstraints) { /* NOTE: Currently we always integrate to a temporary buffer and * then copy the results back here. @@ -1474,11 +1473,10 @@ void Update::Impl::finish_update(const t_inputrec& inputRecord, wallcycle_start_nocount(wcycle, WallCycleCounter::Update); - const int homenr = md->homenr; - auto xp = makeConstArrayRef(xp_).subArray(0, homenr); - auto x = makeArrayRef(state->x).subArray(0, homenr); + auto xp = makeConstArrayRef(xp_).subArray(0, homenr); + auto x = makeArrayRef(state->x).subArray(0, homenr); - if (md->havePartiallyFrozenAtoms && haveConstraints) + if (havePartiallyFrozenAtoms && haveConstraints) { /* We have atoms that are frozen along some, but not all dimensions, * then constraints will have moved them also along the frozen dimensions. @@ -1488,7 +1486,7 @@ void Update::Impl::finish_update(const t_inputrec& inputRecord, for (int i = 0; i < homenr; i++) { - const int g = md->cFREEZE[i]; + const int g = cFREEZE[i]; for (int d = 0; d < DIM; d++) { diff --git a/src/gromacs/mdlib/update.h b/src/gromacs/mdlib/update.h index 7fa36ae376..6771d60f3d 100644 --- a/src/gromacs/mdlib/update.h +++ b/src/gromacs/mdlib/update.h @@ -45,7 +45,6 @@ #include "gromacs/mdtypes/md_enums.h" #include "gromacs/timing/wallcycle.h" #include "gromacs/utility/arrayref.h" -#include "gromacs/utility/basedefinitions.h" #include "gromacs/utility/real.h" class ekinstate_t; @@ -56,7 +55,6 @@ struct t_fcdata; struct t_graph; struct t_grpopts; struct t_inputrec; -struct t_mdatoms; struct t_nrnb; class t_state; enum class ParticleType; @@ -145,13 +143,15 @@ public: * Copy the updated coordinates to the main coordinates buffer for the atoms that are not frozen. * * \param[in] inputRecord Input record. - * \param[in] md MD atoms data. + * \param[in] havePartiallyFrozenAtoms Whether atoms are frozen along 1 or 2 (not 3) dimensions? + * \param[in] homenr The number of atoms on this processor. * \param[in] state System state object. * \param[in] wcycle Wall-clock cycle counter. * \param[in] haveConstraints If the system has constraints. */ void finish_update(const t_inputrec& inputRecord, - const t_mdatoms* md, + bool havePartiallyFrozenAtoms, + int homenr, t_state* state, gmx_wallcycle* wcycle, bool haveConstraints); diff --git a/src/gromacs/mdlib/update_vv.cpp b/src/gromacs/mdlib/update_vv.cpp index acc112e0d2..fe874ca89b 100644 --- a/src/gromacs/mdlib/update_vv.cpp +++ b/src/gromacs/mdlib/update_vv.cpp @@ -412,7 +412,8 @@ void integrateVVSecondStep(int64_t step, constr, do_log, do_ene); - upd->finish_update(*ir, mdatoms, state, wcycle, constr != nullptr); + upd->finish_update( + *ir, mdatoms->havePartiallyFrozenAtoms, mdatoms->homenr, state, wcycle, constr != nullptr); if (ir->eI == IntegrationAlgorithm::VVAK) { @@ -467,7 +468,7 @@ void integrateVVSecondStep(int64_t step, * to numerical errors, or are they important * physically? I'm thinking they are just errors, but not completely sure. * For now, will call without actually constraining, constr=NULL*/ - upd->finish_update(*ir, mdatoms, state, wcycle, false); + upd->finish_update(*ir, mdatoms->havePartiallyFrozenAtoms, mdatoms->homenr, state, wcycle, false); } /* this factor or 2 correction is necessary because half of the constraint force is removed diff --git a/src/gromacs/mdrun/md.cpp b/src/gromacs/mdrun/md.cpp index f5db890f89..df33e9e782 100644 --- a/src/gromacs/mdrun/md.cpp +++ b/src/gromacs/mdrun/md.cpp @@ -1609,7 +1609,8 @@ void gmx::LegacySimulator::do_md() constr, do_log, do_ene); - upd.finish_update(*ir, mdatoms, state, wcycle, constr != nullptr); + upd.finish_update( + *ir, mdatoms->havePartiallyFrozenAtoms, mdatoms->homenr, state, wcycle, constr != nullptr); } if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)