# 7. structurefactor (sf)

## 7.1. Structure Factors

`RMSA` |
`PercusYevick` |
`PercusYevick1D` |
`PercusYevick2D` |
`stickyHardSphere` |
`adhesiveHardSphere` |
`criticalSystem` |
`latticeStructureFactor` |
`orientedLatticeStructureFactor` |
`radialorientedLSF` |

## 7.2. Hydrodynamics

`hydrodynamicFunct` |

## 7.3. Pair Correlation

`sq2gr` |

## 7.4. Lattice

Lattices with specific structure :

3D

`bravaisLattice` |
`scLattice` |
`bccLattice` |
`fccLattice` |
`hexLattice` |
`hcpLattice` |
`diamondLattice` |
`rhombicLattice` |
`pseudoRandomLattice` |

2D

`sqLattice` |
`hex2DLattice` |

1D

`lamLattice` |

lattice methods :

`lattice.X` |
`lattice.Y` |
`lattice.Z` |
`lattice.XYZ` |
`lattice.b` |
`lattice.array` |
`lattice.points` |
`lattice.set_b` |
`lattice.type` |
`lattice.move` |
`lattice.centerOfMass` |
`lattice.numberOfAtoms` |
`lattice.show` |
`lattice.filter` |
`lattice.planeSide` |
`lattice.inSphere` |
`lattice.inParallelepiped` |
`rhombicLattice.unitCellAtomPositions` |
`rhombicLattice.getReciprocalLattice` |
`rhombicLattice.getRadialReciprocalLattice` |
`rhombicLattice.rotatePlane2hkl` |
`rhombicLattice.rotatePlaneAroundhkl` |
`rhombicLattice.rotatehkl2Vector` |
`rhombicLattice.rotateAroundhkl` |
`rhombicLattice.vectorhkl` |

Lattice objects describing a lattice of points.

Included are methods to select sublattices as parallelepiped, sphere or side of planes.

The small angle scattering is calculated by js.ff.cloudScattering.

The same method can be used to calculate the wide angle scattering with bragg peaks using larger scattering vectors to get crystalline bragg peaks of nanoparticles.

Examples

A hollow sphere cut to a wedge.

    import jscatter as js
    import numpy as np
    grid= js.lattice.scLattice(1/2.,2*8,b=[0])
    grid.inSphere(6,b=1)
    grid.inSphere(4,b=0)
    grid.planeSide([1,1,1],b=0)
    grid.planeSide([1,-1,-1],b=0)
    grid.show()

    q=js.loglist(0.01,5,600)
    ffe=js.ff.cloudScattering(q,grid.points,relError=0.02,rms=0.1)
    p=js.grace()
    p.plot(ffe)

A cube decorated with spheres.

    import jscatter as js
    import numpy as np
    grid= js.lattice.scLattice(0.2,2*15,b=[0])
    v1=np.r_[4,0,0]
    v2=np.r_[0,4,0]
    v3=np.r_[0,0,4]
    grid.inParallelepiped(v1,v2,v3,b=1)
    grid.inSphere(1,center=[0,0,0],b=2)
    grid.inSphere(1,center=v1,b=3)
    grid.inSphere(1,center=v2,b=4)
    grid.inSphere(1,center=v3,b=5)
    grid.inSphere(1,center=v1+v2,b=6)
    grid.inSphere(1,center=v2+v3,b=7)
    grid.inSphere(1,center=v3+v1,b=8)
    grid.inSphere(1,center=v3+v2+v1,b=9)
    grid.show()

    q=js.loglist(0.01,5,600)
    ffe=js.ff.cloudScattering(q,grid.points,relError=0.02,rms=0.)
    p=js.grace()
    p.plot(ffe)

A comparison of sc, bcc and fcc nanoparticles (takes a while )

    import jscatter as js
    import numpy as np
    q=js.loglist(0.01,35,1500)
    q=np.r_[js.loglist(0.01,3,200),3:40:800j]
    unitcelllength=1.5
    N=8

    scgrid= js.lattice.scLattice(unitcelllength,N)
    sc=js.ff.cloudScattering(q,scgrid.points,relError=50,rms=0.05)
    bccgrid= js.lattice.bccLattice(unitcelllength,N)
    bcc=js.ff.cloudScattering(q,bccgrid.points,relError=50,rms=0.05)
    fccgrid= js.lattice.fccLattice(unitcelllength,N)
    fcc=js.ff.cloudScattering(q,fccgrid.points,relError=50,rms=0.05)

    p=js.grace(1.5,1)
    # smooth with Gaussian to include instrument resolution
    p.plot(sc.X,js.formel.smooth(sc,10, window='gaussian'),legend='sc')
    p.plot(bcc.X,js.formel.smooth(bcc,10, window='gaussian'),legend='bcc')
    p.plot(fcc.X,js.formel.smooth(fcc,10, window='gaussian'),legend='fcc')

    q=q=js.loglist(1,35,100)
    p.plot(q,(1-np.exp(-q*q*0.05**2))/scgrid.shape[0],li=1,sy=0,le='sc diffusive')
    p.plot(q,(1-np.exp(-q*q*0.05**2))/bccgrid.shape[0],li=2,sy=0,le='bcc diffusive')
    p.plot(q,(1-np.exp(-q*q*0.05**2))/fccgrid.shape[0],li=3,sy=0,le='fcc diffusive')

    p.title('Comparison sc, bcc, fcc lattice for a nano cube')
    p.yaxis(scale='l',label='I(Q)')
    p.xaxis(scale='l',label='Q / A\S-1')
    p.legend(x=0.03,y=0.001,charsize=1.5)
    p.text('cube formfactor',x=0.02,y=0.05,charsize=1.4)
    p.text('Bragg peaks',x=4,y=0.05,charsize=1.4)
    p.text('diffusive scattering',x=4,y=1e-6,charsize=1.4)