void ESingleSimulation::initialisation() { preSimInit(); if (!(vm.count("config-file")) || (vm["config-file"].as<std::vector<std::string> >().size() != 1)) M_throw() << "You must only provide one input file in single mode"; setupSim(simulation, vm["config-file"].as<std::vector<std::string> >()[0]); #ifdef DYNAMO_visualizer simulation.systems.push_back(shared_ptr<System>(new SVisualizer(&simulation, vm["config-file"].as<std::vector<std::string> >()[0], simulation.lastRunMFT))); #endif if (vm.count("snapshot")) simulation.systems.push_back(shared_ptr<System>(new SysSnapshot(&simulation, vm["snapshot"].as<double>(), "SnapshotTimer", "%COUNT", !vm.count("unwrapped")))); if (vm.count("snapshot-events")) simulation.systems.push_back(shared_ptr<System>(new SysSnapshot(&simulation, vm["snapshot-events"].as<size_t>(), "SnapshotEventTimer", "%COUNTe", !vm.count("unwrapped")))); simulation.initialise(); postSimInit(simulation); if (vm.count("ticker-period")) simulation.setTickerPeriod(vm["ticker-period"].as<double>()); }
void ESingleSimulation::initialisation() { preSimInit(); if (!(vm.count("config-file")) || (vm["config-file"].as<std::vector<std::string> >().size() != 1)) M_throw() << "You must only provide one input file in single mode"; setupSim(simulation, vm["config-file"].as<std::vector<std::string> >()[0]); simulation.initialise(); postSimInit(simulation); if (vm.count("ticker-period")) simulation.setTickerPeriod(vm["ticker-period"].as<double>()); }
void EReplicaExchangeSimulation::initialisation() { preSimInit(); for (unsigned int i = 0; i < nSims; i++) { setupSim(Simulations[i], vm["config-file"].as<std::vector<std::string> >()[i]); Simulations[i].initialise(); postSimInit(Simulations[i]); } //Ensure we are in the right ensemble for all simulations for (size_t i = nSims; i != 0;) if (dynamic_cast<const dynamo::EnsembleNVT* >(Simulations[--i].getEnsemble().get()) == NULL) M_throw() << vm["config-file"].as<std::vector<std::string> >()[i] << " does not have an NVT ensemble"; //Ensure the types of the simulation Liouvilleans match for (size_t i(1); i < nSims; ++i) if (typeid(Simulations[i].dynamics.getLiouvillean()) != typeid(Simulations[0].dynamics.getLiouvillean())) M_throw() << vm["config-file"].as<std::vector<std::string> >()[i] << " does not have the same Liouvillean type as " << vm["config-file"].as<std::vector<std::string> >()[0]; //Test a thermostat is available for (unsigned int i = 0; i < nSims; i++) if (Simulations[i].getSystem("Thermostat") == NULL) M_throw() << "Could not find the Thermostat for system " << i << "\nFilename " << vm["config-file"].as<std::vector<std::string> >()[i]; //Set up the replex organisation temperatureList.clear(); for (unsigned int i = 1; i < nSims; i++) if (Simulations[0].N != Simulations[i].N) M_throw() << "Every replica configuration file must have the same number of particles!"; for (unsigned int i = 0; i < nSims; i++) { bool didWork = false; BOOST_FOREACH(shared_ptr<System>& sysPtr1, Simulations[i].dynamics.getSystemEvents()) if (sysPtr1->getName() == "Thermostat") { if (dynamic_cast<SysAndersen*>(sysPtr1.get()) == NULL) M_throw() << "Could not upcast thermostat to Andersens"; temperatureList.push_back (replexPair (Simulations[i].getEnsemble()->getEnsembleVals()[2], simData(i,Simulations[i].getEnsemble()->getReducedEnsembleVals()[2]))); didWork = true; break; } #ifdef DYNAMO_DEBUG if (!didWork) { std::cout << "Could not find thermostat system event"; exit(1); } #endif } std::sort(temperatureList.begin(), temperatureList.end()); SimDirection.resize(temperatureList.size(), 0); roundtrip.resize(temperatureList.size(), false); SimDirection[temperatureList.front().second.simID] = 1; //Going up SimDirection[temperatureList.back().second.simID] = -1; //Going down //If a system ticker is set we scale the ticker time such that the //number of ticks in all systems is equal. if (vm.count("ticker-period")) for (size_t i = 0; i < nSims; ++i) { double tFactor = std::sqrt(temperatureList.begin()->second.realTemperature / Simulations[i].getEnsemble()->getReducedEnsembleVals()[2]); Simulations[i].setTickerPeriod(vm["ticker-period"].as<double>() * tFactor); } }