diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 51679b9456b329a5be858f5597046d817ae35ece..df7d8427887f2d82b977366c82c5c16b9ac42f2b 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -541,6 +541,7 @@ void Configuration::setDefaults() { inputCoordinates = ""; restartCoordinates = ""; + copyReplicaCoordinates = 1; numberFluct = 0; numberFluctPeriod = 200; interparticleForce = 1; @@ -674,6 +675,8 @@ int Configuration::readParameters(const char * config_file) { inputCoordinates = value; else if (param == String("restartCoordinates")) restartCoordinates = value; + else if (param == String("copyReplicaCoordinates")) + copyReplicaCoordinates = atoi(value.val()); else if (param == String("temperature")) temperature = (float) strtod(value.val(),NULL); else if (param == String("temperatureGrid")) @@ -1612,7 +1615,7 @@ bool Configuration::loadCoordinates(const char* file_name) { return false; } - if (count >= num) { + if (count >= num*simNum) { printf("WARNING: Too many coordinates in coordinate file %s.\n", file_name); fclose(inp); return true; diff --git a/src/Configuration.h b/src/Configuration.h index 4e8bad25420d95895f2b2a284af7c76db2368141..b4d45879ee1ae3b118ff482bf3d3b5d07df9cc97 100644 --- a/src/Configuration.h +++ b/src/Configuration.h @@ -139,6 +139,7 @@ public: String temperatureGridFile; String inputCoordinates; String inputRBCoordinates; + int copyReplicaCoordinates; String restartCoordinates; int numberFluct; int interparticleForce; diff --git a/src/GrandBrownTown.cu b/src/GrandBrownTown.cu index e474b7d6f003663ddef402cb8d0b8d335b724a2d..216486e65d200b1fbcbaf9bb96b3869b7137383d 100644 --- a/src/GrandBrownTown.cu +++ b/src/GrandBrownTown.cu @@ -60,13 +60,15 @@ GrandBrownTown::GrandBrownTown(const Configuration& c, const char* outArg, // Replicate identical initial conditions across all replicas - // TODO: add an option to generate random initial conditions for all replicas for (int r = 0; r < numReplicas; ++r) { - std::copy(c.pos, c.pos + num, pos + r*num); - std::copy(c.type, c.type + num, type + r*num); - std::copy(c.serial, c.serial + num, serial + r*num); + std::copy(c.type, c.type + num, type + r*num); + std::copy(c.serial, c.serial + num, serial + r*num); + if (c.copyReplicaCoordinates > 0) + std::copy(c.pos, c.pos + num, pos + r*num); } - + if (c.copyReplicaCoordinates <= 0) + std::copy(c.pos, c.pos + numReplicas*num, pos); + currSerial = c.currSerial; // serial number of the next new particle name = c.name; // list of particle types! useful when 'numFluct == 1' posLast = c.posLast; // previous positions of particles (used for computing ionic current)