1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 18:28:51 -05:00

docs update

This commit is contained in:
hrocho 2019-10-08 19:50:45 +02:00
parent a7581f9f69
commit 4495884093
11 changed files with 51 additions and 85 deletions

View File

@ -113,31 +113,6 @@ if(PYTHON_MODULE)
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_link_libraries(pycatima PRIVATE catima) target_link_libraries(pycatima PRIVATE catima)
# find_program(CYTHON_EXECUTABLE
# NAMES cython cython2 cython3 cython.bat
# DOC "path to the cython executable"
# )
# if(NOT CYTHON_EXECUTABLE)
# MESSAGE(SEND_ERROR "Cython not found, it is required to build nurex python modules")
# endif(NOT CYTHON_EXECUTABLE)
# MESSAGE(STATUS "Cython found: " ${CYTHON_EXECUTABLE})
### build libraries string
# foreach(entry ${EXTRA_LIBS} ${GSL_LIBRARIES} catima)
# LIST (APPEND EXTRA_PYTHON_LIBS \"${entry}\")
# endforeach(entry ${EXTRA_LIBS} ${GSL_LIBRARIES} catima)
# string (REPLACE ";" "," EXTRA_PYTHON_LIBS "${EXTRA_PYTHON_LIBS}")
# if(THREADS)
# set (CYTHON_DEFINES "-DUSE_THREADS=1")
# endif(THREADS)
### insert libraries string and create setup.py
# FILE(COPY catimac.pxd catima.pyx DESTINATION ${PROJECT_BINARY_DIR})
# set(CATIMA_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}catima${CMAKE_SHARED_LIBRARY_SUFFIX})
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in ${PROJECT_BINARY_DIR}/setup.py)
# add_custom_target(target_python ALL DEPENDS catima)
# add_custom_command(TARGET target_python
# COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/setup.py build_ext ${CYTHON_DEFINES} -i
# )
endif(PYTHON_MODULE ) endif(PYTHON_MODULE )
########## Sub Directories ########### ########## Sub Directories ###########

View File

@ -27,7 +27,7 @@ constexpr bool reactions = true;
constexpr bool reactions = false; constexpr bool reactions = false;
#endif #endif
constexpr double PI = 3.1415926535897932384626433832795;
constexpr double Avogadro = 6.022140857; // 10^23 constexpr double Avogadro = 6.022140857; // 10^23
constexpr double electron_mass = 0.510998928; // MeV/c^2 constexpr double electron_mass = 0.510998928; // MeV/c^2
constexpr double atomic_mass_unit = 931.4940954; // MeV/c^2 constexpr double atomic_mass_unit = 931.4940954; // MeV/c^2

View File

@ -1,10 +1,10 @@
CATima library manual {#mainpage} CATima library manual
===================== =====================
Compiling and Instalation Compiling and Instalation
------------------------- -------------------------
See [README.md](README.md) for details. See [README.md](README.md) for details.
[link2](catima_calculator.md)
Units Units
------ ------
The following units are used for input and outputs: The following units are used for input and outputs:
@ -41,27 +41,29 @@ There are 2 ways to define materials: specifying all elements in constructor or
The example of water definition: The example of water definition:
```cpp ```cpp
catima::Material carbon({0,6,1}); // carbon with elemental atomic weight
catima::Material water1({ catima::Material water1({
{1,1,2}, // 2 atoms of 1H {1,1,2}, // {weight, Z, stn or weight fraction}
{16,8,1} // 1 atom of 16O {16,8,1}
}); });
water1.density(1.0); water1.density(1.0);
water1.thickness(2.0); water1.thickness(2.0);
water1.I(78.); // set custom ionization potential in eV
catima::Material water2; catima::Material water2;
water2.add_element(1,1,2); water2.add_element(1,1,2);
water2.add_element(16,8,1); water2.add_element(16,8,1);
water2.density(1.0).thickness(2.0); water2.density(1.0).thickness(2.0);
``` ```
If mass number is equal to 0, the mass number of the element is taken as atomic weight of the element with provided Z If mass number is equal to 0, the mass number of the element is taken as atomic weight of the element.
Other methods which can be used for Material: Compound elements can be defined either via stoichiometric number or via weight fraction. If the number is less than 1
it is assumed weight fraction is being used, otherwise stoichiometric number or molar fraction is being used.
```cpp ```cpp
double den = water2.density(); //den equals 1.0 catima::Material air ({{0,7,0.755267},{0,8,0.231781},{0,18,0.012827},{0,6,0.000124}},0.001205); // weight fractions
double th = water2.thickness(); //th equals 2.0 catima::Material water ({{0,1,2},{0,8,1}},1); // mole fraction
double molar_mass = water2.M(); // get molar mass of water
int ncomp = water2.ncomponents(); // ncomp equals 2
``` ```
### predefined materials ### ### predefined materials ###
If the library is compiled with predefined materials database, the Material can be retrieved from the database as: If the library is compiled with predefined materials database, the Material can be retrieved from the database as:
```cpp ```cpp
@ -69,31 +71,8 @@ using namespace catimal
Material water = get_material(material::WATER); Material water = get_material(material::WATER);
Material graphite = get_material(6); Material graphite = get_material(6);
``` ```
currently all meterial up to Z=98 are predefined plus compounds from MOCADI:
``` The list of predefined material can be found at __material_database.h__ file
enum material{
PLASTIC = 201,
AIR = 202,
CH2,
LH2,
LD2,
WATER,
DIAMOND,
GLASS,
ALMG3,
ARCO2_30,
CF4,
ISOBUTANE,
KAPTON,
MYLAR,
NAF,
P10,
POLYOLEFIN,
CMO2,
SUPRASIL,
HAVAR
};
```
Calculation Calculation
@ -130,7 +109,6 @@ double domega2dx(Projectile &p, double T, const Material &t, Config c=default_co
double range(Projectile &p, double T, const Material &t, Config c=default_config); double range(Projectile &p, double T, const Material &t, Config c=default_config);
double range_straggling(Projectile &p, double T, const Material &t, Config c=default_config); double range_straggling(Projectile &p, double T, const Material &t, Config c=default_config);
double angular_straggling(Projectile &p, double T, const Material &t, Config c=default_config); double angular_straggling(Projectile &p, double T, const Material &t, Config c=default_config);
\end{verbatim}
``` ```
Example calculation: Example calculation:
@ -179,9 +157,20 @@ This __default_config__ is supplied as default argument to functions like catima
the structure Config is defined as: the structure Config is defined as:
```cpp ```cpp
struct Config{ struct Config{
char z_effective=z_eff_type::atima; #ifndef GLOBAL
char skip=skip_none; unsigned char z_effective=z_eff_type::pierce_blann;
char dedx = 0; #else
unsigned char z_effective=z_eff_type::atima14;
#endif
#ifdef REACTIONS
unsigned char skip=skip_none;
#else
unsigned char skip=skip_calculation::skip_reactions;
#endif
unsigned char corrections = 0;
unsigned char calculation = 1;
}; };
``` ```
@ -223,7 +212,7 @@ For example check examples directory and makefile inside to see how to link.
All functions and classes are inside __catima namespace__ All functions and classes are inside __catima namespace__
Normally including main file is enough: Normally including main file is enough:
```cppp ```cpp
#include "catima/catima.h" #include "catima/catima.h"
``` ```

BIN
examples/dedx Executable file

Binary file not shown.

View File

@ -15,7 +15,7 @@ int main(){
catima::Material water2({ // material with 2 atoms catima::Material water2({ // material with 2 atoms
{1,1,2}, // 1H - two atoms {1,1,2}, // 1H - two atoms
{16,8,1} // 16O - 1 atom {16,8,1} // 16O - 1 atom
},1.0,78); }, 1.0,78.); // density and custom ionization potential
water2.thickness(2.0); water2.thickness(2.0);

BIN
examples/ls_coefficients Executable file

Binary file not shown.

View File

@ -1,4 +1,4 @@
PROGRAMS=simple dedx example2 materials ls_coefficients reactions PROGRAMS=simple dedx materials ls_coefficients
GCC=g++ -Wall -std=c++14 GCC=g++ -Wall -std=c++14
INCDIR=-I$(CATIMAPATH)/include INCDIR=-I$(CATIMAPATH)/include

BIN
examples/materials Executable file

Binary file not shown.

View File

@ -7,15 +7,15 @@ using std::endl;
int main(){ int main(){
catima::Material graphite = catima::get_material(6); catima::Material graphite = catima::get_material(6);
catima::Material water = catima::get_material(catima::material::Water); catima::Material P10 = catima::get_material(catima::material::P10);
cout<<"Material info"<<endl; cout<<"Material info"<<endl;
cout<<"Molar Mass = "<<graphite.M()<<endl; cout<<"Molar Mass = "<<graphite.M()<<endl;
cout<<"density = "<<graphite.density()<<endl; cout<<"density = "<<graphite.density()<<endl;
cout<<"Material info"<<endl; cout<<"Material info"<<endl;
cout<<"Molar Mass = "<<water.M()<<endl; cout<<"Molar Mass = "<<P10.M()<<endl;
cout<<"density = "<<water.density()<<endl; cout<<"density = "<<P10.density()<<endl;
return 0; return 0;
} }

BIN
examples/simple Executable file

Binary file not shown.

View File

@ -12,9 +12,11 @@ int main(){
graphite.thickness(2.0); // thickness in g/cm2 graphite.thickness(2.0); // thickness in g/cm2
catima::Material water({ // material with 2 atoms catima::Material water({ // material with 2 atoms
{1,1,2}, // 1H - two atoms {0,1,2}, // H - two atoms
{16,8,1} // 16O - 1 atom {0,8,1} // O - 1 atom
}); },
1.0 // density in g/cm3
);
water.density(1.0).thickness(2.0); water.density(1.0).thickness(2.0);
catima::Projectile p(12,6); // define projectile, ie 12C catima::Projectile p(12,6); // define projectile, ie 12C