- Timestamp:
- Dec 12, 2017 1:08:07 PM (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:
- c11d09f
- Parents:
- cfa28d3
- Location:
- explore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/asymint.py
ra189283 ra1c32c2 223 223 DA, DB, DC = 2300, 21, 58 224 224 SLDA, SLDB, SLDC = "5", "-0.3", "11.5" 225 #A,B,C,DA,DB,DC,SLDA,SLDB,SLDC = 10,20,30,100,200,300,1,2,3 226 #SLD_SOLVENT,CONTRAST = 0, 4 225 227 if 1: # C shortest 226 228 B, C = C, B -
explore/realspace.py
rcfa28d3 ra1c32c2 7 7 from numpy import pi, radians, sin, cos, sqrt 8 8 from numpy.random import poisson, uniform 9 from numpy.polynomial.legendre import leggauss 9 10 from scipy.integrate import simps 10 11 from scipy.special import j1 as J1 … … 362 363 363 364 def cylinder_Iq(q, radius, length): 364 height = length/2 365 z, w = leggauss(76) 366 cos_alpha = (z+1)/2 367 sin_alpha = sqrt(1.0 - cos_alpha**2) 365 368 Iq = np.empty_like(q) 366 theta = np.linspace(0.0, pi/2, 500)367 369 for k, qk in enumerate(q): 368 qab, qc = qk*sin(theta), qk*cos(theta) 369 Iq[k] = simps((j0(qc*height)*sas_2J1x_x(qab*radius))**2 * sin(theta)) 370 qab, qc = qk*sin_alpha, qk*cos_alpha 371 Fq = sas_2J1x_x(qab*radius) * j0(qc*length/2) 372 Iq[k] = np.sum(w*Fq**2) 370 373 Iq = Iq/Iq[0] 371 374 return Iq … … 376 379 377 380 def csbox_Iq(q, a, b, c, da, db, dc, slda, sldb, sldc, sld_core): 381 z, w = leggauss(76) 382 378 383 sld_solvent = 0 379 384 overlapping = False … … 382 387 tA, tB, tC = a + 2*da, b + 2*db, c + 2*dc 383 388 384 Iq= np.zeros_like(q)385 for cos_alpha in np.linspace(0.0, 1.0, 100):389 outer_sum = np.zeros_like(q) 390 for cos_alpha, outer_w in zip((z+1)/2, w): 386 391 sin_alpha = sqrt(1.0-cos_alpha*cos_alpha) 387 392 qc = q*cos_alpha 388 393 siC = c*j0(c*qc/2) 389 394 siCt = tC*j0(tC*qc/2) 390 for beta in np.linspace(0.0, pi/2, 100): 395 inner_sum = np.zeros_like(q) 396 for beta, inner_w in zip((z + 1)*pi/4, w): 391 397 qa, qb = q*sin_alpha*sin(beta), q*sin_alpha*cos(beta) 392 398 siA = a*j0(a*qa/2) … … 395 401 siBt = tB*j0(tB*qb/2) 396 402 if overlapping: 397 Iq += (dr0*siA*siB*siC398 399 400 + drC*siAt*siBt*(siCt-siC))**2403 Fq = (dr0*siA*siB*siC 404 + drA*(siAt-siA)*siB*siC 405 + drB*siAt*(siBt-siB)*siC 406 + drC*siAt*siBt*(siCt-siC)) 401 407 else: 402 Iq += (dr0*siA*siB*siC 403 + drA*(siAt-siA)*siB*siC 404 + drB*siA*(siBt-siB)*siC 405 + drC*siA*siB*(siCt-siC))**2 408 Fq = (dr0*siA*siB*siC 409 + drA*(siAt-siA)*siB*siC 410 + drB*siA*(siBt-siB)*siC 411 + drC*siA*siB*(siCt-siC)) 412 inner_sum += inner_w * Fq**2 413 outer_sum += outer_w * inner_sum 414 Iq = outer_sum / 4 # = outer*um*zm*8.0/(4.0*M_PI) 406 415 return Iq/Iq[0] 407 416
Note: See TracChangeset
for help on using the changeset viewer.