Software package for calculating Small Angle Scattering (SAS) parameters from continuum simulations.
It can calculate
- SAS intensity (
$I$ vs.$Q$ ) and - Effective scattering cross-section (
$\sigma_\text{eff}$ ), i.e. the count rate of the scattered radiation per unit flux.
It takes a distribution of scattering length density (SLD) values as input that can be provided by FEM simulation softwares, e.g., Exodus files provided by MOOSE.
Workflow:
- Mesh generation
- Scattering length density (SLD) assignment
- SAS pattern calculation
- Effective scattering cross-section calculation
The output data are stored in the data folder. Its detailed structure is described in the documentation.
For validation, the SLD distribution of known structures can be generated and assigned, from which the scatering quantities can be calculated using this software and compared with analytical expressions. Several models are provided as validation test cases that follow this workflow.
As a functional test case, snapshots of an Exodus file obtained from exemplary MOOSE simulation are also included as hdf files. The SLD values are assigned from these hdf snapshot files to a generated mesh and SAS quantities are calculated using this software.
The following test cases are included in this repository:
- Validation test case: Generated model SLD distribution
- Static models (structures) containing one time step
- Sphere
- Cube
- Sphere at the center of cube
- Sphere off the center of cube
- Evolving models (phenomena) containing several time steps
- Growth of a sphere
- Interdiffusion of a sphere with its environment
- Change of the chemical composition of a sphere
- Static models (structures) containing one time step
- Functional test case: Simulated model SLD distribution
- Phase field modeling using MOOSE
- Spinodal decomposition of Fe-Cr
- Phase field modeling using MOOSE
Scripts are provided in the models folder that generate data and figures related to different test cases. All cases include a data generation script that stores generated data in data folder and a plot script that creates figures in figure folder. For the sld_grow model, an additional plot script is provided that creates figure for JOSS publication.
A description and purpose of the provided files are listed below:
-
database_sassena: A copy of the Sassena database of scattering lengths. Some of these files are copied for creating a custom database while calculating the scattering patterns from continuum simulated structures. -
detector_geometry: A representation of the detector of small-angle scattering instruments (e.g. SANS-1@MLZ). This is required for calculating the effective cross-section$(\sigma_{\text{eff}})$ . -
docu: Detailed description of this software. -
joss_submission: Files for the publication of this software in the Journal of Open Source Software (JOSS). -
lib: Functions required by the run scripts insrcandmodels. See documentation. -
logo: Logo ofCont2SAS. -
models: Data generation and plot generation scripts for the models provided with this software for testing (see quick start guide). -
moose: Output of a MOOSE simulation, reformatted as input forCont2SAS. Required for assigning SLD values in the mesh of thephase_fieldmodel. Reads the SLD values fromhdf5files for chosen time steps. -
moose_read: (a) Input script for a MOOSE simulation -- instructions how to run the corresponding FEM simulation using a docker container are included in the detailed documentation. (b) python scripts for converting the output exodus files of the MOOSE simulation intoCont2SASinput. -
shell_scripts: Shell scripts that add/remove an environment variable to the user's shell config file for easy execution of the provided examples. -
src: Scripts that read xml files from thexmlfolder as input; generate mesh (struct_gen.py), assign SLD (sim_gen.py), calculate SAS patterns (scatt_cal.py), and effective cross-section (sig_eff.py); also used by the*_gen.pyscripts inmodels(see documentation). -
tests: Test scripts for one static validation model, one evolving validation model, and one functional simulated model. Checks whether the data get generated, plots get generated, plots are correct, cleans generated files after execution of tests. -
xml: Input xml files that specify variables read by the run scripts.
git clone git@github.com:hereon-GEMS/Cont2SAS.git
cd Cont2SASTo ensure that the provided examples run on the user's computer regardless of the starting directory, the following environment variable is used.
# define environment variable for the current session
export C2S_HOME=$PWD# define environment variable for further sessions in the shell config file
chmod +x ./shell_scripts/*
./shell_scripts/install.sh# remove environment variable definition from the shell config file
./shell_scripts/uninstall.shDownload app image and use. Only works for ubuntu 24.04.
Default location: Sassena/sassena.AppImage
# download app image
mkdir -p ./Sassena
wget -O ./Sassena/Sassena.AppImage https://codebase.helmholtz.cloud/api/v4/projects/6801/packages/generic/sassena/v1.9.2-f31e3882/Sassena_CPU.AppImage
# run sassena
chmod +x ./Sassena/Sassena.AppImageTo check if the download has worked, you can run
./Sassena/Sassena.AppImage --helpwhich should print out messages about command line options of Sassena and end with an error message.
If the operating system is a different version of ubuntu or any other linux-based operating system:
- Clone the sassena source code,
- Build sassena locally,
- Copy the executable to the default appimage location specified in the first option, and
- Rename it as
Sassena.AppImage.
# clone sassena source code
cd ..
git clone git@codebase.helmholtz.cloud:DAPHNE4NFDI/sassena.git
# build sassena locally inside cloned repository
cd sassena
chmod +x runner.sh
./runner.sh build --cpu
# copy exec built to the default appimage location specified in option 1
cd ../Cont2SAS
mkdir -p ./Sassena
cp ../sassena/build-rel-cpu/bin/sassena ./Sassena
# rename executable as Sassena.AppImage
mv ./Sassena/sassena ./Sassena/Sassena.AppImageTo check if the precedure has worked, you can run
./Sassena/Sassena.AppImage --helpwhich should print out messages about command line options of Sassena and end with an error message.
For details regarding sassena installation, please visit sassena repository.
conda env create -f environment.yml
conda activate Cont2SasRemove the conda environment:
conda deactivate
conda remove --name Cont2Sas --alland delete the source code directory by hand.
sudo apt update
sudo apt install python3-venv
python3 -m venv Cont2Sas
source Cont2Sas/bin/activate
pip install -r requirements.txtpip uninstall -r requirements.txt
deactivate
rm -rf Cont2SasTo check whether the installation has worked, execute the tests:
pytest -vSome models are provided for generating or simulating nanostructures. From these structures SAS patterns can be calculated. One of the models also facilitates calculation of effective cross-section.
To run Cont2SAS with the provided models and parameters, read the getting started guide.
A detailed documentation is provided in the docu folder.
Potential developers, who want to contribute to the project, are advised to refer the contributor's guide.
For the citation information of Cont2SAS, please see the CITATION.cff file.
The Cont2SAS source code is released under the GNU General Public License Version 3 or later.
Cont2SAS is developed at Helmholtz-Zentrum Hereon and the development is supported by the consortium DAPHNE4NFDI in the context of the work of the NFDI e.V. The consortium is funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - project number 460248799.
