// NOTE that "length" here is the full height of the core! static double form_volume(double r_minor, double x_core, double thick_rim, double thick_face, double length) { return M_PI*( (r_minor + thick_rim)*(r_minor*x_core + thick_rim)* length + square(r_minor)*x_core*2.0*thick_face ); } static double radius_from_excluded_volume(double r_minor, double x_core, double thick_rim, double thick_face, double length) { const double r_equiv = sqrt((r_minor + thick_rim)*(r_minor*x_core + thick_rim)); const double length_tot = length + 2.0*thick_face; return 0.5*cbrt(0.75*r_equiv*(2.0*r_equiv*length_tot + (r_equiv + length_tot)*(M_PI*r_equiv + length_tot))); } static double radius_from_volume(double r_minor, double x_core, double thick_rim, double thick_face, double length) { const double volume_bicelle = form_volume(r_minor, x_core, thick_rim,thick_face,length); return cbrt(volume_bicelle/M_4PI_3); } static double radius_from_diagonal(double r_minor, double x_core, double thick_rim, double thick_face, double length) { const double radius_max = (x_core < 1.0 ? r_minor : x_core*r_minor); const double radius_max_tot = radius_max + thick_rim; const double length_tot = length + 2.0*thick_face; return sqrt(radius_max_tot*radius_max_tot + 0.25*length_tot*length_tot); } static double effective_radius(int mode, double r_minor, double x_core, double thick_rim, double thick_face, double length) { switch (mode) { default: case 1: // equivalent cylinder excluded volume return radius_from_excluded_volume(r_minor, x_core, thick_rim, thick_face, length); case 2: // equivalent sphere return radius_from_volume(r_minor, x_core, thick_rim, thick_face, length); case 3: // outer rim average radius return 0.5*r_minor*(1.0 + x_core) + thick_rim; case 4: // outer rim min radius return (x_core < 1.0 ? x_core*r_minor+thick_rim : r_minor+thick_rim); case 5: // outer max radius return (x_core > 1.0 ? x_core*r_minor+thick_rim : r_minor+thick_rim); case 6: // half outer thickness return 0.5*length + thick_face; case 7: // half diagonal (this ignores the missing "corners", so may give unexpected answer if thick_face // or thick_rim is extremely large) return radius_from_diagonal(r_minor,x_core,thick_rim,thick_face,length); } } static void Fq(double q, double *F1, double *F2, double r_minor, double x_core, double thick_rim, double thick_face, double length, double rhoc, double rhoh, double rhor, double rhosolv, double sigma) { // core_shell_bicelle_elliptical_belt, RKH 5th Oct 2017, core_shell_bicelle_elliptical // tested briefly against limiting cases of cylinder, hollow cylinder & elliptical cylinder models // const double uplim = M_PI_4; const double halfheight = 0.5*length; //const double va = 0.0; //const double vb = 1.0; // inner integral limits //const double vaj=0.0; //const double vbj=M_PI; const double r_major = r_minor * x_core; const double r2A = 0.5*(square(r_major) + square(r_minor)); const double r2B = 0.5*(square(r_major) - square(r_minor)); const double vol1 = M_PI*r_minor*r_major*(2.0*halfheight); const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*halfheight; const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); // dr1,2,3 are now for Vcore, Vcore+rim, Vcore+face, const double dr1 = vol1*(-rhor - rhoh + rhoc + rhosolv); const double dr2 = vol2*(rhor-rhosolv); const double dr3 = vol3*(rhoh-rhosolv); //initialize integral double outer_total_F1 = 0.0; double outer_total_F2 = 0.0; for(int i=0;i