Skip to content

Instantly share code, notes, and snippets.

View Luthaf's full-sized avatar
🦆

Guillaume Fraux Luthaf

🦆
View GitHub Profile
@Luthaf
Luthaf / MolecularDynamics.toml
Created March 25, 2016 23:13
TOML input files
[input]
version = 1.0
[[systems]]
cell = 20 # Cubic cell
positions = "initial.xyz"
velocities = {init = "300 K"}
potentials = "potentials.toml"
[[simulations]]
@Luthaf
Luthaf / molecules.rs
Created March 2, 2016 16:16
Iterate over particles in a molecule with a pointer
use std::slice;
pub struct Vector3d([f64; 3]);
pub struct Atom {
pub position: Vector3d,
pub velocity: Vector3d,
pub name: String
}
@Luthaf
Luthaf / potentials.rs
Created February 5, 2016 21:32
Cloning Boxed trait objects
trait Potential {
fn energy(&self) -> f64;
}
// This is just a marker trait, to know which potentials can be used as pair
// potentials. I also have AnglePotential, GlobalPotential, ...
trait PairPotential: Potential {}
impl Clone for Box<PairPotential> {
fn clone(&self) -> Box<PairPotential> {
@Luthaf
Luthaf / potential.yml
Last active October 12, 2015 09:22
Input files in YAML
pairs: # Non bonded atoms pairs
- atoms: [*, *] # Default value
type: NullPotential
- atoms: [He, He]
type: LennardJones
sigma: 3.4 A
epsilon: 0.45 kJ/mol
- atoms: [He, Ar]
type: LennardJones
sigma: 2.8 A