Changeset f728001 in sasmodels
- Timestamp:
- Oct 23, 2017 12:34:11 AM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- ea60e08
- Parents:
- 31eea1f
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/angles.py
ref8e68c rf728001 38 38 39 39 # include unicode symbols in output, even if piping to a pager 40 sys.stdout = codecs.getwriter('utf8')(sys.stdout) 40 if sys.version_info[0] < 3: 41 sys.stdout = codecs.getwriter('utf8')(sys.stdout) 41 42 sp.init_printing(use_unicode=True) 42 43 -
sasmodels/models/bcc_paracrystal.c
rbecded3 rf728001 2 2 bcc_Zq(double qa, double qb, double qc, double dnn, double d_factor) 3 3 { 4 #if 0 // Equations as written in Matsuoka 5 const double a1 = (+qa + qb + qc)/2.0; 6 const double a2 = (-qa - qb + qc)/2.0; 7 const double a3 = (-qa + qb - qc)/2.0; 8 #else 9 const double a1 = (+qa + qb - qc)/2.0; 4 // Equations from Matsuoka 26-27-28, multiplied by |q| 5 const double a1 = (-qa + qb + qc)/2.0; 10 6 const double a2 = (+qa - qb + qc)/2.0; 11 const double a3 = (-qa + qb + qc)/2.0; 12 #endif 7 const double a3 = (+qa + qb - qc)/2.0; 13 8 14 #if 1 15 // Numerator: (1 - exp(a)^2)^3 16 // => (-(exp(2a) - 1))^3 17 // => -expm1(2a)^3 18 // Denominator: prod(1 - 2 cos(d ak) exp(a) + exp(2a)) 19 // => prod(exp(a)^2 - 2 cos(d ak) exp(a) + 1) 20 // => prod((exp(a) - 2 cos(d ak)) * exp(a) + 1) 9 #if 0 10 // Matsuoka 29-30-31 11 // Z_k numerator: 1 - exp(a)^2 12 // Z_k denominator: 1 - 2 cos(d a_k) exp(a) + exp(2a) 13 // Rewriting numerator 14 // => -(exp(2a) - 1) 15 // => -expm1(2a) 16 // Rewriting denominator 17 // => exp(a)^2 - 2 cos(d ak) exp(a) + 1) 18 // => (exp(a) - 2 cos(d ak)) * exp(a) + 1 21 19 const double arg = -0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 22 20 const double exp_arg = exp(arg); … … 25 23 * ((exp_arg - 2.0*cos(dnn*a2))*exp_arg + 1.0) 26 24 * ((exp_arg - 2.0*cos(dnn*a3))*exp_arg + 1.0)); 27 #else 28 // Alternate form, which perhaps is more approachable 29 const double arg = -0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 25 26 #elif 0 27 // ** Alternate form, which perhaps is more approachable 28 // Z_k numerator => -[(exp(2a) - 1) / 2.exp(a)] 2.exp(a) 29 // => -[sinh(a)] exp(a) 30 // Z_k denominator => [(exp(2a) + 1) / 2.exp(a) - cos(d a_k)] 2.exp(a) 31 // => [cosh(a) - cos(d a_k)] 2.exp(a) 32 // => Z_k = -sinh(a) / [cosh(a) - cos(d a_k)] 33 // = sinh(-a) / [cosh(-a) - cos(d a_k)] 34 // 35 // One more step leads to the form in sasview 3.x for 2d models 36 // = tanh(-a) / [1 - cos(d a_k)/cosh(-a)] 37 // 38 const double arg = 0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 30 39 const double sinh_qd = sinh(arg); 31 40 const double cosh_qd = cosh(arg); … … 33 42 * sinh_qd/(cosh_qd - cos(dnn*a2)) 34 43 * sinh_qd/(cosh_qd - cos(dnn*a3)); 44 #else 45 const double arg = 0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 46 const double tanh_qd = tanh(arg); 47 const double cosh_qd = cosh(arg); 48 const double Zq = tanh_qd/(1.0 - cos(dnn*a1)/cosh_qd) 49 * tanh_qd/(1.0 - cos(dnn*a2)/cosh_qd) 50 * tanh_qd/(1.0 - cos(dnn*a3)/cosh_qd); 35 51 #endif 36 52 -
sasmodels/models/fcc_paracrystal.c
rbecded3 rf728001 2 2 fcc_Zq(double qa, double qb, double qc, double dnn, double d_factor) 3 3 { 4 #if 0 // Equations as written in Matsuoka 5 const double a1 = ( qa + qb)/2.0; 6 const double a2 = (-qa + qc)/2.0; 7 const double a3 = (-qa + qb)/2.0; 8 #else 4 // Equations from Matsuoka 17-18-19, multiplied by |q| 9 5 const double a1 = ( qa + qb)/2.0; 10 6 const double a2 = ( qa + qc)/2.0; 11 7 const double a3 = ( qb + qc)/2.0; 12 #endif13 8 14 // Numerator: (1 - exp(a)^2)^3 15 // => (-(exp(2a) - 1))^3 16 // => -expm1(2a)^3 17 // Denominator: prod(1 - 2 cos(d ak) exp(a) + exp(2a)) 18 // => prod(exp(a)^2 - 2 cos(d ak) exp(a) + 1) 19 // => prod((exp(a) - 2 cos(d ak)) * exp(a) + 1) 9 // Matsuoka 23-24-25 10 // Z_k numerator: 1 - exp(a)^2 11 // Z_k denominator: 1 - 2 cos(d a_k) exp(a) + exp(2a) 12 // Rewriting numerator 13 // => -(exp(2a) - 1) 14 // => -expm1(2a) 15 // Rewriting denominator 16 // => exp(a)^2 - 2 cos(d ak) exp(a) + 1) 17 // => (exp(a) - 2 cos(d ak)) * exp(a) + 1 20 18 const double arg = -0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 21 19 const double exp_arg = exp(arg); -
sasmodels/models/sc_paracrystal.c
rbecded3 rf728001 2 2 sc_Zq(double qa, double qb, double qc, double dnn, double d_factor) 3 3 { 4 // Equations from Matsuoka 9-10-11, multiplied by |q| 4 5 const double a1 = qa; 5 6 const double a2 = qb; 6 7 const double a3 = qc; 7 8 8 // Numerator: (1 - exp(a)^2)^3 9 // => (-(exp(2a) - 1))^3 10 // => -expm1(2a)^3 11 // Denominator: prod(1 - 2 cos(d ak) exp(a) + exp(2a)) 12 // => prod(exp(a)^2 - 2 cos(d ak) exp(a) + 1) 13 // => prod((exp(a) - 2 cos(d ak)) * exp(a) + 1) 9 // Matsuoka 13-14-15 10 // Z_k numerator: 1 - exp(a)^2 11 // Z_k denominator: 1 - 2 cos(d a_k) exp(a) + exp(2a) 12 // Rewriting numerator 13 // => -(exp(2a) - 1) 14 // => -expm1(2a) 15 // Rewriting denominator 16 // => exp(a)^2 - 2 cos(d ak) exp(a) + 1) 17 // => (exp(a) - 2 cos(d ak)) * exp(a) + 1 14 18 const double arg = -0.5*square(dnn*d_factor)*(a1*a1 + a2*a2 + a3*a3); 15 19 const double exp_arg = exp(arg);
Note: See TracChangeset
for help on using the changeset viewer.