From: Mark Abraham Date: Wed, 5 May 2021 08:55:48 +0000 (+0000) Subject: Break up dd_init_bondeds X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=e417533cd6417d1c7f3c8ccbf4f366deee9d60c5;p=alexxy%2Fgromacs.git Break up dd_init_bondeds --- diff --git a/admin/lsan-suppressions.txt b/admin/lsan-suppressions.txt index 14b6453d24..d064c4cbea 100644 --- a/admin/lsan-suppressions.txt +++ b/admin/lsan-suppressions.txt @@ -4,7 +4,8 @@ leak:add_to_list leak:atoms_to_constraints leak:atoms_to_settles leak:balance_fep_lists -leak:dd_init_bondeds +leak:dd_make_reverse_top +leak:makeBondedLinks leak:dd_make_local_constraints leak:dd_move_f leak:dd_partition_system diff --git a/src/gromacs/domdec/domdec.cpp b/src/gromacs/domdec/domdec.cpp index d684d8057e..346a09bf6d 100644 --- a/src/gromacs/domdec/domdec.cpp +++ b/src/gromacs/domdec/domdec.cpp @@ -2491,30 +2491,6 @@ static void set_dd_limits(const gmx::MDLogger& mdlog, } } -void dd_init_bondeds(FILE* fplog, - gmx_domdec_t* dd, - const gmx_mtop_t& mtop, - const gmx::VirtualSitesHandler* vsite, - const t_inputrec& inputrec, - const gmx::DDBondedChecking ddBondedChecking, - gmx::ArrayRef cginfo_mb) -{ - dd_make_reverse_top(fplog, dd, mtop, vsite, inputrec, ddBondedChecking); - - gmx_domdec_comm_t* comm = dd->comm; - - if (comm->systemInfo.filterBondedCommunication) - { - /* Communicate atoms beyond the cut-off for bonded interactions */ - comm->bondedLinks = makeBondedLinks(mtop, cginfo_mb); - } - else - { - /* Only communicate atoms based on cut-off */ - comm->bondedLinks = nullptr; - } -} - static void writeSettings(gmx::TextWriter* log, gmx_domdec_t* dd, const gmx_mtop_t& mtop, diff --git a/src/gromacs/domdec/domdec.h b/src/gromacs/domdec/domdec.h index 42883d1598..f60c429b6a 100644 --- a/src/gromacs/domdec/domdec.h +++ b/src/gromacs/domdec/domdec.h @@ -72,8 +72,6 @@ struct gmx_ddbox_t; struct gmx_domdec_zones_t; struct gmx_localtop_t; struct gmx_mtop_t; -struct t_block; -struct t_blocka; struct t_commrec; struct t_forcerec; struct t_inputrec; @@ -157,15 +155,6 @@ bool ddMayHaveSplitConstraints(const gmx_domdec_t& dd); /*! \brief Return whether update groups are used */ bool ddUsesUpdateGroups(const gmx_domdec_t& dd); -/*! \brief Initialize data structures for bonded interactions */ -void dd_init_bondeds(FILE* fplog, - gmx_domdec_t* dd, - const gmx_mtop_t& mtop, - const gmx::VirtualSitesHandler* vsite, - const t_inputrec& inputrec, - gmx::DDBondedChecking ddBondedChecking, - gmx::ArrayRef cginfo_mb); - /*! \brief Returns whether molecules are always whole, i.e. not broken by PBC */ bool dd_moleculesAreAlwaysWhole(const gmx_domdec_t& dd); @@ -326,7 +315,7 @@ void dd_init_local_state(const gmx_domdec_t& dd, const t_state* state_global, t_ * * Also stores whether atoms are linked in \p cginfo_mb. */ -t_blocka* makeBondedLinks(const gmx_mtop_t& mtop, gmx::ArrayRef cginfo_mb); +void makeBondedLinks(gmx_domdec_t* dd, const gmx_mtop_t& mtop, gmx::ArrayRef cginfo_mb); /*! \brief Calculate the maximum distance involved in 2-body and multi-body bonded interactions */ void dd_bonded_cg_distance(const gmx::MDLogger& mdlog, diff --git a/src/gromacs/domdec/domdec_topology.cpp b/src/gromacs/domdec/domdec_topology.cpp index 5bacabd878..3a9f715cf4 100644 --- a/src/gromacs/domdec/domdec_topology.cpp +++ b/src/gromacs/domdec/domdec_topology.cpp @@ -1898,8 +1898,16 @@ static void check_link(t_blocka* link, int cg_gl, int cg_gl_j) } } -t_blocka* makeBondedLinks(const gmx_mtop_t& mtop, gmx::ArrayRef cginfo_mb) +void makeBondedLinks(gmx_domdec_t* dd, const gmx_mtop_t& mtop, gmx::ArrayRef cginfo_mb) { + + if (!dd->comm->systemInfo.filterBondedCommunication) + { + /* Only communicate atoms based on cut-off */ + dd->comm->bondedLinks = nullptr; + return; + } + t_blocka* link = nullptr; /* For each atom make a list of other atoms in the system @@ -2046,7 +2054,7 @@ t_blocka* makeBondedLinks(const gmx_mtop_t& mtop, gmx::ArrayRef cgi fprintf(debug, "Of the %d atoms %d are linked via bonded interactions\n", mtop.natoms, ncgi); } - return link; + dd->comm->bondedLinks = link; } typedef struct diff --git a/src/gromacs/mdrun/runner.cpp b/src/gromacs/mdrun/runner.cpp index e4c8c1ea78..40c538a60a 100644 --- a/src/gromacs/mdrun/runner.cpp +++ b/src/gromacs/mdrun/runner.cpp @@ -1754,6 +1754,11 @@ int Mdrunner::mdrunner() constructVirtualSitesGlobal(mtop, globalState->x); } } + // Make the DD reverse topology, now that any vsites that are present are available + if (DOMAINDECOMP(cr)) + { + dd_make_reverse_top(fplog, cr->dd, mtop, vsite.get(), *inputrec, domdecOptions.ddBondedChecking); + } if (EEL_PME(fr->ic->eeltype) || EVDW_PME(fr->ic->vdwtype)) { @@ -1971,11 +1976,10 @@ int Mdrunner::mdrunner() if (DOMAINDECOMP(cr)) { GMX_RELEASE_ASSERT(fr, "fr was NULL while cr->duty was DUTY_PP"); - /* This call is not included in init_domain_decomposition mainly + /* This call is not included in init_domain_decomposition * because fr->cginfo_mb is set later. */ - dd_init_bondeds( - fplog, cr->dd, mtop, vsite.get(), *inputrec, domdecOptions.ddBondedChecking, fr->cginfo_mb); + makeBondedLinks(cr->dd, mtop, fr->cginfo_mb); } if (runScheduleWork.simulationWork.useGpuBufferOps)