Skip to content
Permalink
Browse files

topology: remove communication.

  • Loading branch information...
KaiSzuttor committed Mar 15, 2019
1 parent 2f36e4e commit 4f263732db8d92bf3ffbe66683761e815aa0bbf5
@@ -45,7 +45,6 @@ set(EspressoCore_SRC
swimmer_reaction.cpp
SystemInterface.cpp
thermostat.cpp
topology.cpp
tuning.cpp
virtual_sites.cpp
accumulators/Correlator.cpp
@@ -68,7 +68,6 @@
#include "statistics.hpp"
#include "statistics_chain.hpp"
#include "swimmer_reaction.hpp"
#include "topology.hpp"
#include "virtual_sites.hpp"

#include "serialization/IA_parameters.hpp"
@@ -127,7 +126,6 @@ int n_nodes = -1;
CB(mpi_rescale_particles_slave) \
CB(mpi_bcast_cell_structure_slave) \
CB(mpi_bcast_nptiso_geom_slave) \
CB(mpi_sync_topo_part_info_slave) \
CB(mpi_send_exclusion_slave) \
CB(mpi_bcast_lb_params_slave) \
CB(mpi_bcast_cuda_global_part_vars_slave) \
@@ -775,46 +773,6 @@ void mpi_bcast_nptiso_geom_slave(int, int) {
MPI_Bcast(&nptiso.non_const_dim, 1, MPI_INT, 0, comm_cart);
}

/***************REQ_UPDATE_MOL_IDS *********************/

void mpi_sync_topo_part_info_slave(int, int) {
int i;
int molsize = 0;
int moltype = 0;
int n_mols = 0;

MPI_Bcast(&n_mols, 1, MPI_INT, 0, comm_cart);
realloc_topology(n_mols);
for (i = 0; i < n_mols; i++) {

#ifdef MOLFORCES
MPI_Bcast(&(topology[i].trap_flag), 1, MPI_INT, 0, comm_cart);
MPI_Bcast(topology[i].trap_center, 3, MPI_DOUBLE, 0, comm_cart);
MPI_Bcast(&(topology[i].trap_spring_constant), 1, MPI_DOUBLE, 0, comm_cart);
MPI_Bcast(&(topology[i].drag_constant), 1, MPI_DOUBLE, 0, comm_cart);
MPI_Bcast(&(topology[i].noforce_flag), 1, MPI_INT, 0, comm_cart);
MPI_Bcast(&(topology[i].isrelative), 1, MPI_INT, 0, comm_cart);
MPI_Bcast(&(topology[i].favcounter), 1, MPI_INT, 0, comm_cart);
if (topology[i].favcounter == -1)
MPI_Bcast(topology[i].fav, 3, MPI_DOUBLE, 0, comm_cart);
/* check if any molecules are trapped */
if ((topology[i].trap_flag != 32) && (topology[i].noforce_flag != 32)) {
IsTrapped = 1;
}
#endif

MPI_Bcast(&molsize, 1, MPI_INT, 0, comm_cart);
MPI_Bcast(&moltype, 1, MPI_INT, 0, comm_cart);
topology[i].type = moltype;
topology[i].part.resize(molsize);

MPI_Bcast(topology[i].part.e, topology[i].part.n, MPI_INT, 0, comm_cart);
MPI_Bcast(&topology[i].type, 1, MPI_INT, 0, comm_cart);
}

sync_topo_part_info();
}

/******************* REQ_BCAST_LBPAR ********************/

void mpi_bcast_lb_params(LBParam field, int value) {
@@ -280,11 +280,6 @@ void mpi_bcast_nptiso_geom(void);
* a single molecule */
void mpi_update_mol_ids(void);

/** Issue REQ_SYNC_TOPO: Update the molecules ids to that they correspond to
* the topology
*/
int mpi_sync_topo_part_info(void);

/** Issue REQ_BCAST_LBPAR: Broadcast a parameter for lattice Boltzmann.
* @param[in] field References the parameter field to be broadcasted.
* The references are defined in lb.hpp
@@ -698,59 +698,6 @@ int calc_cylindrical_average(
return ES_OK;
}

int calc_vanhove(PartCfg &partCfg, int ptype, double rmin, double rmax,
int rbins, int tmax, double *msd, double **vanhove) {
int c1, c3, c3_max, ind;
double bin_width, inv_bin_width;
std::vector<int> ids;

for (auto const &p : partCfg) {
if (p.p.type == ptype) {
ids.push_back(p.p.identity);
}
}

if (ids.empty()) {
return 0;
}

/* preparation */
bin_width = (rmax - rmin) / (double)rbins;
inv_bin_width = 1.0 / bin_width;

/* calculate msd and store distribution in vanhove */
for (c1 = 0; c1 < n_configs; c1++) {
c3_max = (c1 + tmax + 1) > n_configs ? n_configs : c1 + tmax + 1;
for (c3 = (c1 + 1); c3 < c3_max; c3++) {
for (auto const &id : ids) {
Vector3d p1, p2;
p1[0] = configs[c1][3 * id];
p1[1] = configs[c1][3 * id + 1];
p1[2] = configs[c1][3 * id + 2];
p2[0] = configs[c3][3 * id];
p2[1] = configs[c3][3 * id + 1];
p2[2] = configs[c3][3 * id + 2];
auto const dist = (p1 - p2).norm();
if (dist > rmin && dist < rmax) {
ind = (int)((dist - rmin) * inv_bin_width);
vanhove[(c3 - c1 - 1)][ind]++;
}
msd[(c3 - c1 - 1)] += dist * dist;
}
}
}

/* normalize */
for (c1 = 0; c1 < (tmax); c1++) {
for (int i = 0; i < rbins; i++) {
vanhove[c1][i] /= (double)(n_configs - c1 - 1) * ids.size();
}
msd[c1] /= (double)(n_configs - c1 - 1) * ids.size();
}

return ids.size();
}

/****************************************************************************************
* config storage functions
****************************************************************************************/
@@ -31,7 +31,6 @@
#include "grid.hpp"
#include "nonbonded_interactions/nonbonded_interaction_data.hpp"
#include "particle_data.hpp"
#include "topology.hpp"
#include "utils.hpp"

#include <map>
@@ -165,34 +164,6 @@ void calc_rdf_av(PartCfg &partCfg, std::vector<int> &p1_types,
std::vector<int> &p2_types, double r_min, double r_max,
int r_bins, std::vector<double> &rdf, int n_conf);

/** Calculates the van Hove auto correlation function and as a side product the
mean square displacement (msd).
Calculates the van Hove auto correlation function (acf) G(r,t) which is the
probability that a particle has moved
a distance r after time t. In the case of a random walk G(r,t)/(4 pi r*r) is
a Gaussian. The mean square
displacement (msd) is connected to the van Hove acf via sqrt(msd(t)) = int
G(r,t) dr. This is very useful for
the investigation of diffusion processes.
calc_vanhove does the calculation for one particle type ptype and stores the
functions specified by rmin, rmax and
rbins in the arrays msd and vanhove.
@param ptype particle type for which the analysis should be performed
@param rmin minimal distance for G(r,t)
@param rmax maximal distance for G(r,t)
@param rbins number of bins for the r distribution in G(r,t)
@param tmax max time, for which G(r,t) is computed, if omitted or set to
zero, default tmax=n_configs-1 is used
@param msd array to store the mean square displacement (size
n_configs-1)
@param vanhove array to store G(r,t) (size (n_configs-1)*(rbins))
*/
int calc_vanhove(PartCfg &, int ptype, double rmin, double rmax, int rbins,
int tmax, double *msd, double **vanhove);

/** Calculates the spherically averaged structure factor.
Calculates the spherically averaged structure factor of particles of a
@@ -26,7 +26,6 @@
#include "communication.hpp"
#include "grid.hpp"
#include "statistics.hpp"
#include "topology.hpp"
#include "utils.hpp"

/** Particles' initial positions (needed for g1(t), g2(t), g3(t)) */
@@ -26,7 +26,6 @@
#include "forces.hpp"
#include "integrate.hpp"
#include "partCfg_global.hpp"
#include "topology.hpp"
#include "virtual_sites.hpp"

// forward declarations

0 comments on commit 4f26373

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.