mirror of
https://github.com/gwm17/catima.git
synced 2024-11-22 18:28:51 -05:00
commit
7ace296f36
|
@ -113,31 +113,6 @@ if(PYTHON_MODULE)
|
|||
$<INSTALL_INTERFACE:include>)
|
||||
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 )
|
||||
|
||||
########## Sub Directories ###########
|
||||
|
|
|
@ -27,7 +27,7 @@ constexpr bool reactions = true;
|
|||
constexpr bool reactions = false;
|
||||
#endif
|
||||
|
||||
|
||||
constexpr double PI = 3.1415926535897932384626433832795;
|
||||
constexpr double Avogadro = 6.022140857; // 10^23
|
||||
constexpr double electron_mass = 0.510998928; // MeV/c^2
|
||||
constexpr double atomic_mass_unit = 931.4940954; // MeV/c^2
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
CATima library manual {#mainpage}
|
||||
CATima library manual
|
||||
=====================
|
||||
|
||||
Compiling and Instalation
|
||||
-------------------------
|
||||
See [README.md](README.md) for details.
|
||||
|
||||
[link2](catima_calculator.md)
|
||||
Units
|
||||
------
|
||||
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:
|
||||
|
||||
```cpp
|
||||
|
||||
catima::Material carbon({0,6,1}); // carbon with elemental atomic weight
|
||||
|
||||
catima::Material water1({
|
||||
{1,1,2}, // 2 atoms of 1H
|
||||
{16,8,1} // 1 atom of 16O
|
||||
{1,1,2}, // {weight, Z, stn or weight fraction}
|
||||
{16,8,1}
|
||||
});
|
||||
water1.density(1.0);
|
||||
water1.thickness(2.0);
|
||||
water1.I(78.); // set custom ionization potential in eV
|
||||
|
||||
catima::Material water2;
|
||||
water2.add_element(1,1,2);
|
||||
water2.add_element(16,8,1);
|
||||
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
|
||||
Other methods which can be used for Material:
|
||||
If mass number is equal to 0, the mass number of the element is taken as atomic weight of the element.
|
||||
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
|
||||
double den = water2.density(); //den equals 1.0
|
||||
double th = water2.thickness(); //th equals 2.0
|
||||
double molar_mass = water2.M(); // get molar mass of water
|
||||
int ncomp = water2.ncomponents(); // ncomp equals 2
|
||||
catima::Material air ({{0,7,0.755267},{0,8,0.231781},{0,18,0.012827},{0,6,0.000124}},0.001205); // weight fractions
|
||||
catima::Material water ({{0,1,2},{0,8,1}},1); // mole fraction
|
||||
```
|
||||
|
||||
### predefined materials ###
|
||||
If the library is compiled with predefined materials database, the Material can be retrieved from the database as:
|
||||
```cpp
|
||||
|
@ -69,31 +71,8 @@ using namespace catimal
|
|||
Material water = get_material(material::WATER);
|
||||
Material graphite = get_material(6);
|
||||
```
|
||||
currently all meterial up to Z=98 are predefined plus compounds from MOCADI:
|
||||
```
|
||||
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
|
||||
};
|
||||
```
|
||||
|
||||
The list of predefined material can be found at __material_database.h__ file
|
||||
|
||||
|
||||
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_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:
|
||||
|
@ -179,9 +157,20 @@ This __default_config__ is supplied as default argument to functions like catima
|
|||
the structure Config is defined as:
|
||||
```cpp
|
||||
struct Config{
|
||||
char z_effective=z_eff_type::atima;
|
||||
char skip=skip_none;
|
||||
char dedx = 0;
|
||||
#ifndef GLOBAL
|
||||
unsigned char z_effective=z_eff_type::pierce_blann;
|
||||
#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__
|
||||
|
||||
Normally including main file is enough:
|
||||
```cppp
|
||||
```cpp
|
||||
#include "catima/catima.h"
|
||||
```
|
||||
|
||||
|
|
BIN
examples/dedx
Executable file
BIN
examples/dedx
Executable file
Binary file not shown.
|
@ -15,7 +15,7 @@ int main(){
|
|||
catima::Material water2({ // material with 2 atoms
|
||||
{1,1,2}, // 1H - two atoms
|
||||
{16,8,1} // 16O - 1 atom
|
||||
},1.0,78);
|
||||
}, 1.0,78.); // density and custom ionization potential
|
||||
|
||||
water2.thickness(2.0);
|
||||
|
||||
|
|
BIN
examples/ls_coefficients
Executable file
BIN
examples/ls_coefficients
Executable file
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
PROGRAMS=simple dedx example2 materials ls_coefficients reactions
|
||||
PROGRAMS=simple dedx materials ls_coefficients
|
||||
|
||||
GCC=g++ -Wall -std=c++14
|
||||
INCDIR=-I$(CATIMAPATH)/include
|
||||
|
|
BIN
examples/materials
Executable file
BIN
examples/materials
Executable file
Binary file not shown.
|
@ -7,15 +7,15 @@ using std::endl;
|
|||
|
||||
int main(){
|
||||
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<<"Molar Mass = "<<graphite.M()<<endl;
|
||||
cout<<"density = "<<graphite.density()<<endl;
|
||||
|
||||
cout<<"Material info"<<endl;
|
||||
cout<<"Molar Mass = "<<water.M()<<endl;
|
||||
cout<<"density = "<<water.density()<<endl;
|
||||
cout<<"Molar Mass = "<<P10.M()<<endl;
|
||||
cout<<"density = "<<P10.density()<<endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
BIN
examples/simple
Executable file
BIN
examples/simple
Executable file
Binary file not shown.
|
@ -12,9 +12,11 @@ int main(){
|
|||
graphite.thickness(2.0); // thickness in g/cm2
|
||||
|
||||
catima::Material water({ // material with 2 atoms
|
||||
{1,1,2}, // 1H - two atoms
|
||||
{16,8,1} // 16O - 1 atom
|
||||
});
|
||||
{0,1,2}, // H - two atoms
|
||||
{0,8,1} // O - 1 atom
|
||||
},
|
||||
1.0 // density in g/cm3
|
||||
);
|
||||
water.density(1.0).thickness(2.0);
|
||||
|
||||
catima::Projectile p(12,6); // define projectile, ie 12C
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "integrator.h"
|
||||
|
||||
//#ifdef GSL_INTEGRATION
|
||||
#ifdef GSL_INTEGRATION
|
||||
#include "gsl/gsl_integration.h"
|
||||
#include "gsl/gsl_errno.h"
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
namespace catima{
|
||||
integrator_type integrator;
|
||||
|
|
14
reactions.h
14
reactions.h
|
@ -17,12 +17,10 @@
|
|||
#ifndef REACTIONS_H
|
||||
#define REACTIONS_H
|
||||
#include "catima/build_config.h"
|
||||
#ifdef NUREX
|
||||
#include "catima/structures.h"
|
||||
#include "catima/config.h"
|
||||
#include "catima/integrator.h"
|
||||
#include <cmath>
|
||||
#endif
|
||||
|
||||
namespace catima{
|
||||
|
||||
|
@ -58,17 +56,7 @@ double SigmaR_Kox(int Ap, int Zp, double E, int At, int Zt);
|
|||
inline double p_from_T(double T, double M=1.0){
|
||||
return M*sqrt(T*T + 2*T*atomic_mass_unit);
|
||||
}
|
||||
/*
|
||||
inline double Ecm_from_T_relativistic(double T, double Ap, double At){
|
||||
double mp = Ap*atomic_mass_unit;
|
||||
double mt = At*atomic_mass_unit;
|
||||
double plab= p_from_T(T,Ap);
|
||||
double elab = sqrt(plab*plab + mp*mp);
|
||||
double ecm = sqrt(mp*mp + mt*mt + 2*elab*mt);
|
||||
double pcm = plab * mt / ecm;
|
||||
return sqrt(pcm*pcm+mp*mp)-mp;
|
||||
}
|
||||
*/
|
||||
|
||||
/// calculates Ecm fom T, return in MeV units
|
||||
inline double Ecm_from_T(double T, double Ap, double At){
|
||||
return T*Ap*At/(Ap+At);
|
||||
|
|
|
@ -87,6 +87,7 @@ namespace catima{
|
|||
* Maetrial water({
|
||||
{1,1,2},
|
||||
{16,8,1},
|
||||
1.0, // optional density
|
||||
});
|
||||
* \endcode
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user