Basic implementation of a simulated Penning trap in C++.
Here you can find the code needed for studying the motion of a chosen number of particles with any value of charge and mass, with or without mutual interaction inside of the Penning trap. It is also possible to add a time-dependent potential. The Python code used to generate relevant plots is also included.
This repo is mantained by group 100 of the course FYS3150/4150 at UiO.
In order to be able to run everything succesfully you will need:
- A
C++11
compiler armadillo
, an efficient linear algebra librarycmake
, for building (optional, recommended)
Clone this repo with
git clone https://github.com/CloriCaprile/penning_trap.git
or
git clone [email protected]:CloriCaprile/penning_trap.git
You can compile and link with g++
.
g++ main.cpp src/*.cpp -I include -larmadillo -o penningtrap
You might need to add the -std=gnu++11
if you are a Mac user.
You can then run the executable with
./penningtrap
Alternatively you can build everything with cmake
. First you need to create a build/
directory and move into it
mkdir build; cd build
Now you just need to run
cmake ..
If it outputs correctly you should be able to build the project by runnning
make
from the same build/
directory.
The repo is organized as follows:
penning_trap
│
└───build/
│ └───data/
│ └───plots/
│
└───include/
│
└───src/
│
└───test/
Inside the build/
directory you can find the executables and two subfolders: build/data/
for storing the resulting data and build/plots/
for storing the plots of the same resulting data.
In the include/
directory are stored all the header filese and in the src/
directory are stored the source files.
Here you can find also the python scripts that make the graphs and store them in build/plots/
. For example, to make the plots of twobody.cpp
simply run
python3 twobody.py
from src/
.
The test/
directory is meant for the testing of the built code.
CMake provides an easy command for code testing, i.e. from build/
you can run
ctest
In this way all tests are run.
The code here presented is released under version 3 of the GNU General Public License.