Changeset e44432d in sasmodels for sasmodels/models
- Timestamp:
- Oct 19, 2018 3:46:26 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- be43e39
- Parents:
- 2586ab72
- Location:
- sasmodels/models
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hollow_cylinder.c
ree60aa7 re44432d 2 2 3 3 static double 4 _fq(double qab, double qc, 5 double radius, double thickness, double length) 4 shell_volume(double radius, double thickness, double length) 6 5 { 7 const double lam1 = sas_2J1x_x((radius+thickness)*qab); 8 const double lam2 = sas_2J1x_x(radius*qab); 9 const double gamma_sq = square(radius/(radius+thickness)); 10 //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab) 11 //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab) 12 const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 13 const double t2 = sas_sinx_x(0.5*length*qc); 14 return psi*t2; 15 } 16 17 // TODO: interface to form_volume/shell_volume not yet settled 18 static double 19 shell_volume(double *total, double radius, double thickness, double length) 20 { 21 *total = M_PI*length*square(radius+thickness); 22 return *total - M_PI*length*radius*radius; 6 return M_PI*length*(square(radius+thickness) - radius*radius); 23 7 } 24 8 … … 26 10 form_volume(double radius, double thickness, double length) 27 11 { 28 double total; 29 return shell_volume(&total, radius, thickness, length); 12 return M_PI*length*square(radius+thickness); 30 13 } 31 14 … … 62 45 } 63 46 47 static double 48 _fq(double qab, double qc, 49 double radius, double thickness, double length) 50 { 51 const double lam1 = sas_2J1x_x((radius+thickness)*qab); 52 const double lam2 = sas_2J1x_x(radius*qab); 53 const double gamma_sq = square(radius/(radius+thickness)); 54 //Note: lim_{thickness -> 0} psi = sas_J0(radius*qab) 55 //Note: lim_{radius -> 0} psi = sas_2J1x_x(thickness*qab) 56 const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 57 const double t2 = sas_sinx_x(0.5*length*qc); 58 return psi*t2; 59 } 60 64 61 static void 65 62 Fq(double q, double *F1, double *F2, double radius, double thickness, double length, … … 81 78 total_F1 *= 0.5*(upper-lower); 82 79 total_F2 *= 0.5*(upper-lower); 83 const double s = (sld - solvent_sld) * form_volume(radius, thickness, length);80 const double s = (sld - solvent_sld) * shell_volume(radius, thickness, length); 84 81 *F1 = 1e-2 * s * total_F1; 85 82 *F2 = 1e-4 * s*s * total_F2; … … 93 90 { 94 91 const double form = _fq(qab, qc, radius, thickness, length); 95 const double s = (sld - solvent_sld) * form_volume(radius, thickness, length);92 const double s = (sld - solvent_sld) * shell_volume(radius, thickness, length); 96 93 return 1.0e-4*square(s * form); 97 94 } -
sasmodels/models/hollow_rectangular_prism.c
ree60aa7 re44432d 1 // TODO: interface to form_volume/shell_volume not yet settled2 1 static double 3 shell_volume(double *total, doublelength_a, double b2a_ratio, double c2a_ratio, double thickness)2 shell_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 4 3 { 5 double length_b = length_a * b2a_ratio;6 double length_c = length_a * c2a_ratio;7 double a_core = length_a - 2.0*thickness;8 double b_core = length_b- 2.0*thickness;9 double c_core = length_c- 2.0*thickness;10 double vol_core = a_core * b_core * c_core;11 *total = length_a * length_b * length_c;12 return *total - vol_core;4 const double length_b = length_a * b2a_ratio; 5 const double length_c = length_a * c2a_ratio; 6 const double form_volume = length_a * length_b * length_c; 7 const double a_core = length_a - 2.0*thickness; 8 const double b_core = length_b - 2.0*thickness; 9 const double c_core = length_c - 2.0*thickness; 10 const double core_volume = a_core * b_core * c_core; 11 return form_volume - core_volume; 13 12 } 14 13 … … 16 15 form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 17 16 { 18 double total; 19 return shell_volume(&total, length_a, b2a_ratio, c2a_ratio, thickness); 17 const double length_b = length_a * b2a_ratio; 18 const double length_c = length_a * c2a_ratio; 19 const double form_volume = length_a * length_b * length_c; 20 return form_volume; 20 21 } 21 22 22 23 static double 23 24 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 24 //effective_radius_type = ["equivalent sphere","half length_a", "half length_b", "half length_c",25 // "equivalent outer circular cross-section","half ab diagonal","half diagonal"]26 25 // NOTE length_a is external dimension! 27 26 { -
sasmodels/models/hollow_rectangular_prism_thin_walls.c
ree60aa7 re44432d 1 // TODO: interface to form_volume/shell_volume not yet settled2 1 static double 3 shell_volume(double *total, doublelength_a, double b2a_ratio, double c2a_ratio)2 shell_volume(double length_a, double b2a_ratio, double c2a_ratio) 4 3 { 5 double length_b = length_a * b2a_ratio; 6 double length_c = length_a * c2a_ratio; 7 double vol_shell = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); 8 *total = length_a * length_b * length_c; 9 return vol_shell; 4 const double length_b = length_a * b2a_ratio; 5 const double length_c = length_a * c2a_ratio; 6 const double shell_volume = 2.0 * (length_a*length_b + length_a*length_c + length_b*length_c); 7 return shell_volume; 10 8 } 11 9 … … 13 11 form_volume(double length_a, double b2a_ratio, double c2a_ratio) 14 12 { 15 double total; 16 return shell_volume(&total, length_a, b2a_ratio, c2a_ratio); 13 const double length_b = length_a * b2a_ratio; 14 const double length_c = length_a * c2a_ratio; 15 const double form_volume = length_a * length_b * length_c; 16 return form_volume; 17 17 } 18 19 18 20 19 static double -
sasmodels/models/vesicle.c
ree60aa7 re44432d 1 // TODO: interface to form_volume/shell_volume not yet settled2 1 static double 3 shell_volume(double *total, doubleradius, double thickness)2 shell_volume(double radius, double thickness) 4 3 { 5 //note that for the vesicle model, the volume is ONLY the shell volume 6 *total = M_4PI_3 * cube(radius+thickness); 7 return *total - M_4PI_3*cube(radius); 4 return M_4PI_3 * (cube(radius+thickness) - cube(radius)); 8 5 } 9 6 … … 11 8 form_volume(double radius, double thickness) 12 9 { 13 //note that for the vesicle model, the volume is ONLY the shell volume 14 double total; 15 return shell_volume(&total, radius, thickness); 10 return M_4PI_3 * cube(radius+thickness); 16 11 } 12 17 13 18 14 static double
Note: See TracChangeset
for help on using the changeset viewer.