Changeset 3db3895 in sasview for sansmodels/src/sans/models/BEPolyelectrolyte.py
- Timestamp:
- Mar 25, 2008 9:05:04 AM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f629e346
- Parents:
- 829eee9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/BEPolyelectrolyte.py
r829eee9 r3db3895 2 2 """ 3 3 4 Provide F(x) = K*1/(4*pi ()*Lb*(alpha)^(2)*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\4 Provide F(x) = K*1/(4*pi*Lb*(alpha)^(2))*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\ 5 5 *(q^(2)-(12*h*C/b^(2))) 6 6 BEPolyelectrolyte as a BaseComponent model … … 15 15 Class that evaluates a BEPolyelectrolyte. 16 16 17 F(x) = K*1/(4*pi ()*Lb*(alpha)^(2)*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\17 F(x) = K*1/(4*pi*Lb*(alpha)^(2))*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\ 18 18 *(q^(2)-(12*h*C/b^(2))) 19 19 … … 40 40 ## Define parameters 41 41 self.params = {} 42 self.params[' K'] = 1043 self.params[' Lb'] = 7.144 self.params[' H'] = 1245 self.params[' B'] = 1046 self.params[' Cs'] = 0.042 self.params['k'] = 10 43 self.params['lb'] = 7.1 44 self.params['h'] = 12 45 self.params['b'] = 10 46 self.params['cs'] = 0.0 47 47 self.params['alpha']= 0.05 48 self.params[' C'] = 0.749 self.params['b kd'] = 0.00148 self.params['c'] = 0.7 49 self.params['background'] = 0.0 50 50 51 51 52 52 ## Parameter details [units, min, max] 53 53 self.details = {} 54 self.details[' K'] = ['barns', None, None]55 self.details[' Lb'] = ['A', None, None]56 self.details[' H'] = ['A^{-3}', None, None]57 self.details[' B'] = ['A', None, None]58 self.details[' Cs'] = ['mol/L', None, None]54 self.details['k'] = ['barns', None, None] 55 self.details['lb'] = ['A', None, None] 56 self.details['h'] = ['A-3', None, None] 57 self.details['b'] = ['A', None, None] 58 self.details['cs'] = ['mol/L', None, None] 59 59 self.details['alpha'] = ['', None, None] 60 self.details[' C'] = ['mol/L', None, None]61 self.details['b kd'] = ['', None, None]60 self.details['c'] = ['mol/L', None, None] 61 self.details['background'] = ['cm-1', None, None] 62 62 63 63 … … 65 65 """ 66 66 Evaluate 67 F(x) = K*1/(4*pi ()*Lb*(alpha)^(2)*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\67 F(x) = K*1/(4*pi*Lb*(alpha)^(2))*(q^(2)+k2)/(1+(r02)^(2))*(q^(2)+k2)\ 68 68 *(q^(2)-(12*h*C/b^(2))) 69 69 … … 71 71 The inverse Debye Length: K2 = 4*pi*Lb*(2*Cs+alpha*C) 72 72 r02 =1/alpha/Ca^(0.5)*(B/(48*pi*Lb)^(0.5)) 73 Ca = C*6.022136 * exp(-4)73 Ca = C*6.022136e-4 74 74 """ 75 K2 = 4 * math.pi * self.params['Lb'] * (2*self.params['Cs'] + \ 76 self.params['alpha'] * self.params['C']) 75 Ca = self.params['c'] * 6.022136e-4 77 76 78 Ca = self.params['C'] * 6.022136 * math.exp(-4) 77 K2 = 4.0 * math.pi * self.params['lb'] * (2*self.params['cs'] + \ 78 self.params['alpha'] * Ca) 79 79 80 r02 = 1/(self.params['alpha'] * math.pow(Ca,0.5) * \81 (self.params[' B']/math.pow((48*math.pi *self.params['Lb']),0.5)))80 r02 = 1.0/self.params['alpha']/math.sqrt(Ca) * \ 81 (self.params['b']/math.sqrt((48.0*math.pi *self.params['lb']))) 82 82 83 return ( self.params['K']/( ( 4 * math.pi *self.params['Lb']*\84 (self.params['alpha']**2)*\85 ( x**2 + K2 )*( 1 + r02**2 ) * ( x**2 + K2 ) *\86 (x**2 - ( 12 * self.params['H'] *\87 self.params['C']/(self.params['B']**2) )) )))+ self.params['bkd']83 return self.params['k']/( 4.0 * math.pi * self.params['lb'] * self.params['alpha']**2 ) \ 84 * ( x**2 + K2 ) / ( 1.0 + r02**2 * ( x**2 + K2 ) \ 85 * (x**2 - ( 12.0 * self.params['h'] \ 86 * Ca/(self.params['b']**2) ))) \ 87 + self.params['background'] 88 88 89 89 90 90 def run(self, x = 0.0): 91 91 """ Evaluate the model 92 @param x: simple value92 @param x: input q-value (float or [float, float] as [r, theta]) 93 93 @return: (debye value) 94 94 """ … … 102 102 def runXY(self, x = 0.0): 103 103 """ Evaluate the model 104 @param x: simple value104 @param x: input q-value (float or [float, float] as [qx, qy]) 105 105 @return: debye value 106 106 """ … … 110 110 raise ValueError, "Tuples are not allowed as input to BaseComponent models" 111 111 else: 112 return self._BEPoly e(x)112 return self._BEPoly(x)
Note: See TracChangeset
for help on using the changeset viewer.