[ae3ce4e] | 1 | /* |
---|
| 2 | * libSANSAnalysis.h |
---|
| 3 | * SANSAnalysis |
---|
| 4 | * |
---|
| 5 | * Created by Andrew Jackson on 4/24/07. |
---|
[6e93a02] | 6 | * Copyright 2007 __MyCompanyName__. All rights reserved. |
---|
[ae3ce4e] | 7 | * |
---|
| 8 | */ |
---|
| 9 | |
---|
[6e93a02] | 10 | #include "libCylinder.h" |
---|
| 11 | #include "libSphere.h" |
---|
| 12 | #include "libStructureFactor.h" |
---|
| 13 | #include "libTwoPhase.h" |
---|
| 14 | |
---|
| 15 | /*This should not be necessary AJJ May 09*/ |
---|
[ae3ce4e] | 16 | /* IGOR Fit Functions */ |
---|
[6e93a02] | 17 | /* |
---|
[ae3ce4e] | 18 | double CylinderForm(double dp[], double q); |
---|
| 19 | double EllipCyl76(double dp[], double q); |
---|
| 20 | double EllipCyl20(double dp[], double q); |
---|
| 21 | double TriaxialEllipsoid(double dp[], double q); |
---|
| 22 | double Parallelepiped(double dp[], double q); |
---|
| 23 | double HollowCylinder(double dp[], double q); |
---|
| 24 | double EllipsoidForm(double dp[], double q); |
---|
| 25 | double Cyl_PolyRadius(double dp[], double q); |
---|
| 26 | double Cyl_PolyLength(double dp[], double q); |
---|
| 27 | double CoreShellCylinder(double dp[], double q); |
---|
| 28 | double OblateForm(double dp[], double q); |
---|
| 29 | double ProlateForm(double dp[], double q); |
---|
| 30 | double FlexExclVolCyl(double dp[], double q); |
---|
| 31 | double FlexCyl_PolyLen(double dp[], double q); |
---|
| 32 | double FlexCyl_PolyRad(double dp[], double q); |
---|
| 33 | double FlexCyl_Ellip(double dp[], double q); |
---|
| 34 | double PolyCoShCylinder(double dp[], double q); |
---|
| 35 | double StackedDiscs(double dp[], double q); |
---|
| 36 | double LamellarFF(double dp[], double q); |
---|
| 37 | double LamellarFF_HG(double dp[], double q); |
---|
| 38 | double LamellarPS(double dp[], double q); |
---|
| 39 | double LamellarPS_HG(double dp[], double q); |
---|
[6e93a02] | 40 | // |
---|
| 41 | double Lamellar_ParaCrystal(double dp[], double q); |
---|
| 42 | double Spherocylinder(double dp[], double q); |
---|
| 43 | double ConvexLens(double dp[], double q); |
---|
| 44 | double Dumbbell(double dp[], double q); |
---|
| 45 | double CappedCylinder(double dp[], double q); |
---|
| 46 | double Barbell(double dp[], double q); |
---|
| 47 | double PolyCoreBicelle(double dp[], double q); |
---|
| 48 | */ |
---|
[ae3ce4e] | 49 | |
---|
| 50 | /* internal functions */ |
---|
[6e93a02] | 51 | /* |
---|
[ae3ce4e] | 52 | double CylKernel(double qq, double rr,double h, double theta); |
---|
| 53 | double NR_BessJ1(double x); |
---|
| 54 | double EllipCylKernel(double qq, double ra,double nu, double theta); |
---|
| 55 | double TriaxialKernel(double q, double aa, double bb, double cc, double dx, double dy); |
---|
| 56 | double PPKernel(double aa, double mu, double uu); |
---|
| 57 | double HolCylKernel(double qq, double rcore, double rshell, double length, double dum); |
---|
| 58 | double EllipsoidKernel(double qq, double a, double va, double dum); |
---|
| 59 | double Cyl_PolyRadKernel(double q, double radius, double length, double zz, double delrho, double dumRad); |
---|
| 60 | double SchulzPoint_cpr(double dumRad, double radius, double zz); |
---|
| 61 | double Cyl_PolyLenKernel(double q, double radius, double len_avg, double zz, double delrho, double dumLen); |
---|
| 62 | double CoreShellCylKernel(double qq, double rcore, double thick, double rhoc, double rhos, double rhosolv, double length, double dum); |
---|
| 63 | double gfn4(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq); |
---|
| 64 | double gfn2(double xx, double crmaj, double crmin, double trmaj, double trmin, double delpc, double delps, double qq); |
---|
| 65 | double FlePolyLen_kernel(double q, double radius, double length, double lb, double zz, double delrho, double zi); |
---|
| 66 | double FlePolyRad_kernel(double q, double ravg, double Lc, double Lb, double zz, double delrho, double zi); |
---|
| 67 | double EllipticalCross_fn(double qq, double a, double b); |
---|
| 68 | double CScyl(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length, double dum); |
---|
| 69 | double CSCylIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhos, double rhosolv, double length); |
---|
| 70 | double Stackdisc_kern(double qq, double rcore, double rhoc, double rhol, double rhosolv, double length, double thick, double dum, double gsd, double d, double N); |
---|
[6e93a02] | 71 | double BicelleKernel(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length, double dum); |
---|
| 72 | double BicelleIntegration(double qq, double rad, double radthick, double facthick, double rhoc, double rhoh, double rhor, double rhosolv, double length); |
---|
| 73 | */ |
---|
| 74 | |
---|
[ae3ce4e] | 75 | |
---|
| 76 | // |
---|
| 77 | /* IGOR Fit Functions */ |
---|
[6e93a02] | 78 | /* |
---|
[ae3ce4e] | 79 | double MultiShell(double dp[], double q); |
---|
| 80 | double PolyMultiShell(double dp[], double q); |
---|
| 81 | double SphereForm(double dp[], double q); |
---|
| 82 | double CoreShellForm(double dp[], double q); |
---|
| 83 | double PolyCoreForm(double dp[], double q); |
---|
| 84 | double PolyCoreShellRatio(double dp[], double q); |
---|
| 85 | double VesicleForm(double dp[], double q); |
---|
| 86 | double SchulzSpheres(double dp[], double q); |
---|
| 87 | double PolyRectSpheres(double dp[], double q); |
---|
| 88 | double PolyHardSphereIntensity(double dp[], double q); |
---|
| 89 | double BimodalSchulzSpheres(double dp[], double q); |
---|
| 90 | double GaussPolySphere(double dp[], double q); |
---|
| 91 | double LogNormalPolySphere(double dp[], double q); |
---|
| 92 | double BinaryHS(double dp[], double q); |
---|
| 93 | double BinaryHS_PSF11(double dp[], double q); |
---|
| 94 | double BinaryHS_PSF12(double dp[], double q); |
---|
| 95 | double BinaryHS_PSF22(double dp[], double q); |
---|
[6e93a02] | 96 | // |
---|
| 97 | double OneShell(double dp[], double q); |
---|
| 98 | double TwoShell(double dp[], double q); |
---|
| 99 | double ThreeShell(double dp[], double q); |
---|
| 100 | double FourShell(double dp[], double q); |
---|
| 101 | double PolyOneShell(double dp[], double q); |
---|
| 102 | double PolyTwoShell(double dp[], double q); |
---|
| 103 | double PolyThreeShell(double dp[], double q); |
---|
| 104 | double PolyFourShell(double dp[], double q); |
---|
| 105 | double BCC_ParaCrystal(double dp[], double q); |
---|
| 106 | double FCC_ParaCrystal(double dp[], double q); |
---|
| 107 | double SC_ParaCrystal(double dp[], double q); |
---|
[ae3ce4e] | 108 | |
---|
| 109 | //function prototypes |
---|
| 110 | double F_func(double qr); |
---|
| 111 | double MultiShellGuts(double q,double rcore,double ts,double tw,double rhocore,double rhoshel,int num); |
---|
| 112 | double fnt2(double yy, double zz); |
---|
| 113 | double fnt3(double yy, double pp, double zz); |
---|
| 114 | double SchulzSphere_Fn(double scale, double ravg, double pd, double rho, double rhos, double x); |
---|
| 115 | int ashcroft(double qval, double r2, double nf2, double aa, double phi, double *s11, double *s22, double *s12); |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | //// |
---|
| 119 | double HardSphereStruct(double dp[], double q); |
---|
| 120 | double SquareWellStruct(double dp[], double q); |
---|
| 121 | double StickyHS_Struct(double dp[], double q); |
---|
| 122 | double HayterPenfoldMSA(double dp[], double q); |
---|
[6e93a02] | 123 | double DiamCyl(double a, double b); |
---|
| 124 | double DiamEllip(double a, double b); |
---|
[ae3ce4e] | 125 | double sqhcal(double qq); |
---|
| 126 | int sqfun(int ix, int ir); |
---|
| 127 | int sqcoef(int ir); |
---|
[6e93a02] | 128 | */ |
---|
[ae3ce4e] | 129 | //// |
---|
| 130 | /* IGOR Fit Functions */ |
---|
[6e93a02] | 131 | /* |
---|
[ae3ce4e] | 132 | double TeubnerStreyModel(double dp[], double q); |
---|
| 133 | double Power_Law_Model(double dp[], double q); |
---|
| 134 | double Peak_Lorentz_Model(double dp[], double q); |
---|
| 135 | double Peak_Gauss_Model(double dp[], double q); |
---|
| 136 | double Lorentz_Model(double dp[], double q); |
---|
| 137 | double Fractal(double dp[], double q); |
---|
| 138 | double DAB_Model(double dp[], double q); |
---|
| 139 | double OneLevel(double dp[], double q); |
---|
| 140 | double TwoLevel(double dp[], double q); |
---|
| 141 | double ThreeLevel(double dp[], double q); |
---|
| 142 | double FourLevel(double dp[], double q); |
---|
[6e93a02] | 143 | // |
---|
| 144 | double BroadPeak(double dp[], double q); |
---|
| 145 | double CorrLength(double dp[], double q); |
---|
| 146 | double TwoLorentzian(double dp[], double q); |
---|
| 147 | double TwoPowerLaw(double dp[], double q); |
---|
| 148 | double PolyGaussCoil(double dp[], double q); |
---|
| 149 | double GaussLorentzGel(double dp[], double q); |
---|
| 150 | double GaussianShell(double dp[], double q); |
---|
| 151 | */ |
---|
| 152 | |
---|
| 153 | // since the XOP and the library are separate chunks of compiled code |
---|
| 154 | // it is imperative to set ALL the structure alignments to be two-byte |
---|
| 155 | // rather than leave it to the whim of the compiler |
---|
| 156 | /* SRK08 |
---|
| 157 | #include "XOPStructureAlignmentTwoByte.h" |
---|
| 158 | |
---|
| 159 | typedef struct { |
---|
| 160 | double scale; |
---|
| 161 | double radius; |
---|
| 162 | double length; |
---|
| 163 | double contrast; |
---|
| 164 | double background; |
---|
| 165 | double cyl_theta; |
---|
| 166 | double cyl_phi; |
---|
| 167 | } CylinderParameters; |
---|
| 168 | |
---|
| 169 | typedef struct { |
---|
| 170 | double scale; |
---|
| 171 | double radius; |
---|
| 172 | double length; |
---|
| 173 | double contrast; |
---|
| 174 | double background; |
---|
| 175 | double cyl_theta; |
---|
| 176 | double cyl_phi; |
---|
| 177 | double sigma_theta; |
---|
| 178 | double sigma_phi; |
---|
| 179 | double sigma_radius; |
---|
| 180 | } SmearCylinderParameters; |
---|
| 181 | |
---|
| 182 | #include "XOPStructureAlignmentReset.h" |
---|
[ae3ce4e] | 183 | |
---|
[6e93a02] | 184 | /// 1D scattering function |
---|
| 185 | double cylinder_analytical_1D(CylinderParameters *pars, double q); |
---|
| 186 | /// 2D scattering function |
---|
| 187 | double cylinder_analytical_2D(CylinderParameters *pars, double q, double phi); |
---|
| 188 | /// 1D scattering function |
---|
| 189 | double smeared_cylinder_analytical_1D(SmearCylinderParameters *pars, double q); |
---|
| 190 | /// 2D scattering function |
---|
| 191 | double dist_cylinder_2D(double pars[], double q, double phi); |
---|
| 192 | double smeared_cylinder_analytical_2D(SmearCylinderParameters *pars, double q, double phi); |
---|
| 193 | double smeared_cylinder_dist( double x, double mean, double sigma ); |
---|
| 194 | */ |
---|