1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma IgorVersion = 6.0 |
---|
3 | |
---|
4 | //////////////////////////////////////////////// |
---|
5 | // GaussUtils.ipf is not necessary (no smearing calculations done) PlotUtils.ipf is recommended |
---|
6 | //////////////////////////////////////////////// |
---|
7 | // |
---|
8 | // this function calculates the interparticle structure factor for spherical particles interacting |
---|
9 | // through a square well potential. |
---|
10 | // |
---|
11 | // 06 NOV 98 SRK |
---|
12 | //////////////////////////////////////////////// |
---|
13 | |
---|
14 | Proc PlotSquareWellStruct(num,qmin,qmax) |
---|
15 | Variable num=128,qmin=0.001,qmax=0.3 |
---|
16 | Prompt num "Enter number of data points for model: " |
---|
17 | Prompt qmin "Enter minimum q-value (^-1) for model: " |
---|
18 | Prompt qmax "Enter maximum q-value (^-1) for model: " |
---|
19 | |
---|
20 | Make/O/D/n=(num) xwave_sws,ywave_sws |
---|
21 | xwave_sws = alog(log(qmin) + x*((log(qmax)-log(qmin))/num)) |
---|
22 | Make/O/D coef_sws = {50,0.04,1.5,1.2} |
---|
23 | make/o/t parameters_sws = {"Radius (A)","vol fraction","well depth (kT)","well width (diameters)"} |
---|
24 | Edit parameters_sws,coef_sws |
---|
25 | Variable/G root:g_sws |
---|
26 | g_sws := SquareWellStruct(coef_sws,ywave_sws,xwave_sws) |
---|
27 | // ywave_sws := SquareWellStruct(coef_sws,xwave_sws) |
---|
28 | Display ywave_sws vs xwave_sws |
---|
29 | ModifyGraph marker=29,msize=2,mode=4 |
---|
30 | Label bottom "q (\\S-1\\M)" |
---|
31 | Label left "Structure Factor" |
---|
32 | AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) |
---|
33 | End |
---|
34 | |
---|
35 | //AAO version |
---|
36 | Function SquareWellStruct(cw,yw,xw) : FitFunc |
---|
37 | Wave cw,yw,xw |
---|
38 | |
---|
39 | #if exists("SquareWellStructX") |
---|
40 | yw = SquareWellStructX(cw,xw) |
---|
41 | #else |
---|
42 | yw = fSquareWellStruct(cw,xw) |
---|
43 | #endif |
---|
44 | return(0) |
---|
45 | End |
---|
46 | /////////////////////////////////////////////////////////// |
---|
47 | // smearing a structure factor is not appropriate, so it's not done |
---|
48 | /////////////////////////////////////////////////////////////// |
---|
49 | // unsmeared model calculation |
---|
50 | /////////////////////////// |
---|
51 | Function fSquareWellStruct(w,x) : FitFunc |
---|
52 | Wave w |
---|
53 | Variable x |
---|
54 | |
---|
55 | // SUBROUTINE SQWELL: CALCULATES THE STRUCTURE FACTOR FOR A |
---|
56 | // DISPERSION OF MONODISPERSE HARD SPHERES |
---|
57 | // IN THE Mean Spherical APPROXIMATION ASSUMING THE SPHERES |
---|
58 | // INTERACT THROUGH A SQUARE WELL POTENTIAL. |
---|
59 | //** not the best choice of closure ** see note below |
---|
60 | // REFS: SHARMA,SHARMA, PHYSICA 89A,(1977),212 |
---|
61 | // |
---|
62 | // |
---|
63 | |
---|
64 | // NOTE - depths >1.5kT and volume fractions > 0.08 give UNPHYSICAL RESULTS |
---|
65 | // when compared to Monte Carlo simulations |
---|
66 | |
---|
67 | // Input variables are: |
---|
68 | //[0] radius |
---|
69 | //[1] volume fraction |
---|
70 | //[2] well depth e/kT, dimensionless, +ve depths are attractive |
---|
71 | //[3] well width, multiples of diameter |
---|
72 | |
---|
73 | Variable req,phis,edibkb,lambda,struc |
---|
74 | req = w[0] |
---|
75 | phis = w[1] |
---|
76 | edibkb = w[2] |
---|
77 | lambda = w[3] |
---|
78 | |
---|
79 | // COMPUTE CONSTANTS |
---|
80 | // local variables |
---|
81 | Variable sigma,eta,eta2,eta3,eta4,etam1,etam14,alpha,beta,gamma |
---|
82 | Variable qvs,sk,sk2,sk3,sk4,t1,t2,t3,t4,ck |
---|
83 | |
---|
84 | SIGMA = req*2. |
---|
85 | ETA = phis |
---|
86 | ETA2 = ETA*ETA |
---|
87 | ETA3 = ETA*ETA2 |
---|
88 | ETA4 = ETA*ETA3 |
---|
89 | ETAM1 = 1. - ETA |
---|
90 | ETAM14 = ETAM1*ETAM1*ETAM1*ETAM1 |
---|
91 | ALPHA = ( ( (1. + 2.*ETA)^2 ) + ETA3*( ETA-4.0 ) )/ETAM14 |
---|
92 | BETA = -(ETA/3.0) * ( 18. + 20.*ETA - 12.*ETA2 + ETA4 )/ETAM14 |
---|
93 | GAMMA = 0.5*ETA*( (1. + 2.*ETA)^2 + ETA3*(ETA-4.) )/ETAM14 |
---|
94 | // |
---|
95 | // CALCULATE THE STRUCTURE FACTOR |
---|
96 | // |
---|
97 | // the loop over q-values used to be here |
---|
98 | // DO 20 I=1,NPTSM |
---|
99 | QVS = x |
---|
100 | SK = x*SIGMA |
---|
101 | SK2 = SK*SK |
---|
102 | SK3 = SK*SK2 |
---|
103 | SK4 = SK3*SK |
---|
104 | T1 = ALPHA * SK3 * ( SIN(SK) - SK * COS(SK) ) |
---|
105 | T2 = BETA * SK2 * ( 2.*SK*SIN(SK) - (SK2-2.)*COS(SK) - 2.0 ) |
---|
106 | T3 = ( 4.0*SK3 - 24.*SK ) * SIN(SK) |
---|
107 | T3 = T3 - ( SK4 - 12.0*SK2 + 24.0 )*COS(SK) + 24.0 |
---|
108 | T3 = GAMMA*T3 |
---|
109 | T4 = -EDIBKB*SK3*(SIN(LAMBDA*SK) - LAMBDA*SK*COS(LAMBDA*SK)+ SK*COS(SK) - SIN(SK) ) |
---|
110 | CK = -24.0*ETA*( T1 + T2 + T3 + T4 )/SK3/SK3 |
---|
111 | STRUC = 1./(1.-CK) |
---|
112 | // 20 CONTINUE |
---|
113 | Return struc |
---|
114 | End |
---|
115 | |
---|