- Note
- This is a pre-release version, first release is expected to be available by the end of August 2024.
A 3d simulator of crystallography interference and diffraction images using the Laue's equation. It's written in C and it uses the Vulkan API, shengine and shvulkan.

Overview
This template has been used on many libraries (see shengine, shgui)

(Skip) CMakeLists.txt generation
- Warning
- Skip this step if you are not the developer.
cd externals/shengine
python export-application.py name=crystal-model path=../../crystal-model
If you exectued the command above by mistake just type git stash on the terminal.
Generate project files and build
Building the program is fairly simple:
- Windows
mkdir crystal-model/build
mkdir crystal-model/build/windows
cd crystal-model/build/windows
cmake ../../ -DCRYSTAL_MODEL_BINARY_TYPE=EXECUTABLE -DSH_ENGINE_ROOT_DIR="repo/absolute/path/externals/shengine"
cmake --build .
- Linux
mkdir crystal-model/build
mkdir crystal-model/build/linux
cd crystal-model/build/linux
cmake ../../ -DCRYSTAL_MODEL_BINARY_TYPE=EXECUTABLE -DSH_ENGINE_ROOT_DIR="repo/absolute/path/externals/shengine"
cmake --build .
Run crystal model executable
- Windows
./crystal-model/bin/windows/crystal-model
- Linux
./crystal-model/bin/linux/crystal-model
Usage of configuration files
At crystal-model/smd/saved.smd you can edit the main parameters used in crystallography, suchh as the incident ray wavelength and orientation in space, the lattice unit structure and the photosensitive matrix or film distance from the crystal.
FLOAT32 ^^ 1 !! lambda_ag --> 5 ***
FLOAT32 ^^ 4 !! incident_ray --> 1, 0, 0 ***
UINT32 ^^ 1 !! atom_count --> 4 ***
FLOAT32 ^^ 16 !! atoms_positions_ag --> 0 0 0 1 0 10 0 1 0 10 0 1 10 0 0 1 ***
FLOAT32 ^^ 1 !! film_distance_cm --> 1 ***
To load the written or saved data from crystal-model/smd/saved.smd press LEFT_CTRL + L. To recovery the default information press LEFT_CTRL + R. To export the current information data to crystal-model/smd/saved.smd, press LEFT_CTRL + E.
Commands
| Parameter | Increase keys | Decrease keys |
lambda_ag | W | Q |
incident_ray | S F H | A D G |
film_distance | X | Z |
To do (pre-release):
- Generate real 3d cones with shaders (need to rewrite shaders)
- Add projections of the cones on the film
- currently the film is only a canvas of angles
- missing orientation and position of the lattice and of the film
- 3d view
- abstract 3d library from the application
- shci tests
- From a source image find the lattice
- Compute interference coordinates and angles before fragment shader. Then check pixel coordinates with a tolerance threshold.
- From soure image to 3d model
- Make separate views of lattice and of interference rendering
- shci tests
Contributions and support
Should you encounter any issues with the tools or wish to introduce new features, I welcome your contributions to the repository. You can contribute by either opening an issue or submitting a pull request.