void CSysGhost::runEvent() const { ++Sim->eventCount; ++eventCount; if (tune && (eventCount > setFrequency)) { meanFreeTime *= static_cast<double>(eventCount) / ((Sim->eventCount - lastlNColl) * setPoint); lastlNColl = Sim->eventCount; eventCount = 0; } double locdt = dt; #ifdef DYNAMO_DEBUG if (boost::math::isnan(locdt)) M_throw() << "A NAN system event time has been found"; #endif Sim->dSysTime += locdt; Sim->ptrScheduler->stream(locdt); Sim->dynamics.stream(locdt); locdt += Sim->freestreamAcc; Sim->freestreamAcc = 0; dt = getGhostt(); unsigned int step = boost::variate_generator <dynamo::baseRNG&, boost::uniform_int<unsigned int> > (Sim->ranGenerator, boost::uniform_int<unsigned int>(0, range->size() - 1))(); const Particle& part(Sim->particleList[*(range->begin()+step)]); //Run the collision and catch the data NEventData SDat(Sim->dynamics.getLiouvillean().randomGaussianEvent (part, sqrtTemp)); Sim->signalParticleUpdate(SDat); Sim->ptrScheduler->fullUpdate(part); BOOST_FOREACH(std::tr1::shared_ptr<OutputPlugin>& Ptr, Sim->outputPlugins) Ptr->eventUpdate(*this, SDat, locdt); }
void CSUmbrella::runEvent() const { double locdt = dt; #ifdef DYNAMO_DEBUG if (boost::math::isnan(locdt)) M_throw() << "A NAN system event time has been found"; #endif Sim->dSysTime += locdt; Sim->ptrScheduler->stream(locdt); //dynamics must be updated first Sim->dynamics.stream(locdt); ++Sim->eventCount; BOOST_FOREACH(const size_t& id, *range1) Sim->dynamics.getLiouvillean().updateParticle(Sim->particleList[id]); BOOST_FOREACH(const size_t& id, *range2) Sim->dynamics.getLiouvillean().updateParticle(Sim->particleList[id]); bool kedown(false); //Will kinetic energy go down? int newulevel ; if (ulevel == 0) { kedown = true; if (type == WELL_OUT) newulevel = 1; else newulevel = -1; } else if (type == WELL_OUT) { if (ulevel > 0) kedown = true; newulevel = ulevel + 1; } else //if (type == WELL_IN) { if (ulevel < 0) kedown = true; newulevel = ulevel - 1; } EEventType etype(NONE); NEventData SDat(Sim->dynamics.getLiouvillean().multibdyWellEvent (*range1, *range2, 0.0, (kedown) ? -delU : delU, etype)); if (etype != BOUNCE) ulevel = newulevel; Sim->signalParticleUpdate(SDat); //Only 1ParticleEvents occur BOOST_FOREACH(const ParticleEventData& PDat, SDat.L1partChanges) Sim->ptrScheduler->fullUpdate(PDat.getParticle()); locdt += Sim->freestreamAcc; Sim->freestreamAcc = 0; BOOST_FOREACH(magnet::ClonePtr<OutputPlugin>& Ptr, Sim->outputPlugins) Ptr->eventUpdate(*this, SDat, locdt); }