Changes in sasmodels/models/rpa.c [acfb094:6351bfa] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/rpa.c
racfb094 r6351bfa 39 39 double S31,S32,S33,S34,S41,S42,S43,S44; 40 40 double Lad,Lbd,Lcd,Nav,Intg; 41 42 // Set values for non existent parameters (eg. no A or B in case 0 and 1 etc) 41 43 42 //icase was shifted to N-1 from the original code 44 43 if (icase <= 1){ … … 58 57 Kab = Kac = Kad = -0.0004; 59 58 } 60 61 // Set volume fraction of component D based on constraint that sum of vol frac =1 62 Phi[3]=1.0-Phi[0]-Phi[1]-Phi[2]; 63 64 //set up values for cross terms in case of block copolymers (1,3,4,6,7,8,9) 59 65 60 Nab=sqrt(N[0]*N[1]); 66 61 Nac=sqrt(N[0]*N[2]); … … 84 79 Phicd=sqrt(Phi[2]*Phi[3]); 85 80 86 // Calculate Q^2 * Rg^2 for each homopolymer assuming random walk87 81 Xa=q*q*b[0]*b[0]*N[0]/6.0; 88 82 Xb=q*q*b[1]*b[1]*N[1]/6.0; … … 90 84 Xd=q*q*b[3]*b[3]*N[3]/6.0; 91 85 92 //calculate all partial structure factors Pij and normalize n^2 93 Paa=2.0*(exp(-Xa)-1.0+Xa)/(Xa*Xa); // free A chain form factor 94 S0aa=N[0]*Phi[0]*v[0]*Paa; // Phi * Vp * P(Q)= I(Q0)/delRho^2 95 Pab=((1.0-exp(-Xa))/Xa)*((1.0-exp(-Xb))/Xb); //AB diblock (anchored Paa * anchored Pbb) partial form factor 86 Paa=2.0*(exp(-Xa)-1.0+Xa)/(Xa*Xa); 87 S0aa=N[0]*Phi[0]*v[0]*Paa; 88 Pab=((1.0-exp(-Xa))/Xa)*((1.0-exp(-Xb))/Xb); 96 89 S0ab=(Phiab*vab*Nab)*Pab; 97 Pac=((1.0-exp(-Xa))/Xa)*exp(-Xb)*((1.0-exp(-Xc))/Xc); //ABC triblock AC partial form factor90 Pac=((1.0-exp(-Xa))/Xa)*exp(-Xb)*((1.0-exp(-Xc))/Xc); 98 91 S0ac=(Phiac*vac*Nac)*Pac; 99 Pad=((1.0-exp(-Xa))/Xa)*exp(-Xb-Xc)*((1.0-exp(-Xd))/Xd); //ABCD four block92 Pad=((1.0-exp(-Xa))/Xa)*exp(-Xb-Xc)*((1.0-exp(-Xd))/Xd); 100 93 S0ad=(Phiad*vad*Nad)*Pad; 101 94 102 95 S0ba=S0ab; 103 Pbb=2.0*(exp(-Xb)-1.0+Xb)/(Xb*Xb); // free B chain96 Pbb=2.0*(exp(-Xb)-1.0+Xb)/(Xb*Xb); 104 97 S0bb=N[1]*Phi[1]*v[1]*Pbb; 105 Pbc=((1.0-exp(-Xb))/Xb)*((1.0-exp(-Xc))/Xc); // BC diblock98 Pbc=((1.0-exp(-Xb))/Xb)*((1.0-exp(-Xc))/Xc); 106 99 S0bc=(Phibc*vbc*Nbc)*Pbc; 107 Pbd=((1.0-exp(-Xb))/Xb)*exp(-Xc)*((1.0-exp(-Xd))/Xd); // BCD triblock100 Pbd=((1.0-exp(-Xb))/Xb)*exp(-Xc)*((1.0-exp(-Xd))/Xd); 108 101 S0bd=(Phibd*vbd*Nbd)*Pbd; 109 102 110 103 S0ca=S0ac; 111 104 S0cb=S0bc; 112 Pcc=2.0*(exp(-Xc)-1.0+Xc)/(Xc*Xc); // Free C chain105 Pcc=2.0*(exp(-Xc)-1.0+Xc)/(Xc*Xc); 113 106 S0cc=N[2]*Phi[2]*v[2]*Pcc; 114 Pcd=((1.0-exp(-Xc))/Xc)*((1.0-exp(-Xd))/Xd); // CD diblock107 Pcd=((1.0-exp(-Xc))/Xc)*((1.0-exp(-Xd))/Xd); 115 108 S0cd=(Phicd*vcd*Ncd)*Pcd; 116 109 … … 118 111 S0db=S0bd; 119 112 S0dc=S0cd; 120 Pdd=2.0*(exp(-Xd)-1.0+Xd)/(Xd*Xd); // free D chain113 Pdd=2.0*(exp(-Xd)-1.0+Xd)/(Xd*Xd); 121 114 S0dd=N[3]*Phi[3]*v[3]*Pdd; 122 123 // Reset all unused partial structure factors to 0 (depends on case)124 115 //icase was shifted to N-1 from the original code 125 116 switch(icase){ … … 202 193 S0dc=S0cd; 203 194 204 // self chi parameter is 0 ... of course205 195 Kaa=0.0; 206 196 Kbb=0.0; … … 253 243 ZZ=S0ad*(T11*S0ad+T12*S0bd+T13*S0cd)+S0bd*(T21*S0ad+T22*S0bd+T23*S0cd)+S0cd*(T31*S0ad+T32*S0bd+T33*S0cd); 254 244 255 // D is considered the matrix or background component so enters here256 245 m=1.0/(S0dd-ZZ); 257 246 … … 308 297 S44=S11+S22+S33+2.0*S12+2.0*S13+2.0*S23; 309 298 310 //calculate contrast where L[i] is the scattering length of i and D is the matrix311 //need to verify why the sqrt of Nav rather than just Nav (assuming v is molar volume)312 299 Nav=6.022045e+23; 313 300 Lad=(L[0]/v[0]-L[3]/v[3])*sqrt(Nav); … … 316 303 317 304 Intg=Lad*Lad*S11+Lbd*Lbd*S22+Lcd*Lcd*S33+2.0*Lad*Lbd*S12+2.0*Lbd*Lcd*S23+2.0*Lad*Lcd*S13; 318 319 //rescale for units of Lij^2 (in 10e-12 m^2 to m^2 ?)320 Intg *= 1.0e-24;321 305 322 306 return Intg;
Note: See TracChangeset
for help on using the changeset viewer.