Changeset 348557a in sasmodels
- Timestamp:
- Mar 16, 2016 11:41:50 AM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 5041682
- Parents:
- 91c5fdc
- Location:
- sasmodels/models
- Files:
-
- 1 added
- 1 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/hayter_msa.py
rec2ca99 r348557a 45 45 from numpy import inf 46 46 47 source = [" HayterMSAsq_kernel.c"]47 source = ["hayter_msa_kernel.c"] 48 48 49 name = " HayterMSAsq"49 name = "hayter_msa" 50 50 title = "Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor" 51 51 description = """\ … … 57 57 parameters used in P(Q). 58 58 """ 59 single = False # double precision only for now59 single = False # double precision only! 60 60 61 61 # pylint: disable=bad-whitespace, line-too-long … … 99 99 effect_radius_pd_n=40) 100 100 # 101 # attempt to use same values as old sasview unit test 101 # attempt to use same values as old sasview unit test at Q=.001 was 0.0712928, 102 # then add lots new ones assuming values from new model are OK, need some low Q values to test the small Q Taylor expansion 102 103 tests = [ 103 104 [{'scale': 1.0, … … 110 111 'dielectconst': 78.0, 111 112 'effect_radius_pd': 0}, 112 [0.0010], [0.0712928]] 113 [0.00001,0.0010,0.01,0.075], [0.0711646,0.0712928,0.0847006,1.07150]], 114 [{'scale': 1.0, 115 'background': 0.0, 116 'effect_radius': 20.75, 117 'charge': 19.0, 118 'volfraction': 0.0192, 119 'temperature': 298.0, 120 'saltconc': 0.05, 121 'dielectconst': 78.0, 122 'effect_radius_pd': 0.1, 123 'effect_radius_pd_n': 40}, 124 [0.00001,0.0010,0.01,0.075], [0.450272,0.450420,0.465116,1.039625]] 113 125 ] 114 126 -
sasmodels/models/hayter_msa_kernel.c
r48f0194 r348557a 45 45 // Kappa (Debye-Huckel screening length in m) 46 46 // and gamma Exp(-k) 47 48 // the zz*VolFrac/Vp is for the counterions from the micelle, assumed monovalent, the 2.0*cs if for added salt, assumed 1:1 electolyte 47 49 IonSt=0.5 * Elcharge*Elcharge*(zz*VolFrac/Vp+2.0*cs); 48 50 Kappa=sqrt(2*Beta*IonSt/Perm); //Kappa calc from Ionic strength … … 505 507 ak2 = akz*akz; 506 508 507 if (qq<=0.0) { 509 qk = qq/gMSAWave[13]; 510 q2k = qk*qk; 511 if (qk<=1.0e-08) { 508 512 SofQ = -1.0/gMSAWave[0]; 509 513 } else { 510 qk = qq/gMSAWave[13]; 511 q2k = qk*qk; 514 // this rescales Q.sigma = 2.Q.Radius, so is hard to predict the value to test the function 515 if (qk<=0.01) { 516 // try Taylor series expansion at small qk (RKH Feb 2016, with help from Mathematica), 517 // transition point may need to depend on precision of cpu used and ALAS on the values of some of the parameters ! 518 // note have adsorbed a factor 24 from SofQ= 519 // needs thorough test over wide range of parameter space! 520 // there seem to be some rounding issues here in single precision, must use double 521 aqk = gMSAWave[0]*(8.0+2.0*etaz) + 6*gMSAWave[1] -12.0*gMSAWave[3] 522 -24*(gekz*(1.0+akz) -ck*akz*gMSAWave[2] +gMSAWave[3]*(ck-1.0) +(gMSAWave[2]-gMSAWave[3]*akz)*sk )/ak2 523 +q2k*( -(gMSAWave[0]*(48.0+15.0*etaz) +40.0*gMSAWave[1])/60.0 +gMSAWave[3] 524 +(4.0/ak2)*(gekz*(9.0+7.0*akz) +ck*(9.0*gMSAWave[3] -7.0*gMSAWave[2]*akz) +sk*(9.0*gMSAWave[2] -7.0*gMSAWave[3]*akz)) ); 525 SofQ = 1.0/(1.0-gMSAWave[10]*aqk); 526 } else { 512 527 qk2 = 1.0/q2k; 513 528 qk3 = qk2/qk; 514 529 qqk = 1.0/(qk*(q2k+ak2)); 515 sink = sin(qk); 516 cosk = cos(qk); 530 SINCOS(qk,sink,cosk); 517 531 asink = akz*sink; 518 532 qcosk = qk*cosk; … … 525 539 aqk=aqk +gMSAWave[3]*(cosk-1.0)*qk2; 526 540 aqk=aqk -gekz*(asink+qcosk)*qqk; 527 SofQ = 1.0/(1.0 -e24*aqk);528 } 541 SofQ = 1.0/(1.0 -e24*aqk); 542 } } 529 543 return (SofQ); 530 544 } -
sasmodels/models/lamellar.py
reb69cce r348557a 99 99 oldname = 'LamellarModel' 100 100 oldpars = dict(sld='sld_bi', solvent_sld='sld_sol', thickness='bi_thick') 101 101 tests = [ 102 [ {'scale': 1.0, 'background' : 0.0, 'thickness' : 50.0, 'sld' : 1.0,'solvent_sld' : 6.3, 'thickness_pd' : 0.0, 103 }, [0.001], [882289.54309]] 104 ] 105 # ADDED by: converted by PAK? (or RKH?) ON: 16Mar2016 - RKH adding unit tests from sasview to early 2015 conversion 106 # [(qx1, qy1), (qx2, qy2), ...], [I(qx1,qy1), I(qx2,qy2), ...]],
Note: See TracChangeset
for help on using the changeset viewer.