Skip to content

Instantly share code, notes, and snippets.

View Luthaf's full-sized avatar
🦆

Guillaume Fraux Luthaf

🦆
View GitHub Profile
@Luthaf
Luthaf / build.jl
Last active January 3, 2023 01:21
Using pip to install python dependencies for Julia.
using PyCall
# Change that to whatever packages you need.
const PACKAGES = ["pyyaml"]
# Import pip
try
@pyimport pip
catch
# If it is not found, install it
@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
@Luthaf
Luthaf / Foo.cpp
Last active September 18, 2023 22:40
Calling C++ from Fortran
#include "Foo.hpp"
#include <iostream>
using namespace std;
Foo::Foo(int _a, int _b): a(_a), b(_b){
cout << "C++ side, constructor" << endl;
}
Foo::~Foo(){