void OPCollEnergyChange::A2ParticleChange(const PairEventData& PDat) { data[PDat.particle1_.getSpecies().getID()] .addVal(PDat.particle1_.getDeltaKE()); data[PDat.particle2_.getSpecies().getID()] .addVal(PDat.particle2_.getDeltaKE()); double p1Mass = PDat.particle1_.getSpecies().getMass(PDat.particle1_.getParticle().getID()); double p2Mass = PDat.particle2_.getSpecies().getMass(PDat.particle2_.getParticle().getID()); double mu = p1Mass * p2Mass / (p1Mass + p2Mass); specialhist.addVal((PDat.dP.nrm2() / (2.0 * mu)) - (PDat.vijold | PDat.dP)); collisionKE[mapkey(PDat.particle1_.getSpecies().getID(), PDat.particle2_.getSpecies().getID(), PDat.getType())] .addVal(Sim->dynamics.getLiouvillean().getParticleKineticEnergy(PDat.particle1_.getParticle()) -PDat.particle1_.getDeltaKE()); collisionKE[mapkey(PDat.particle2_.getSpecies().getID(), PDat.particle1_.getSpecies().getID(), PDat.getType())] .addVal(Sim->dynamics.getLiouvillean().getParticleKineticEnergy(PDat.particle2_.getParticle()) -PDat.particle2_.getDeltaKE()); }
PairEventData IThinThread::runEvent(Particle& p1, Particle& p2, Event iEvent) { ++Sim->eventCount; const double d = _diameter->getProperty(p1, p2); const double d2 = d * d; const double e = _e->getProperty(p1, p2); const double l = _lambda->getProperty(p1, p2); const double ld2 = d * l * d * l; const double wd = _wellDepth->getProperty(p1, p2); switch (iEvent._type) { case CORE: { PairEventData retVal = Sim->dynamics->SmoothSpheresColl(iEvent, e, d2, CORE); if (!isCaptured(p1, p2)) { retVal.setType(STEP_IN); ICapture::add(p1, p2); } return retVal; } case STEP_OUT: { PairEventData retVal = Sim->dynamics->SphereWellEvent(iEvent, -wd, ld2, 0); if (retVal.getType() != BOUNCE) ICapture::remove(p1, p2); return retVal; } default: M_throw() << "Unknown collision type"; } }
void IStepped::runEvent(Particle& p1, Particle& p2, const IntEvent& iEvent) { ++Sim->eventCount; const double length_scale = 0.5 * (_lengthScale->getProperty(p1.getID()) + _lengthScale->getProperty(p2.getID())); const double energy_scale = 0.5 * (_energyScale->getProperty(p1.getID()) + _energyScale->getProperty(p2.getID())); ICapture::const_iterator capstat = ICapture::find(ICapture::key_type(p1, p2)); const size_t old_step_ID = (capstat == ICapture::end()) ? 0 : capstat->second; const std::pair<double, double> step_bounds = _potential->getStepBounds(old_step_ID); size_t new_step_ID; size_t edge_ID; double diameter; switch (iEvent.getType()) { case STEP_OUT: { new_step_ID = _potential->outer_step_ID(old_step_ID); edge_ID = _potential->outer_edge_ID(old_step_ID); diameter = step_bounds.second * length_scale; break; } case STEP_IN: { new_step_ID = _potential->inner_step_ID(old_step_ID); edge_ID = _potential->inner_edge_ID(old_step_ID); diameter = step_bounds.first * length_scale; break; } default: M_throw() << "Unknown event type"; } PairEventData retVal = Sim->dynamics->SphereWellEvent(iEvent, _potential->getEnergyChange(new_step_ID, old_step_ID) * energy_scale, diameter * diameter, new_step_ID); EdgeData& data = _edgedata[std::pair<size_t, EEventType>(edge_ID, retVal.getType())]; ++data.counter; data.rdotv_sum += retVal.rvdot; //Check if the particles changed their step ID if (retVal.getType() != BOUNCE) ICapture::operator[](ICapture::key_type(p1, p2)) = new_step_ID; Sim->_sigParticleUpdate(retVal); Sim->ptrScheduler->fullUpdate(p1, p2); for (shared_ptr<OutputPlugin> & Ptr : Sim->outputPlugins) Ptr->eventUpdate(iEvent, retVal); }
PairEventData ISWSequence::runEvent(Particle& p1, Particle& p2, Event iEvent) { ++Sim->eventCount; const double e = _e->getProperty(p1, p2); const double d = _diameter->getProperty(p1, p2); const double d2 = d * d; const double l = _lambda->getProperty(p1, p2); const double ld2 = d * l * d * l; const double pairenergy = alphabet[sequence[p1.getID() % sequence.size()]][sequence[p2.getID() % sequence.size()]] * _unitEnergy->getMaxValue(); PairEventData retVal; switch (iEvent._type) { case CORE: { retVal = Sim->dynamics->SmoothSpheresColl(iEvent, e, d2, CORE); break; } case STEP_IN: { retVal = Sim->dynamics->SphereWellEvent(iEvent, pairenergy, ld2, 1); if (retVal.getType() != BOUNCE) ICapture::add(p1, p2); break; } case STEP_OUT: { retVal = Sim->dynamics->SphereWellEvent(iEvent, -pairenergy, ld2, 0); if (retVal.getType() != BOUNCE) ICapture::remove(p1, p2); break; } default: M_throw() << "Unknown collision type"; } return retVal; }
void IStepped::runEvent(const Particle& p1, const Particle& p2, const IntEvent& iEvent) const { ++Sim->eventCount; switch (iEvent.getType()) { case WELL_OUT: { cmap_it capstat = getCMap_it(p1,p2); double d = steps[capstat->second-1].first * _unitLength->getMaxValue(); double d2 = d * d; double dE = steps[capstat->second-1].second; if (capstat->second > 1) dE -= steps[capstat->second - 2].second; dE *= _unitEnergy->getMaxValue(); PairEventData retVal(Sim->dynamics.getLiouvillean().SphereWellEvent (iEvent, dE, d2)); if (retVal.getType() != BOUNCE) if (!(--capstat->second)) //capstat is zero so delete captureMap.erase(capstat); Sim->signalParticleUpdate(retVal); Sim->ptrScheduler->fullUpdate(p1, p2); BOOST_FOREACH(magnet::ClonePtr<OutputPlugin> & Ptr, Sim->outputPlugins) Ptr->eventUpdate(iEvent, retVal); break; } case WELL_IN: { cmap_it capstat = getCMap_it(p1, p2); if (capstat == captureMap.end()) capstat = captureMap.insert (captureMapType::value_type ((p1.getID() < p2.getID()) ? cMapKey(p1.getID(), p2.getID()) : cMapKey(p2.getID(), p1.getID()), 0)).first; double d = steps[capstat->second].first * _unitLength->getMaxValue(); double d2 = d * d; double dE = steps[capstat->second].second; if (capstat->second > 0) dE -= steps[capstat->second - 1].second; dE *= _unitEnergy->getMaxValue(); PairEventData retVal = Sim->dynamics.getLiouvillean().SphereWellEvent(iEvent, -dE, d2); if (retVal.getType() != BOUNCE) ++(capstat->second); else if (!capstat->second) captureMap.erase(capstat); Sim->signalParticleUpdate(retVal); Sim->ptrScheduler->fullUpdate(p1, p2); BOOST_FOREACH(magnet::ClonePtr<OutputPlugin> & Ptr, Sim->outputPlugins) Ptr->eventUpdate(iEvent, retVal); break; } default: M_throw() << "Unknown collision type"; } }