Skip to content

Commit

Permalink
fix proxy file
Browse files Browse the repository at this point in the history
  • Loading branch information
HubLot committed Aug 30, 2023
1 parent dbe10c8 commit bd3f7b6
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions gromacs/gromacs-2023.x/colvarproxy_gromacs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ void colvarproxy_gromacs::init(t_inputrec *ir, int64_t step, const gmx_mtop_t &m
// Retrieve the topology of all atoms
gmx_atoms = gmx_mtop_global_atoms(mtop);

// Read configuration file and set up the proxy only on the master node.
if (MASTER(cr))
// Read configuration file and set up the proxy only on the MAIN node.
if (MAIN(cr))
{

// initiate module: this object will be the communication proxy
// colvarmodule pointer is only defined on the Master due to the static pointer to colvarproxy.
// colvarmodule pointer is only defined on the MAIN due to the static pointer to colvarproxy.
colvars = new colvarmodule(this);

version_int = get_version_from_string(COLVARPROXY_VERSION);
Expand Down Expand Up @@ -140,13 +140,13 @@ void colvarproxy_gromacs::init(t_inputrec *ir, int64_t step, const gmx_mtop_t &m
colvars->it = colvars->it_restart = step;


} // end master
} // end MAIN


// MPI initialisation

// Initialise attributs for the MPI communication
if(MASTER(cr)) {
if(MAIN(cr)) {
// Retrieve the number of colvar atoms
n_colvars_atoms = atoms_ids.size();
// Copy their global indices
Expand All @@ -158,8 +158,8 @@ void colvarproxy_gromacs::init(t_inputrec *ir, int64_t step, const gmx_mtop_t &m
// Let the other nodes know the number of colvar atoms.
block_bc(cr->mpi_comm_mygroup, n_colvars_atoms);

// Initialise atoms_new_colvar_forces on non-master nodes
if(!MASTER(cr)) {
// Initialise atoms_new_colvar_forces on non-MAIN nodes
if(!MAIN(cr)) {
atoms_new_colvar_forces.reserve(n_colvars_atoms);
}
}
Expand All @@ -174,7 +174,7 @@ void colvarproxy_gromacs::init(t_inputrec *ir, int64_t step, const gmx_mtop_t &m
// Prepare data

// Manage restart with .cpt
if (MASTER(cr))
if (MAIN(cr))
{
/* colvarsHistory is the struct holding the data saved in the cpt
Expand Down Expand Up @@ -227,7 +227,7 @@ void colvarproxy_gromacs::init(t_inputrec *ir, int64_t step, const gmx_mtop_t &m
if (PAR(cr))
{
nblock_bc(cr->mpi_comm_mygroup, n_colvars_atoms, xa_old_whole);
snew_bc(MASTER(cr), ind, n_colvars_atoms);
snew_bc(MAIN(cr), ind, n_colvars_atoms);
nblock_bc(cr->mpi_comm_mygroup, n_colvars_atoms, ind);
}

Expand All @@ -245,7 +245,7 @@ void colvarproxy_gromacs::init(t_inputrec *ir, int64_t step, const gmx_mtop_t &m
}
}

if (MASTER(cr) && cvm::debug()) {
if (MAIN(cr) && cvm::debug()) {
cvm::log ("atoms_ids = "+cvm::to_str (atoms_ids)+"\n");
cvm::log ("atoms_refcount = "+cvm::to_str (atoms_refcount)+"\n");
cvm::log ("positions = "+cvm::to_str (atoms_positions)+"\n");
Expand All @@ -263,7 +263,7 @@ colvarproxy_gromacs::~colvarproxy_gromacs()

void colvarproxy_gromacs::finish(const t_commrec *cr)
{
if(MASTER(cr)) {
if(MAIN(cr)) {
colvars->write_restart_file(output_prefix_str+".colvars.state");
colvars->write_output_files();
}
Expand Down Expand Up @@ -381,15 +381,15 @@ int colvarproxy_gromacs::backup_file (char const *filename)
void colvarproxy_gromacs::update_data(const t_commrec *cr, int64_t const step, t_pbc const &pbc, const matrix box, bool bNS)
{

if (MASTER(cr)) {
if (MAIN(cr)) {

if(cvm::debug()) {
cvm::log(cvm::line_marker);
cvm::log("colvarproxy_gromacs, step no. "+cvm::to_str(colvars->it)+"\n"+
"Updating internal data.\n");
}

// step update on master only due to the call of colvars pointer.
// step update on MAIN only due to the call of colvars pointer.
if (first_timestep) {
first_timestep = false;
} else {
Expand All @@ -398,7 +398,7 @@ void colvarproxy_gromacs::update_data(const t_commrec *cr, int64_t const step, t
colvars->it++;
// Other cases?
}
} // end master
} // end MAIN

gmx_pbc = pbc;
gmx_box = box;
Expand All @@ -408,7 +408,7 @@ void colvarproxy_gromacs::update_data(const t_commrec *cr, int64_t const step, t

// Prepare data for MPI communication
if(PAR(cr) && bNS) {
dd_make_local_group_indices(cr->dd->ga2la, n_colvars_atoms, ind, &nat_loc, &ind_loc, &nalloc_loc, xa_ind);
dd_make_local_group_indices(cr->dd->ga2la.get(), n_colvars_atoms, ind, &nat_loc, &ind_loc, &nalloc_loc, xa_ind);
}
}

Expand All @@ -434,9 +434,9 @@ void colvarproxy_gromacs::calculateForces(
// Communicate_group_positions takes care of removing shifts (unwrapping)
// in single node jobs, communicate_group_positions() is efficient and adds no overhead

if (MASTER(cr))
if (MAIN(cr))
{
// On non-master nodes, jump directly to applying the forces
// On non-MAIN nodes, jump directly to applying the forces

// Zero the forces on the atoms, so that they can be accumulated by the colvars.
for (size_t i = 0; i < atoms_new_colvar_forces.size(); i++) {
Expand All @@ -463,7 +463,7 @@ void colvarproxy_gromacs::calculateForces(
}

forceProviderOutput->enerd_.term[F_COM_PULL] += bias_energy;
} // master node
} // MAIN node

//Broadcast the forces to all the nodes
if (PAR(cr))
Expand Down

0 comments on commit bd3f7b6

Please sign in to comment.