Skip to content

Instantly share code, notes, and snippets.

Avatar

Guillaume Fraux Luthaf

View GitHub Profile
@Luthaf
Luthaf / aarch64.cmake
Last active Dec 12, 2019
Ubuntu CMake Toolchain files
View aarch64.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_CROSSCOMPILING TRUE)
if (CMAKE_TOOLCHAIN_FILE)
endif()
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
@Luthaf
Luthaf / ExternalBuffer.hpp
Last active Oct 2, 2017
External buffer for nbind
View ExternalBuffer.hpp
#include <cstddef>
/// A non-owning memory view in a C++ std::vector<double> like object.
class ExternalBuffer {
public:
ExternalBuffer(double* data, size_t length):
data_(data), length_(length) {}
void* data() {
return reinterpret_cast<void*>(data_);
@Luthaf
Luthaf / lazy_benchmarks.patch
Created Apr 6, 2017
lazy_static in benchmarks
View lazy_benchmarks.patch
diff --git a/Cargo.toml b/Cargo.toml
index 68e2fc36..5389a05e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,6 +26,7 @@ clap = "2"
[dev-dependencies]
bencher = "0.1"
+lazy_static = "0.2"
rand = "0.3"
View Linux Intel Xeon E5-2680
$ cargo benchcmp safe.log unsafe.log --threshold=2
name safe.log ns/iter unsafe.log ns/iter diff ns/iter diff %
cache_move_all_rigid_molecules 1,463,817 1,168,495 -295,322 -20.17%
cache_move_all_rigid_molecules_ewald 10,620,984 8,721,128 -1,899,856 -17.89%
cache_move_all_rigid_molecules_wolf 8,386,407 10,278,223 1,891,816 22.56%
cache_move_particle 201,875 244,669 42,794 21.20%
cache_move_particle_ewald 528,745 491,710 -37,035 -7.00%
cache_move_particles 354,655 282,355 -72,300 -20.39%
cache_move_particles_ewald 1,025,460 887,721 -137,739 -13.43%
cache_move_particles_wolf 507,774 553,008 45,234 8.91%
@Luthaf
Luthaf / dilated.pdb
Created Feb 21, 2017
Initial configurations
View dilated.pdb
CRYST1 100.000 100.000 100.000 90.00 90.00 90.00 P 1 1
HETATM 1 He RES X 1 4.905 84.135 0.777 1.00 0.00 He
HETATM 2 He RES X 2 88.376 32.438 11.077 1.00 0.00 He
HETATM 3 He RES X 3 84.431 8.811 41.520 1.00 0.00 He
HETATM 4 He RES X 4 101.038 20.851 52.080 1.00 0.00 He
HETATM 5 He RES X 5 97.902 6.895 72.124 1.00 0.00 He
HETATM 6 He RES X 6 6.789 11.264 7.060 1.00 0.00 He
HETATM 7 He RES X 7 88.061 9.591 13.068 1.00 0.00 He
HETATM 8 He RES X 8 1.762 9.043 29.016 1.00 0.00 He
HETATM 9 He RES X 9 6.755 39.358 58.695 1.00 0.00 He
@Luthaf
Luthaf / valgrind.log
Created Sep 16, 2016
Chemfiles Bus Error
View valgrind.log
==24579== Memcheck, a memory error detector
==24579== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==24579== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info
==24579== Command: tests/xyz
==24579==
--24579-- run: /usr/bin/dsymutil "tests/xyz"
==24579== Conditional jump or move depends on uninitialised value(s)
==24579== at 0x10000BAB1: boost::filesystem::detail::recur_dir_itr_imp::push_directory(boost::system::error_code&) (operations.hpp:1054)
==24579== by 0x10000B900: boost::filesystem::detail::recur_dir_itr_imp::increment(boost::system::error_code*) (operations.hpp:1085)
==24579== by 0x1000079E0: ____C_A_T_C_H____T_E_S_T____102() (operations.hpp:1278)
View MolecularDynamics.toml
[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 Mar 2, 2016
Iterate over particles in a molecule with a pointer
View molecules.rs
use std::slice;
pub struct Vector3d([f64; 3]);
pub struct Atom {
pub position: Vector3d,
pub velocity: Vector3d,
pub name: String
}
@Luthaf
Luthaf / build.jl
Last active Mar 22, 2020
Using pip to install python dependencies for Julia.
View build.jl
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 Feb 5, 2016
Cloning Boxed trait objects
View potentials.rs
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> {
You can’t perform that action at this time.