7. structurefactor (sf) — jscatter 0.6.6 documentation

# 7. structurefactor (sf)

Structure factors and directly related functions for scattering related to interaction potentials between particles.

Return values are dataArrays were useful.

To get only Y values use .Y

For RMSA an improved algorithm is used based on the original idea described in [1]_ (see Notes in RMSA).

## 7.1. Structure Factors

`RMSA`(q, R, scl, gamma[, molarity, eta, useHP]) | Structure factor for a screened coulomb interaction in rescaled mean spherical approximation (RMSA).
`PercusYevick`(q, R[, molarity, eta]) | The Percus-Yevick structure factor.
`PercusYevick1D`(q[, R, eta]) | The PercusYevick structure factor in 1D
`PercusYevick2D`(q[, R, eta, a]) | The PercusYevick structure factor in 2D
`stickyHardSphere`(q, R, width, depth[, …]) | Structure factor of a square well potential with depth and width (sticky hard spheres).
`adhesiveHardSphere`(q, R, tau, delta[, …]) | structure factor of a adhesive hard sphere potential (a square well potential)
`criticalSystem`(q, corrlength, isothermalcompress) | structure factor of a critical system should take the Ornstein-Zernike form

## 7.2. Hydrodynamics

`hydrodynamicFunct`(wavevector, Rh, molarity) | Hydrodynamic function H(Q) from hydrodynamic pair interaction of spheres in suspension.

## 7.3. Pair Correlation

`sq2gr`(Sq, R[, interpolatefactor]) | Radial distribution function g(r) from structure factor Sq.

Structure factors and directly related functions for scattering related to interaction potentials between particles.

Return values are dataArrays were useful.

To get only Y values use .Y

For RMSA an improved algorithm is used based on the original idea described in [1]_ (see Notes in RMSA).

`jscatter.structurefactor.` `PercusYevick`(q, R, molarity=None, eta=None)

  The Percus-Yevick structure factor.

  Structure factor for the potential U(r)= (inf for 0<r<R) and (0 for R<r).

  Parameters: | q : array; N dim scattering vector; units 1/(R[unit]) R : float Radius of the object eta : float volume fraction as eta=4/3*pi*R**3*n with number density n in units or R molarity : float number density in mol/l and defines q and R units to 1/nm and nm to be correct preferred over eta if both given
  Returns: | dataArray structure factor for given q

  Notes

  Problem is given in [R187]; solution in [R188] and best description of the solution is in [R189].

  References

  [R187] | (1, 2) Percus and G. J. Yevick, Phys. Rev. 110, 1 (1958).

  [R188] | (1, 2) Wertheim, Phys. Rev. Lett. 10, 321 (1963).

  [R189] | (1, 2) Kinning and E. L. Thomas, Macromolecules 17, 1712 (1984).

`jscatter.structurefactor.` `PercusYevick1D`(q, R=1, eta=0.1)

  The PercusYevick structure factor in 1D

  Structure factor for the potential U(r)= (inf for 0<r<R) and (0 for R<r).

  Parameters: | q : array; N dim scattering vector; units 1/(R[unit]) R : float Radius of the object eta : float packing fraction as eta=2*R*n with number density n
  Returns: | dataArray [q,structure factor]

  Notes

  [R190] | Exact solution of the Percus-Yevick equation for a hard-core fluid in odd dimensions Leutheusser E Physica A 1984 vol: 127 (3) pp: 667-676

  [R191] | On the equivalence of the Ornstein–Zernike relation and Baxter’s relations for a one-dimensional simple fluid Chen M Journal of Mathematical Physics 1975 vol: 16 (5) pp: 1150

`jscatter.structurefactor.` `PercusYevick2D`(q, R=1, eta=0.1, a=None)

  The PercusYevick structure factor in 2D

  Structure factor for the potential U(r)= (inf for 0<r<R) and (0 for R<r).

  Parameters: | q : array; N dim scattering vector; units 1/(R[unit]) R : float, default 1 Radius of the object eta : float, default 0.1 packing fraction as eta=pi*R**2*n with number density n maximum hexagonal closed = (np.pi*R**2)/(3/2.*3**0.5*a**2) Rmax=a*3**0.5/2. with max packing of 0.9069 a : float, default None hexagonal lattice constant if not None the packing fraction in hexagonal lattice as eta=(np.pi*R**2)/(3/2.*3**0.5*a**2) is used
  Returns: | dataArary

  References

  [R192] | Free-energy model for the inhomogeneous hard-sphere fluid in D dimensions: Structure factors for the hard-disk (D=2) mixtures in simple explicit form Yaakov Rosenfeld Phys. Rev. A 42, 5978

`jscatter.structurefactor.` `RMSA`(q, R, scl, gamma, molarity=None, eta=None, useHP=False)

  Structure factor for a screened coulomb interaction in rescaled mean spherical approximation (RMSA).

  Structure factor according to Hayter-Penfold [R193] [R194] . Consider a scattering system consisting of macro ions, counter ions and solvent. Here an improved algorithm is used based on the original idea described in [R193] (see Notes).

  Parameters: | q : array; N dim Scattering vector; units 1/nm R : float Radius of the object; units nm molarity : float Number density n in units mol/l. Overides eta, if both given. scl : float>0 Screening length; units nm; negative values evaluate to scl=0. gamma : float contact potential; units kT gamma=Zm/(pi*e0*e*R*(2+k*R)) Zm = Z* effective surface charge e0,e free permittivity and dielectric constant k=1/scl inverse screening length of Debye-Hückel potential eta : float Volume fraction as eta=4/3*pi*R**3*n with number density n. useHP : True, default False To use the original Hayter/Penfold algorithm. This gives wrong results for some parameter conditions. It should ONLY be used for testing. See example examples/test_newRMSAAlgorithm.py for a direct comparison.
  Returns: | dataArray : . .volumeFraction = eta .rescaledVolumeFraction .screeningLength .gamma=gamma .contactpotential .S0 structure factor at q=0 .scalingfactor factor for rescaling to get g+1=0; if =1 nothing was scaled and it is MSA

  Notes

  Improved algorithm
    The Python code is deduced from the original Hayter-Penfold Fortran code (1981, ILL Grenoble). This is also used in other common SAS programs as SASfit or SASview (translated to C). The original algorithm determines the root of a quartic F(w1,w2,w3,w4) by an estimate (named PW estimate), refining it by a Newton algorithm. As the PW estimate is somtimes not good enough this results in an arbitrary root of the quartic in the Newton algorithm. The solution therefore jumps between different posibilities by small changes of the parameters. We use here the original idea from [R193] to calculate G(r<0) for all four roots of F(w1,w2,w3,w4) and use the physical solution with G(r<R)=0. See examples/test_newRMSAAlgorithm.py for a direct comparison.
  Validity
    The calculation of charge at the surface or screening length from a solute ion concentration is explicitly dedicate to the user. The Debye-Hückel theory for a macro ion in screened solution is a far field theory as a linearization of the Poisson-Boltzmann (PB) theory and from limited validity (far field or low charge -> linearization). Things like reverting charge layer, ion condensation at the surface, pH changes at the surface or other things might appear. Before calculating please take these things into account. Close to the surface the PB has to be solved. The DH theory can still be used if the charge is thus an effective charge named Z*, which might be different from the real surface charge. See Ref [R195] for details.

  References

  [R193] | (1, 2, 3, 4) Hayter and J. Penfold, Mol. Phys. 42, 109 (1981).

  [R194] | (1, 2) J.-P. Hansen and J. B. Hayter, Mol. Phys. 46, 651 (2006).

  [R195] | (1, 2) Belloni, J. Phys. Condens. Matter 12, R549 (2000).

`jscatter.structurefactor.` `adhesiveHardSphere`(q, R, tau, delta, molarity=None, eta=None)

  structure factor of a adhesive hard sphere potential (a square well potential)

  Parameters: | q : array; N dim scattering vector; units 1/(R[unit]) R : float radius of the hard core eta : float volume fraction of the hard core particles molarity : float number density in mol/l and defines q and R units to 1/nm and nm to be correct preferred over eta if both given tau : float stickiness delta : float width of the square well

  Notes

  The potential U(r) is defined as r<2R U(r)=infinity 2R<r<2R+delta U(r)=-depth=ln(12*tau*delta/(2R+delta)) r >2R+delta U(r)=0

  References

  [R196] | Regnaut and J. C. Ravey, J. Chem. Phys. 91, 1211 (1989).

  [R197] | Regnaut and J. C. Ravey, J. Chem. Phys. 92 (5) (1990), 3250 Erratum

`jscatter.structurefactor.` `criticalSystem`(q, corrlength, isothermalcompress)

  structure factor of a critical system should take the Ornstein-Zernike form

  Parameters: | q : array; N dim scattering vector; units 1/(R[unit]) corrlength : float correlation length isothermalcompress : float isothermal compressibility of the system

  Notes

  The peaking of the structure factor near Q=0 region is due to attractive interaction. Away from it the structure factor should be close to the hard sphere structure factor. Near the critical point we should find S(Q)=S_PY(Q)+S_OZ(Q) S_PY Percus Yevik structure factor S_OZ this function

  References

  [R198] | Analysis of Critical Scattering Data from AOT/D2O/n-Decane Microemulsions S. H. Chen, T. L. Lin, M. Kotlarchyk Surfactants in Solution pp 1315-1330

`jscatter.structurefactor.` `hydrodynamicFunct`(wavevector, Rh, molarity, intrinsicVisc=None, DsoverD0=None, structureFactor=None, structureFactorArgs={}, numberOfPoints=50, ncpu=-1)

  Hydrodynamic function H(Q) from hydrodynamic pair interaction of spheres in suspension.

  We use the theory from Beenakker and Mazur [R200] as given by Genz [R199]. The -expansion of Beenakker expresses many body hydrodynamic interaction within the renormalization approach dependent on the structure factor S(q).

  Parameters: | wavevector : array scattering vector q in units 1/nm Rh : float effective hydrodynamic radius of particles in nm. molarity : float molarity in mol/l This overides a parameter ‘molarity’ in the structureFactorArgs. Rh and molarity define the hydrodynamic interaction, the volume fraction and Ds/D0 for H(Q). The structure factor may have a radius different from Rh e.g. for attenuated hydrodynamic interactions. DsoverD0 : float The high Q limit of the hydrodynamic function is for low volume fractions Ds/D0= 1/(1+intrinsicVisc * volumeFraction ) with self diffusion Ds. Ds is calculated from molarity and Rh. This explicit value overrides intrinsic viscosity and calculated Ds/D0. structureFactor : function, None Structure factor S(q) with S(q=inf)=1.0 recommended. 1: If structurefactor is None a Percus-Yevik is assumed with molarity and R=Rh. 2: A function S(q,…) is given as structure factor, which might be an empirical function (e.g. polynominal fit of a measurement) First parameter needs to be wavevector q . If “molarity” parameter is present it is overwriten by molarity above. structureFactorArgs : dictionary Any extra arguments to structureFactor e.g. structFactorArgs={‘x’:0.123,R=3,….} intrinsicVisc : float Defines the high q limit for the hydrodynamic function. effective_viscosity= eta_solvent * (1-intrinsicVisc*Volumefraction ) intrinsicVisc = 2.5 Einstein hard sphere density 1 g/cm**3 For proteins instead of volume fraction the protein concentration in g/ml with typical protein density 1.37 g/cm^3 is often used. Intrinsic Viscosity depends on protein shape (see HYDROPRO). Typical real values for intrinsicVisc in practical units cm^3/g sphere 1.76 cm^3/g= 2.5 sphere with protein density ADH 3.9 = 5.5 a tetrameric protein PGK 4.0 = 5.68 two domains with hinge-> elongated Rnase 3.2 = 4.54 one domain eta_solvent/effective_viscosity = (1-intrinsicVisc * Volumefraction )=Dself/D0 numberOfPoints : integer, default 50 Determines number of integration points in equ 5 of ref [R199] and therfore accuracy of integration. The typical accuracy of this function is <1e-4 for (H(q) -highQLimit) and <1e-3 for Ds/D0.
  Returns: | dataArray [0] q values [1] hydrodynamic function [2] hydrodynamic function only Q dependent part = H(q) -highQLimit [3] structure factor for H(q) calculation .selfdiffusion Ds

  Notes

  Ds is calculated according to equ 11 in [R199] which is valid for volume fractions up to 0.5. With this assumption the deviation of self diffusion Ds from Ds=Do*[1-1.73*phi+0.88*phi**2+ O(phi**3)] is smaller 5% for phi<0.2 (10% for phi<0.3)

  References

  [R199] | (1, 2, 3, 4) Genz and R. Klein, Phys. A Stat. Mech. Its Appl. 171, 26 (1991).

  [R200] | (1, 2) Beenakker and P. Mazur, Phys. A Stat. Mech. Its Appl. 126, 349 (1984).

  [R201] | Beenakker and P. Mazur, Phys. A Stat. Mech. Its Appl. 120, 388 (1983).

`jscatter.structurefactor.` `sq2gr`(Sq, R, interpolatefactor=2)

  Radial distribution function g(r) from structure factor Sq.

  The result strongly depends on quality of S(Q) (number of data points, Q range, smoothness). Read [R203] for details of this inversion problem and why it may fail.

  Parameters: | Sq : dataArray Structure factor e.g. in units as [Q]=1/nm .X wavevector .Y structure factor R : float Estimate for the radius of the particles. interpolatefactor : int Number of points between points in interpolation for rfft. 2 doubles the points
  Returns: | dataArray .n0 approximated from

  Notes

  One finds that

  with defining .

  As we have only a limited Q range ( ), limited accuracy and number of Q values we require that .

  References

  [R202] | Yarnell, J. L., Katz, M. J., Wenzel, R. G., & Koenig, S. H. (1973). Structure factor and radial distribution function for liquid argon at 85 K. Physical Review A, 7(6), 2130.

  [R203] | (1, 2) On the determination of the pair correlation function from liquid structure factor measurements A.K. Soper Chemical Physics 107, 61-74, (1986)

  Examples

      import jscatter as js
      import numpy as np
      p=js.grace()
      p.multi(2,1)
      q=js.loglist(0.01,100,2**13)
      p[0].clear();p[1].clear()
      R=2.5
      eta=0.3;scl=5
      n=eta/(4/3.*np.pi*R**3)   # unit 1/nm**3
      sf=js.sf.RMSA(q=q,R=R,scl=scl, gamma=50, eta=eta)
      gr=js.sf.sq2gr(sf,R,interpolatefactor=1)
      sfcut=js.sf.RMSA(js.loglist(0.01,10,2**10),R=R,scl=scl, gamma=50, eta=eta)
      grcut=js.sf.sq2gr(sfcut,R,interpolatefactor=5)
      p[0].plot(sf.X*2*R,sf.Y,le=r'\xG=50')
      p[1].plot(gr.X/2/R,gr[1],le=r'\xG=50')
      p[1].plot(grcut.X/2/R,grcut[1],le=r'\xG=50 \f{}Q\smax\N=10')
      sfh=js.sf.RMSA(q=q,R=R,scl=scl, gamma=0.01, eta=eta)
      grh=js.sf.sq2gr(sfh,R,interpolatefactor=1)
      p[0].plot(sfh.X*2*R,sfh.Y,le=r'\xG=0.01')
      p[1].plot(grh.X/2/R,grh[1],le=r'\xG=0.01')
      p[0].xaxis(max=20,label='2RQ')
      p[1].xaxis(max=4*R,label='r/(2R)')
      p[0].yaxis(max=2,min=0,label='S(Q)')
      p[1].yaxis(max=2.5,min=0,label='g(r)')
      p[0].legend(x=10,y=1.8)
      p[1].legend(x=4,y=1.8)
      p[0].title('Comparison RMSA')
      p[0].subtitle('R=%.2g, eta=%.2g, scl=%.2g' %(R,eta,scl))

`jscatter.structurefactor.` `stickyHardSphere`(q, R, width, depth, molarity=None, phi=None)

  Structure factor of a square well potential with depth and width (sticky hard spheres).

  Sticky hard sphere model is derived using a perturbative solution of the factorized form of the Ornstein-Zernike equation and the Percus-Yevick closure relation. The perturbation parameter is width/(width+2R)

  Parameters: | q : array; N dim Scattering vector; units 1/(R[unit]) R : float Radius of the hard sphere phi : float Volume fraction of the hard core particles molarity : float Number density in mol/l and defines q and R units to 1/nm and nm to be correct Preferred over phi if both given. depth : float Potential well depth in kT depth >0 (U<0); positive potential allowed (repulsive) see [R204]. width : float Width of the square well

  Notes

  The potential U(r) is defined as
  r<2R U(r)=infinity
  2R<r<2R+width U(r)=-depth in [kT]
  r >2R+width U(r)=0

  eps=width/(2*R+width) stickyness=exp(-depth)/12./eps

  References

  [R204] | (1, 2) S.V. G. Menon, C. Manohar, and K. S. Rao, J. Chem. Phys. 95, 9186 (1991)

  [R205] | Sztucki, T. Narayanan, G. Belina, A. Moussaïd, F. Pignon, and H. Hoekstra, Phys. Rev. E 74, 051504 (2006)

  [R206] | W.-R. Chen, S.-H. Chen, and F. Mallamace, Phys. Rev. E 66, 021403 (2002)

  [R207] | Foffi, E. Zaccarelli, F. Sciortino, P. Tartaglia, and K. A. Dawson, J. Stat. Phys. 100, 363 (2000)