inline real InterpolationCubic::splineInterpolation(real r, const real* fn, const real* fn2) const { int index = static_cast<int>((r - inner) * invdelta); if (index < 0) { LOG4ESPP_ERROR(theLogger, "distance " << r << " out of range " << inner << " - " << inner + (N - 1) * delta); index = 0; } else if (index >= N) { LOG4ESPP_ERROR(theLogger, "distance " << r << " out of range " << inner << " - " << inner + (N - 1) * delta); index = N-1; } real b = (r - radius[index]) * invdelta; real a = 1.0 - b; real f = a * fn[index] + b * fn[index+1] + ((a*a*a-a)*fn2[index] + (b*b*b-b)*fn2[index+1]) * deltasq6; // printf("interpoloate %f, a = %f, b = %f, fn = %f - %f, fn2 = %f - %f\n", // r, a, b, fn[index], fn[index+1], fn2[index], fn2[index+1]); return f; }
void setPotential(shared_ptr < Potential> _potential) { if (_potential) { potential = _potential; } else { LOG4ESPP_ERROR(theLogger, "NULL potential"); } }
FixedTripleAngleListInteractionTemplate (shared_ptr < System > _system, shared_ptr < FixedTripleAngleList > _fixedtripleList, shared_ptr < Potential > _potential) : SystemAccess(_system), fixedtripleList(_fixedtripleList), potential(_potential) { if(! potential){ LOG4ESPP_ERROR(theLogger, "NULL potential"); } }
inline real InterpolationAkima::splineInterpolation(real r, const real* p0, const real* p1, const real* p2, const real* p3) const { int index; index = static_cast<int>((r - inner) * invdelta); if (index < 0) { LOG4ESPP_ERROR(theLogger, "distance " << r << " out of range " << inner << " - " << inner + (N - 1) * delta); index = 0; } if (index >= N) { LOG4ESPP_ERROR(theLogger, "distance " << r << " out of range " << inner << " - " << inner + (N - 1) * delta); index = N-1; } real z = r - radius[index]; int zz2 = z*z; return p0[index] + p1[index] * z + p2[index] * zz2 + p3[index] * zz2 * z; }
void FixedListComm::afterRecvParticles (ParticleList &pl,InBuffer& buf) { std::vector<longint> received, pids; int n, l, tl; longint pid1; GlobalList::iterator it = globalLists.begin(); // receive the bond list buf.read(received); int size = received.size(); int i = 0; while (i < size) { // unpack the list pid1 = received[i++]; n = received[i++]; l = received[i++]; LOG4ESPP_DEBUG(theLogger, "recv particle " << pid1 << ", has " << n << " global pairs"); for (; n > 0; --n) { for (tl = l; tl > 0; --tl) { pids.push_back(received[i++]); } // add the bond to the global list LOG4ESPP_DEBUG(theLogger, "received vector for pid " << pid1); it = globalLists.insert(it, std::make_pair(pid1, pids)); pids.clear(); } } if (i != size) { LOG4ESPP_ERROR(theLogger, "recv particles might have read garbage\n"); } LOG4ESPP_INFO(theLogger, "received fixed particle list after receive particles"); }