README.md 4.25 KB
Newer Older
1 2 3 4
# ZCross

## Introduction

Michele Renda's avatar
Michele Renda committed
5
`ZCross` is a C++ library to read cross section tables for electron and ion scattering processes.
6

Michele Renda's avatar
Michele Renda committed
7 8 9 10
If you use this project in your research, please consider citing [this article](http://www.nipne.ro/rjp/2019_64_9-10/RomJPhys.64.402.pdf) ([bibtex](doc/zcross.bib)):

> *ZCross: A Versatile Library to Manage Gas Scattering Cross-Section Table*  
> *Romanian Journal of Physics 64, 402 (2019)*
11

Michele Renda's avatar
Michele Renda committed
12
## How to install
13

Michele Renda's avatar
Michele Renda committed
14 15 16 17 18 19
First you have to clone [ZCross](https://gitlab.com/micrenda/zcross) to your pc:
``` bash
git clone https://gitlab.com/micrenda/zcross.git
```
Then you have to make sure you have the [boost](https://www.boost.org/) headers installed. For Debian/Ubuntu you can do something like:
``` bash
Michele Renda's avatar
Michele Renda committed
20
sudo apt install libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libboost-system-dev
Michele Renda's avatar
Michele Renda committed
21
```
22

Michele Renda's avatar
Michele Renda committed
23
Then you can proceed to compile and install:
24
``` bash
Michele Renda's avatar
Michele Renda committed
25 26
cd zcross
mkdir build && cd build
27 28 29 30 31
cmake CMAKE_INSTALL_PREFIX=/opt/zcross/ ..
make
sudo make install
```

Michele Renda's avatar
Michele Renda committed
32 33 34 35 36
If you are interested on the plotting utlities, please install the python binding:
``` bash
pip install zcross
```

Michele Renda's avatar
Michele Renda committed
37 38 39 40 41 42 43 44 45 46 47 48 49
**Be aware**: the compilation of `ZCross` requires the `C++17` standard. A recent Linux distribution (e.g. Debian 10, Ubuntu 19.10, CentOS 8, etc.) will likely provide a compiler with `C++17` support.

The last step consist to make the `ZCross` library available for linking. In a Debian system, it is possible to create the file `/etc/ld.so.conf.d/zcross.conf`
``` bash
/opt/zcross/lib
```
and execute:
``` bash
sudo ldconfig
```

## Getting the cross section databases

Michele Renda's avatar
Michele Renda committed
50 51
A complete set of cross-section databases can be downloaded from the [offline download section of LXCat](https://lxcat.net/data/download.php).
Save the cross section tables in any location (we suggest under `/opt/zcross_data`) and define an enviroment variable pointing to that path:
Michele Renda's avatar
Michele Renda committed
52
``` bash
Michele Renda's avatar
Michele Renda committed
53
export ZCROSS_DATA=/opt/zcross_data
Michele Renda's avatar
Michele Renda committed
54 55 56 57
```
(you can add it to your `.profile` file)

## How to use standalone client
Michele Renda's avatar
Michele Renda committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

First you have to make sure your `PATH` directory contains the zcross bin

``` bash
export PATH=$PATH:/opt/zcross/bin
```
(you can add it to your `.profile` file)

Now you can explore the cross sections in your system using the `zcross` command:
``` bash
zcross list --target 'Ar'      # List all the tables with a Argon target"
zcross list --bullet 'He^+'    # List all the tables with a Helium ion bullet"

zcross list 'Itikawa'          # List the tables of database Itikawa
zcross list 'Itikawa/N2'       # List the tables of the database Itikawa and group N2
Michele Renda's avatar
Michele Renda committed
73
zcross list 'Itikawa/N2/1-5'   # List the tables of the database Itikawa and group N2 with id between 1 and 5
Michele Renda's avatar
Michele Renda committed
74 75 76 77

zcross list '*/N2'             # List all the groups N2

zcross show 'emol-lehavre'     # Show the content of all tables of EMol-Lehavre
Michele Renda's avatar
Michele Renda committed
78

Michele Renda's avatar
Michele Renda committed
79
zcross plot 'biagi8/Ar'        # Plot the cross tables (requres the zcross python pacakge)
Michele Renda's avatar
Michele Renda committed
80 81
```

Michele Renda's avatar
Michele Renda committed
82 83 84 85
## Python interface

Another pure Python library is [avalilable](https://gitlab.com/micrenda/zcross-python) to read the cross section data. You can install it using pip:
``` bash
Michele Renda's avatar
Michele Renda committed
86
pip install zcross
Michele Renda's avatar
Michele Renda committed
87 88
```
It requires `Python 3`
Michele Renda's avatar
Michele Renda committed
89

Michele Renda's avatar
Michele Renda committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
## Project example
A stardard C++ project using `ZCross` contains these files:
``` shell
example1
  ├── CMakeLists.txt
  └── src
      └── main.cpp
```

The file `CMakeLists.txt`:

``` cmake
cmake_minimum_required(VERSION 3.0)
project(example1)

Michele Renda's avatar
Michele Renda committed
105 106
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Michele Renda's avatar
Michele Renda committed
107 108
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic" )

Michele Renda's avatar
Michele Renda committed
109
include_directories(include)
Michele Renda's avatar
Michele Renda committed
110

Michele Renda's avatar
Michele Renda committed
111
file(GLOB SOURCE_FILES src/*.cpp)
Michele Renda's avatar
Michele Renda committed
112 113
add_executable(example1 ${SOURCE_FILES})

Michele Renda's avatar
Michele Renda committed
114
find_package (ZCross REQUIRED HINTS /opt/zcross/share/zcross/cmake/ )
Michele Renda's avatar
Michele Renda committed
115
if (${ZCross_FOUND})
Michele Renda's avatar
Michele Renda committed
116 117
    target_link_libraries (example1 PUBLIC DFPE::zcross)
endif()
Michele Renda's avatar
Michele Renda committed
118
```
119

Michele Renda's avatar
Michele Renda committed
120
## Application examples
Michele Renda's avatar
Michele Renda committed
121

Michele Renda's avatar
Michele Renda committed
122 123
You can find some examples in the directory [examples](examples/):

Michele Renda's avatar
Michele Renda committed
124
[Example 1](examples/example1/doc/README.md) - List all cross section tables for a specific database
Michele Renda's avatar
Michele Renda committed
125

Michele Renda's avatar
Michele Renda committed
126
[Example 2](examples/example2/doc/README.md) - Printing the references of a table selection
Michele Renda's avatar
Michele Renda committed
127

Michele Renda's avatar
Michele Renda committed
128
[Example 3](examples/example3/doc/README.md) - Query the value of a specific table
Michele Renda's avatar
Michele Renda committed
129 130 131 132

## Support

Support and sugestions can be found in the [ZCross section](https://forum.cold-plasma.org/viewforum.php?f=8) at [Cold-Plasma Forum](https://forum.cold-plasma.org/).