[f94d8a2] | 1 | /* |
---|
| 2 | Functions for WRC implementation of flexible cylinders |
---|
| 3 | */ |
---|
[ba32cdd] | 4 | double Sk_WR(double q, double L, double b); |
---|
| 5 | |
---|
| 6 | |
---|
[f94d8a2] | 7 | static double |
---|
| 8 | AlphaSquare(double x) |
---|
| 9 | { |
---|
[e7678b2] | 10 | // Potentially faster. Needs proper benchmarking. |
---|
| 11 | // add native_powr to kernel_template |
---|
| 12 | //double t = native_powr( (1.0 + (x/3.12)*(x/3.12) + |
---|
| 13 | // (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) ); |
---|
| 14 | //return t; |
---|
| 15 | |
---|
[4962519] | 16 | return pow(1.0+square(x/3.12)+cube(x/8.67), 0.176/3.0); |
---|
[f94d8a2] | 17 | } |
---|
| 18 | |
---|
| 19 | // |
---|
| 20 | static double |
---|
| 21 | Rgsquarezero(double q, double L, double b) |
---|
| 22 | { |
---|
[e7678b2] | 23 | const double r = b/L; |
---|
[4962519] | 24 | return (L*b/6.0) * (1.0 - r*(1.5 + r*(1.5 + r*0.75*expm1(-2.0/r)))); |
---|
[f94d8a2] | 25 | } |
---|
| 26 | |
---|
| 27 | // |
---|
| 28 | static double |
---|
| 29 | Rgsquareshort(double q, double L, double b) |
---|
| 30 | { |
---|
| 31 | return AlphaSquare(L/b) * Rgsquarezero(q,L,b); |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | // |
---|
| 35 | static double |
---|
| 36 | Rgsquare(double q, double L, double b) |
---|
| 37 | { |
---|
| 38 | return AlphaSquare(L/b)*L*b/6.0; |
---|
| 39 | } |
---|
| 40 | |
---|
[4962519] | 41 | static double |
---|
[f94d8a2] | 42 | sech_WR(double x) |
---|
| 43 | { |
---|
| 44 | return(1/cosh(x)); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | static double |
---|
| 48 | a1long(double q, double L, double b, double p1, double p2, double q0) |
---|
| 49 | { |
---|
[e7678b2] | 50 | double C; |
---|
[f94d8a2] | 51 | |
---|
| 52 | if( L/b > 10.0) { |
---|
| 53 | C = 3.06/pow((L/b),0.44); |
---|
| 54 | } else { |
---|
| 55 | C = 1.0; |
---|
| 56 | } |
---|
| 57 | |
---|
[e7678b2] | 58 | const double C1 = 1.22; |
---|
| 59 | const double C2 = 0.4288; |
---|
| 60 | const double C3 = -1.651; |
---|
| 61 | const double C4 = 1.523; |
---|
| 62 | const double C5 = 0.1477; |
---|
| 63 | const double miu = 0.585; |
---|
| 64 | |
---|
| 65 | const double Rg2 = Rgsquare(q,L,b); |
---|
| 66 | const double Rg22 = Rg2*Rg2; |
---|
| 67 | const double Rg = sqrt(Rg2); |
---|
| 68 | const double Rgb = Rg*q0/b; |
---|
[f94d8a2] | 69 | |
---|
[e7678b2] | 70 | const double b2 = b*b; |
---|
| 71 | const double b3 = b*b*b; |
---|
| 72 | const double b4 = b3*b; |
---|
| 73 | const double q02 = q0*q0; |
---|
| 74 | const double q03 = q0*q0*q0; |
---|
| 75 | const double q04 = q03*q0; |
---|
| 76 | const double q05 = q04*q0; |
---|
[f94d8a2] | 77 | |
---|
[e7678b2] | 78 | const double Rg02 = Rg2*q02; |
---|
[f94d8a2] | 79 | |
---|
[e7678b2] | 80 | const double t1 = (b*C*((4.0/15.0 - pow((double)M_E,(-(Rg02/b2))) * |
---|
| 81 | ((11.0/15.0 + (7.0*b2)/(15.0*Rg02))) + |
---|
| 82 | (7.0*b2)/(15.0*Rg02)))); |
---|
[f94d8a2] | 83 | |
---|
[e7678b2] | 84 | const double t2 = (2.0*b4*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + |
---|
[4962519] | 85 | Rg02/b2))*((1.0 + 0.5*(((-1.0) - |
---|
[e7678b2] | 86 | tanh((-C4 + Rgb/C5))))))); |
---|
[f94d8a2] | 87 | |
---|
[e7678b2] | 88 | const double t3 = ((C3*pow(Rgb,((-3.0)/miu)) + |
---|
| 89 | C2*pow(Rgb,((-2.0)/miu)) + |
---|
| 90 | C1*pow(Rgb,((-1.0)/miu)))); |
---|
[f94d8a2] | 91 | |
---|
[e7678b2] | 92 | const double t4 = ((1.0 + tanh(((-C4) + Rgb)/C5))); |
---|
[f94d8a2] | 93 | |
---|
[e7678b2] | 94 | const double t5 = (1.0/(b*p1*pow(q0,((-1.0) - p1 - p2)) - |
---|
| 95 | b*p2*pow(q0,((-1.0) - p1 - p2)))); |
---|
[f94d8a2] | 96 | |
---|
[e7678b2] | 97 | const double t6 = (b*C*(((-((14.0*b3)/(15.0*q03*Rg2))) + |
---|
| 98 | (14.0*b3*pow((double)M_E,(-(Rg02/b2))))/(15.0*q03*Rg2) + |
---|
| 99 | (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*((11.0/15.0 + |
---|
| 100 | (7.0*b2)/(15.0*Rg02)))*Rg2)/b))); |
---|
[f94d8a2] | 101 | |
---|
[e7678b2] | 102 | const double t7 = (Rg*((C3*pow(((Rgb)),((-3.0)/miu)) + |
---|
| 103 | C2*pow(((Rgb)),((-2.0)/miu)) + |
---|
| 104 | C1*pow(((Rgb)),((-1.0)/miu))))*pow(sech_WR(((-C4) + |
---|
| 105 | Rgb)/C5),2)); |
---|
[f94d8a2] | 106 | |
---|
[e7678b2] | 107 | const double t8 = (b4*Rg*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + |
---|
| 108 | Rg02/b2))*pow(sech_WR(((-C4) + Rgb)/C5),2)); |
---|
[f94d8a2] | 109 | |
---|
[e7678b2] | 110 | const double t9 = (2.0*b4*(((2.0*q0*Rg2)/b - |
---|
[4962519] | 111 | (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*Rg2)/b))*((1.0 + 0.5*(((-1.0) - |
---|
[e7678b2] | 112 | tanh(((-C4) + Rgb)/C5)))))); |
---|
[f94d8a2] | 113 | |
---|
[e7678b2] | 114 | const double t10 = (8.0*b4*b*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + |
---|
[4962519] | 115 | Rg02/b2))*((1.0 + 0.5*(((-1.0) - tanh(((-C4) + |
---|
[e7678b2] | 116 | Rgb)/C5)))))); |
---|
[f94d8a2] | 117 | |
---|
[e7678b2] | 118 | const double t11 = (((-((3.0*C3*Rg*pow(((Rgb)),((-1.0) - |
---|
| 119 | 3.0/miu)))/miu)) - (2.0*C2*Rg*pow(((Rgb)),((-1.0) - |
---|
| 120 | 2.0/miu)))/miu - (C1*Rg*pow(((Rgb)),((-1.0) - |
---|
| 121 | 1.0/miu)))/miu)); |
---|
[f94d8a2] | 122 | |
---|
[e7678b2] | 123 | const double t12 = ((1.0 + tanh(((-C4) + Rgb)/C5))); |
---|
[f94d8a2] | 124 | |
---|
[e7678b2] | 125 | const double t13 = (b*C*((4.0/15.0 - pow((double)M_E,(-(Rg02/b2)))*((11.0/15.0 + |
---|
| 126 | (7.0*b2)/(15.0*q02* Rg2))) + |
---|
| 127 | (7.0*b2)/(15.0*Rg02)))); |
---|
[f94d8a2] | 128 | |
---|
[e7678b2] | 129 | const double t14 = (2.0*b4*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + |
---|
[4962519] | 130 | Rg02/b2))*((1.0 + 0.5*(((-1.0) - tanh(((-C4) + |
---|
[e7678b2] | 131 | Rgb)/C5)))))); |
---|
[f94d8a2] | 132 | |
---|
[e7678b2] | 133 | const double t15 = ((C3*pow(((Rgb)),((-3.0)/miu)) + |
---|
| 134 | C2*pow(((Rgb)),((-2.0)/miu)) + |
---|
| 135 | C1*pow(((Rgb)),((-1.0)/miu)))); |
---|
[f94d8a2] | 136 | |
---|
[e7678b2] | 137 | |
---|
| 138 | double yy = (pow(q0,p1)*(((-((b*M_PI)/(L*q0))) +t1/L +t2/(q04*Rg22) + |
---|
[4962519] | 139 | 0.5*t3*t4)) + (t5*((pow(q0,(p1 - p2))* |
---|
[e7678b2] | 140 | (((-pow(q0,(-p1)))*(((b2*M_PI)/(L*q02) +t6/L +t7/(2.0*C5) - |
---|
[4962519] | 141 | t8/(C5*q04*Rg22) + t9/(q04*Rg22) -t10/(q05*Rg22) + 0.5*t11*t12)) - |
---|
[e7678b2] | 142 | b*p1*pow(q0,((-1.0) - p1))*(((-((b*M_PI)/(L*q0))) + t13/L + |
---|
[4962519] | 143 | t14/(q04*Rg22) + 0.5*t15*((1.0 + tanh(((-C4) + |
---|
[e7678b2] | 144 | Rgb)/C5))))))))))); |
---|
[f94d8a2] | 145 | |
---|
| 146 | return (yy); |
---|
| 147 | } |
---|
| 148 | |
---|
| 149 | static double |
---|
| 150 | a2long(double q, double L, double b, double p1, double p2, double q0) |
---|
| 151 | { |
---|
[e7678b2] | 152 | double C; |
---|
[f94d8a2] | 153 | |
---|
| 154 | if( L/b > 10.0) { |
---|
| 155 | C = 3.06/pow((L/b),0.44); |
---|
| 156 | } else { |
---|
| 157 | C = 1.0; |
---|
| 158 | } |
---|
| 159 | |
---|
[e7678b2] | 160 | const double C1 = 1.22; |
---|
| 161 | const double C2 = 0.4288; |
---|
| 162 | const double C3 = -1.651; |
---|
| 163 | const double C4 = 1.523; |
---|
| 164 | const double C5 = 0.1477; |
---|
| 165 | const double miu = 0.585; |
---|
| 166 | |
---|
| 167 | const double Rg2 = Rgsquare(q,L,b); |
---|
| 168 | const double Rg22 = Rg2*Rg2; |
---|
| 169 | const double b2 = b*b; |
---|
| 170 | const double b3 = b*b*b; |
---|
| 171 | const double b4 = b3*b; |
---|
| 172 | const double q02 = q0*q0; |
---|
| 173 | const double q03 = q0*q0*q0; |
---|
| 174 | const double q04 = q03*q0; |
---|
| 175 | const double q05 = q04*q0; |
---|
| 176 | const double Rg = sqrt(Rg2); |
---|
| 177 | const double Rgb = Rg*q0/b; |
---|
| 178 | const double Rg02 = Rg2*q02; |
---|
| 179 | |
---|
| 180 | const double t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - |
---|
| 181 | b*p2*pow(q0,((-1.0) - p1 - p2)) )); |
---|
| 182 | |
---|
| 183 | const double t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + |
---|
| 184 | (14.0*b3*pow((double)M_E,(-(Rg02/b2))))/(15.0*q03*Rg2) + |
---|
| 185 | (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*((11.0/15.0 + |
---|
| 186 | (7*b2)/(15.0*Rg02)))*Rg2)/b)))/L; |
---|
| 187 | |
---|
| 188 | const double t3 = (Rg*((C3*pow(((Rgb)),((-3.0)/miu)) + |
---|
| 189 | C2*pow(((Rgb)),((-2.0)/miu)) + |
---|
| 190 | C1*pow(((Rgb)),((-1.0)/miu))))* |
---|
| 191 | pow(sech_WR(((-C4) +Rgb)/C5),2.0))/(2.0*C5); |
---|
| 192 | |
---|
| 193 | const double t4 = (b4*Rg*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + |
---|
| 194 | Rg02/b2))*pow(sech_WR(((-C4) + |
---|
| 195 | Rgb)/C5),2))/(C5*q04*Rg22); |
---|
| 196 | |
---|
| 197 | const double t5 = (2.0*b4*(((2.0*q0*Rg2)/b - |
---|
| 198 | (2.0*pow((double)M_E,(-(Rg02/b2)))*q0*Rg2)/b))* |
---|
[4962519] | 199 | ((1.0 + 0.5*(((-1.0) - tanh(((-C4) + |
---|
[e7678b2] | 200 | Rgb)/C5))))))/(q04*Rg22); |
---|
| 201 | |
---|
| 202 | const double t6 = (8.0*b4*b*(((-1.0) + pow((double)M_E,(-(Rg02/b2))) + |
---|
[4962519] | 203 | Rg02/b2))*((1.0 + 0.5*(((-1) - tanh(((-C4) + |
---|
[e7678b2] | 204 | Rgb)/C5))))))/(q05*Rg22); |
---|
| 205 | |
---|
| 206 | const double t7 = (((-((3.0*C3*Rg*pow(((Rgb)),((-1.0) - |
---|
| 207 | 3.0/miu)))/miu)) - (2.0*C2*Rg*pow(((Rgb)), |
---|
| 208 | ((-1.0) - 2.0/miu)))/miu - (C1*Rg*pow(((Rgb)), |
---|
| 209 | ((-1.0) - 1.0/miu)))/miu)); |
---|
| 210 | |
---|
| 211 | const double t8 = ((1.0 + tanh(((-C4) + Rgb)/C5))); |
---|
| 212 | |
---|
| 213 | const double t9 = (b*C*((4.0/15.0 - pow((double)M_E,(-(Rg02/b2)))*((11.0/15.0 + |
---|
| 214 | (7.0*b2)/(15*Rg02))) + (7.0*b2)/(15.0*Rg02))))/L; |
---|
| 215 | |
---|
| 216 | const double t10 = (2.0*b4*(((-1) + pow((double)M_E,(-(Rg02/b2))) + |
---|
[4962519] | 217 | Rg02/b2))*((1.0 + 0.5*(((-1) - tanh(((-C4) + |
---|
[e7678b2] | 218 | Rgb)/C5))))))/(q04*Rg22); |
---|
| 219 | |
---|
| 220 | const double yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*M_PI)/(L*q02) + |
---|
[4962519] | 221 | t2 + t3 - t4 + t5 - t6 + 0.5*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))* |
---|
[e7678b2] | 222 | (((-((b*M_PI)/(L*q0))) + t9 + t10 + |
---|
[4962519] | 223 | 0.5*((C3*pow(((Rgb)),((-3.0)/miu)) + |
---|
[e7678b2] | 224 | C2*pow(((Rgb)),((-2.0)/miu)) + |
---|
| 225 | C1*pow(((Rgb)),((-1.0)/miu))))* |
---|
| 226 | ((1.0 + tanh(((-C4) + Rgb)/C5)))))))))); |
---|
[f94d8a2] | 227 | |
---|
| 228 | return (yy); |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | // |
---|
| 232 | static double |
---|
[e7678b2] | 233 | a_short(double q, double L, double b, double p1short, |
---|
| 234 | double p2short, double factor, double pdiff, double q0) |
---|
[f94d8a2] | 235 | { |
---|
[e7678b2] | 236 | const double Rg2_sh = Rgsquareshort(q,L,b); |
---|
| 237 | const double Rg2_sh2 = Rg2_sh*Rg2_sh; |
---|
| 238 | const double b3 = b*b*b; |
---|
| 239 | const double t1 = ((q0*q0*Rg2_sh)/(b*b)); |
---|
| 240 | const double Et1 = exp(t1); |
---|
| 241 | const double Emt1 = 1.0/Et1; |
---|
| 242 | const double q02 = q0*q0; |
---|
| 243 | const double q0p = pow(q0,(-4.0 + p1short) ); |
---|
| 244 | |
---|
| 245 | double yy = ((factor/(L*(pdiff)*Rg2_sh2)* |
---|
[f94d8a2] | 246 | ((b*Emt1*q0p*((8.0*b3*L - 8.0*b3*Et1*L - 2.0*b3*L*p2short + |
---|
| 247 | 2.0*b3*Et1*L*p2short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - |
---|
[e7678b2] | 248 | 2.0*b*Et1*L*p2short*q02*Rg2_sh - Et1*M_PI*q02*q0*Rg2_sh2 + |
---|
| 249 | Et1*p2short*M_PI*q02*q0*Rg2_sh2)))))); |
---|
[f94d8a2] | 250 | |
---|
| 251 | return(yy); |
---|
| 252 | } |
---|
[e7678b2] | 253 | static double |
---|
| 254 | a1short(double q, double L, double b, double p1short, double p2short, double q0) |
---|
| 255 | { |
---|
| 256 | |
---|
| 257 | double factor = 1.0; |
---|
| 258 | return a_short(q, L, b, p1short, p2short, factor, p1short - p2short, q0); |
---|
| 259 | } |
---|
[f94d8a2] | 260 | |
---|
| 261 | static double |
---|
| 262 | a2short(double q, double L, double b, double p1short, double p2short, double q0) |
---|
| 263 | { |
---|
[e7678b2] | 264 | double factor = -1.0; |
---|
| 265 | return a_short(q, L, b, p2short, p1short, factor, p1short-p2short, q0); |
---|
[f94d8a2] | 266 | } |
---|
| 267 | |
---|
| 268 | //WR named this w (too generic) |
---|
| 269 | static double |
---|
| 270 | w_WR(double x) |
---|
| 271 | { |
---|
| 272 | return 0.5*(1 + tanh((x - 1.523)/0.1477)); |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | // |
---|
| 276 | static double |
---|
| 277 | u1(double q, double L, double b) |
---|
| 278 | { |
---|
| 279 | return Rgsquareshort(q,L,b)*q*q; |
---|
| 280 | } |
---|
| 281 | |
---|
| 282 | static double |
---|
| 283 | u_WR(double q, double L, double b) |
---|
| 284 | { |
---|
| 285 | return Rgsquare(q,L,b)*q*q; |
---|
| 286 | } |
---|
| 287 | |
---|
[504abee] | 288 | static double |
---|
| 289 | Sdebye_kernel(double arg) |
---|
| 290 | { |
---|
| 291 | // ORIGINAL |
---|
[e7678b2] | 292 | double result = 2.0*(exp(-arg) + arg -1.0)/(arg*arg); |
---|
[504abee] | 293 | |
---|
| 294 | // CONVERSION 1 from http://herbie.uwplse.org/ |
---|
| 295 | // |
---|
| 296 | // exhibits discontinuity - needs more investigation |
---|
| 297 | //double a1 = 1.0/6.0; |
---|
| 298 | //double a2 = 1.0/72.0; |
---|
| 299 | //double a3 = 1.0/24.0; |
---|
| 300 | //double result = pow((1.0 - a1*arg - (a2+a3)*arg*arg), 2); |
---|
| 301 | |
---|
| 302 | return result; |
---|
| 303 | } |
---|
[f94d8a2] | 304 | static double |
---|
| 305 | Sdebye(double q, double L, double b) |
---|
| 306 | { |
---|
[504abee] | 307 | double arg = u_WR(q,L,b); |
---|
| 308 | return Sdebye_kernel(arg); |
---|
[f94d8a2] | 309 | } |
---|
| 310 | |
---|
| 311 | // |
---|
| 312 | static double |
---|
| 313 | Sdebye1(double q, double L, double b) |
---|
| 314 | { |
---|
[504abee] | 315 | double arg = u1(q,L,b); |
---|
| 316 | return Sdebye_kernel(arg); |
---|
| 317 | |
---|
[f94d8a2] | 318 | } |
---|
| 319 | |
---|
| 320 | // |
---|
| 321 | static double |
---|
| 322 | Sexv(double q, double L, double b) |
---|
| 323 | { |
---|
| 324 | |
---|
[e7678b2] | 325 | const double C1=1.22; |
---|
| 326 | const double C2=0.4288; |
---|
| 327 | const double C3=-1.651; |
---|
| 328 | const double miu = 0.585; |
---|
| 329 | const double qRg = q*sqrt(Rgsquare(q,L,b)); |
---|
| 330 | const double x = pow(qRg, -1.0/miu); |
---|
[f94d8a2] | 331 | |
---|
[e7678b2] | 332 | double yy = (1.0 - w_WR(qRg))*Sdebye(q,L,b) + |
---|
| 333 | w_WR(qRg)*x*(C1 + x*(C2 + x*C3)); |
---|
[f94d8a2] | 334 | return (yy); |
---|
| 335 | } |
---|
| 336 | |
---|
| 337 | |
---|
| 338 | static double |
---|
| 339 | Sexvnew(double q, double L, double b) |
---|
| 340 | { |
---|
[e7678b2] | 341 | double yy; |
---|
| 342 | |
---|
| 343 | const double C1 =1.22; |
---|
| 344 | const double C2 =0.4288; |
---|
| 345 | const double C3 =-1.651; |
---|
| 346 | const double miu = 0.585; |
---|
| 347 | const double del=1.05; |
---|
| 348 | const double qRg = q*sqrt(Rgsquare(q,L,b)); |
---|
| 349 | const double x = pow(qRg, -1.0/miu); |
---|
[f94d8a2] | 350 | |
---|
| 351 | |
---|
| 352 | //calculating the derivative to decide on the corection (cutoff) term? |
---|
| 353 | // I have modified this from WRs original code |
---|
[e7678b2] | 354 | const double qdel = (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q); |
---|
| 355 | const double C_star2 =(qdel >= 0.0) ? 0.0 : 1.0; |
---|
[f94d8a2] | 356 | |
---|
[e7678b2] | 357 | yy = (1.0 - w_WR(qRg))*Sdebye(q,L,b) + |
---|
| 358 | C_star2*w_WR(qRg)* |
---|
| 359 | x*(C1 + x*(C2 + x*C3)); |
---|
[f94d8a2] | 360 | |
---|
| 361 | return (yy); |
---|
| 362 | } |
---|
| 363 | |
---|
| 364 | double Sk_WR(double q, double L, double b) |
---|
| 365 | { |
---|
[e7678b2] | 366 | // |
---|
| 367 | const double p1 = 4.12; |
---|
| 368 | const double p2 = 4.42; |
---|
| 369 | const double p1short = 5.36; |
---|
| 370 | const double p2short = 5.62; |
---|
| 371 | const double q0 = 3.1; |
---|
[f94d8a2] | 372 | |
---|
[e7678b2] | 373 | double q0short = fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0); |
---|
| 374 | double Sexvmodify, ans; |
---|
[f94d8a2] | 375 | |
---|
[e7678b2] | 376 | const double C =(L/b > 10.0) ? 3.06/pow((L/b),0.44) : 1.0; |
---|
[f94d8a2] | 377 | |
---|
[e7678b2] | 378 | if( L > 4*b ) { // Longer Chains |
---|
| 379 | if (q*b <= 3.1) { //Modified by Yun on Oct. 15, |
---|
| 380 | Sexvmodify = Sexvnew(q, L, b); |
---|
| 381 | ans = Sexvmodify + C * (4.0/15.0 + 7.0/(15.0*u_WR(q,L,b)) - |
---|
[f94d8a2] | 382 | (11.0/15.0 + 7.0/(15.0*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L); |
---|
| 383 | |
---|
[e7678b2] | 384 | } else { //q(i)*b > 3.1 |
---|
| 385 | ans = a1long(q, L, b, p1, p2, q0)/(pow((q*b),p1)) + |
---|
| 386 | a2long(q, L, b, p1, p2, q0)/(pow((q*b),p2)) + M_PI/(q*L); |
---|
| 387 | } |
---|
| 388 | } else { //L <= 4*b Shorter Chains |
---|
| 389 | if (q*b <= fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0) ) { |
---|
| 390 | if (q*b<=0.01) { |
---|
| 391 | ans = 1.0 - Rgsquareshort(q,L,b)*(q*q)/3.0; |
---|
| 392 | } else { |
---|
| 393 | ans = Sdebye1(q,L,b); |
---|
| 394 | } |
---|
| 395 | } else { //q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3) |
---|
| 396 | ans = a1short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p1short)) + |
---|
| 397 | a2short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p2short)) + |
---|
| 398 | M_PI/(q*L); |
---|
| 399 | } |
---|
[f94d8a2] | 400 | } |
---|
| 401 | |
---|
| 402 | return(ans); |
---|
| 403 | } |
---|