aboutsummaryrefslogtreecommitdiff
path: root/julia/CrystFEL/src/diffcalc.jl
diff options
context:
space:
mode:
Diffstat (limited to 'julia/CrystFEL/src/diffcalc.jl')
-rw-r--r--julia/CrystFEL/src/diffcalc.jl44
1 files changed, 44 insertions, 0 deletions
diff --git a/julia/CrystFEL/src/diffcalc.jl b/julia/CrystFEL/src/diffcalc.jl
new file mode 100644
index 00000000..1c6aea9c
--- /dev/null
+++ b/julia/CrystFEL/src/diffcalc.jl
@@ -0,0 +1,44 @@
+module DiffractionCalculations
+
+import ..CrystFEL: libcrystfel
+import ..CrystFEL.Images: InternalImage, Image
+import ..CrystFEL.Crystals: InternalCrystal, Crystal
+import ..CrystFEL.RefLists: RefList, UnmergedReflection, InternalRefList
+import ..CrystFEL.Symmetry: SymOpList
+export predictreflections, calculatepartialities!
+export PartialityModel, UnityModel, XSphereModel, OffsetModel, RandomModel, GeneralGaussianModel
+
+
+"""
+Enumeration of the available partiality models.
+"""
+@enum PartialityModel begin
+ UnityModel
+ XSphereModel
+ OffsetModel
+ RandomModel
+ GeneralGaussianModel
+end
+
+
+function predictreflections(cr::Crystal, image::Image; maxres=1e10)
+
+ refls = @ccall libcrystfel.predict_to_res(cr.internalptr::Ptr{InternalCrystal},
+ image.internalptr::Ptr{InternalImage},
+ maxres::Cdouble)::Ptr{InternalRefList}
+ sym = SymOpList("1")
+ return RefList{UnmergedReflection}(refls, sym)
+end
+
+
+function calculatepartialities!(reflist::RefList{UnmergedReflection},
+ cr::Crystal, image::Image; model=XSphereModel, maxres=1e10)
+
+ @ccall libcrystfel.calculate_partialities(reflist.internalptr::Ptr{InternalRefList},
+ cr.internalptr::Ptr{InternalCrystal},
+ image.internalptr::Ptr{InternalImage},
+ model::Cint)::Cvoid
+end
+
+
+end # of module