Skip to content
Spin dynamics of a pulsar orbiting a massive spinning BH with an arbitrary quadrupole
Forth Mathematica Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Spin Curvature Dynamics of a Pulsar in Kerr Spacetime with an arbitrary mass quadrupole

This code calculates the orbital motion of an astrophysical body, such as a pulsar, on a background Kerr spacetime with an arbitrary mass quadrupole. It is based on the SpinCurvatureDynamics Code for a Kerr spacetime, and the quasi-Kerr metric of Glampedakis & Babak. Going beyond the point particle approximation, we instead model an extended spinning body via the Mathisson-Papertrou-Dixon equations.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.


This code is written in FORTRAN with a gfortran compiler. Other compilers have not been tested. The gfortran installation binaries can be found here, although typically gfortran comes pre-installed on most Linux/Unix systems. If you have Homebew installed on OSX, you can simply run

brew install gcc

Starting steps

After cloning the repo, the first thing to do is to set the path to the output files that the code will produce. This can be done by setting the environment variable as

echo 'export QuadDir="/Users/tomkimpson/Data/Quadrupole/"' >> ~/.bash_profile
source ~/.bash_profile

Just change the path Users/tomkimpson/Data/Quadrupole/ to some appropriate local path.

You can check the environemnt variable has been added to bash_profile by either env or vim ~/.bashprofile

The code should then run as is, out of the box. Try

to compile and run the code. Once you have checked that everything is running OK, you can then start playing. The code structure (mdoules, subroutines etc.) is outlined below.

If making edits to the code, try to keep to the FORTRAN Style Guide



  • parameters.f. Defines all the system parameters which are constant over multiple iterations. Parameters which are changed between runs (e.g. BH spin a) are set at the start of main.f

  • constants.f. Calculations with the defined parameters. No changes should be necessary to this file

  • main.f. The main program from which the code is run and modules are called. Start here.

  • initial_conditions.f. Sets up the initial conditions c.f. spin, momentum, energy, angular momentum etc.

  • derivatives.f. Defines what to do at each integration step. Calls the derivates from tensors.f and QuadExpressions.f

  • rk.f. Defines the iterative runge-kutta integration and I/O.

  • Python wrapper to run + compile


  • Mathematica/ contains the code used for constructing the Christoffel/Riemann tensors for the metric


You can’t perform that action at this time.