void potential_double(int *ndim,double *pos,double *acc,double *pot,double *time) { double theta, sintheta, costheta, xi, mu, f1val, f2val, quant, psi; costheta = pos[Z] / sqrt(pos[X]*pos[X] + pos[Y]*pos[Y] + pos[Z]*pos[Z]); if(pos[Z] >= 0) { theta = acos(costheta); sintheta = cos(PI/2.0 - theta); } else { theta = -acos(costheta); sintheta = cos(PI/2.0 - theta); } psi = atan2(pos[Y],pos[X]); xi = sqrt(pos[X]*pos[X] + pos[Y]*pos[Y] + pos[Z]*pos[Z])/a; quant = 1.0 + xi*xi; mu = (2.0*xi*sintheta)/quant; // Calculate the integrals f1val = f1(mu); f2val = f2(mu); // The energy (FIX THIS, it doesn't matter unless you want to separate out parts of the tail) *pot = ((-G*ringmass)/(2*PI)) * fenergy(pos[X],pos[Y],pos[Z],a); // The accelerations double accmag; accmag = (-G*ringmass / (PI*a*a)) * (xi*sintheta*pow(quant, -1.5)*f1val - pow(quant, -1.5)*f2val); acc[X] = accmag*cos(psi); acc[Y] = accmag*sin(psi); acc[Z] = (-G*ringmass / (PI*a*a)) * (xi*costheta*pow(quant, -1.5)*f1val); }
inline double fpower(double f) const { return fenergy(f)/(double)Signal::size; }