/bibber

Rolling my own molecular dynamics.

Primary LanguageRust

Bibber 🧊🧬

My little toy molecular dynamics engine.

Disclaimer:

Do not ever use anything I create ever.

Well, I mean, go ahead actually. But I cannot guarantee it is correct.

With this project, I am in fact utterly sure that it is incorrect.

About

This is basically a naive (read 'bad') implementation an canonical ensemble. In other words, the number of particles, volume, and temperature are held constant (NVT).

The system has a constant number of particles that are randomly dispersed over the boundary volume. The volume is held constant by... not doing anything to the boundary. The temperature is kept constant by means of a Berendsen thermostat (again, my work here is still a terrible, incorrect implementation). Under this model, the velocity vectors of all particles in the system are rescaled to bring the temperature to the set point. If the temperature is lower than the set point, the velocities are increased, and when lower, velocities are scaled down.

Usage

You must configure a system using a recipe.bibber file. See Configuration. This file must exist in the current working directory.

For now, bibber writes a trajectory to standard out in .gro format. You can redirect the stdout stream into a file.

bibber > out.gro

After the simulation is completed, you can inspect the out.gro file in any way you like. I use pymol.

Installation

It's just a simple rust project, so you might already know the drill.

Clone the project. Build in release mode.

git clone https://github.com/koenwestendorp/bibber
cd bibber
cargo build --release
# The executable can be found at target/release/bibber

To run, you can simply

cargo run --release

You can also install it, if you like.

cargo install --path .

Now you can run it as shown in the Usage section :)

Configuration

Simulations can be specified and configured using a recipe.bibber file.

Example

Here is an example.

recipe.bibber

title       Our little system

start       0:ns
end         1:ns
timestep    10:fs
snapshot    10:ps

temperature 300:K

particles   30

boundary    cubic   10:nm   10:nm   10:nm

Syntax

Here is a small spec for how bibber configuration is to be written and interpreted.

Note:

This specification is incomplete and might not be updated in exact lockstep with the implementation as long as this little box is here. Be kind and open a small issue if you notice a mistake :)

Entries

The possible entries are:

  • title string
  • start time
  • end time
  • timestep time
  • snapshot time
  • temperature temperature
  • boundary condition length length length

Fields

The fields can be specified as follows:

  • string: just a string.
  • time: a value with a time unit.
  • length: a value with a length unit.
  • temperature: a value with a temperature unit.
  • condition: a string describing the shape of the periodic boundary conditions (currently, only cubic is implemented).

Units

A value with some unit is specified as a float followed directly (no space) by a colon (:) and some appropriate unit.

Any other units than those specified here are invalid. Units cannot be omitted.

Time

  • :s seconds
  • :ms milliseconds
  • :us microseconds
  • :ns nanoseconds
  • :ps picoseconds
  • :fs femtoseconds

Length

  • :km kilometers
  • :m meters
  • :dm decimeters
  • :cm centimeters
  • :mm millimeters
  • :um micrometers
  • :nm nanometers
  • :pm picometers
  • :fm femtometers

Temperature

  • :K Kelvin
  • :C Celsius (0 °C is 273.15 K)