gezhuang0717 / penning_trap2

Implementation in C++ of a simulated Penning trap. More in detail, the repo contains both the code for studying the resonance phenomen of a Penning trap subject to a time-dependant electric potential and also the Python code used to generate relevant plots.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

penning_trap

License Language Size

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.

Table of contents

Requirements

In order to be able to run everything succesfully you will need:

  • A C++11 compiler
  • armadillo, an efficient linear algebra library
  • cmake, for building (optional, recommended)

Building

Clone this repo with

git clone https://github.com/CloriCaprile/penning_trap.git

or

git clone git@github.com:CloriCaprile/penning_trap.git

g++

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

CMAKE

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.

Filesystem

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.

Tests

CMake provides an easy command for code testing, i.e. from build/ you can run

ctest

In this way all tests are run.

License

The code here presented is released under version 3 of the GNU General Public License.

Aknowledgements

About

Implementation in C++ of a simulated Penning trap. More in detail, the repo contains both the code for studying the resonance phenomen of a Penning trap subject to a time-dependant electric potential and also the Python code used to generate relevant plots.

License:GNU General Public License v3.0


Languages

Language:C++ 67.9%Language:Python 29.0%Language:CMake 3.1%