Skip to content

Instantly share code, notes, and snippets.

View Luthaf's full-sized avatar
🦆

Guillaume Fraux Luthaf

🦆
View GitHub Profile
@Luthaf
Luthaf / chemiscope-nan-to-sparse.py
Created January 24, 2022 14:05
Chemiscope NaN to sparse environments
import gzip
import json
import numpy as np
input_path = "TODO"
output_path = "TODO"
if input_path.endswith(".gz"):
with gzip.open(input_path) as fd:
@Luthaf
Luthaf / chemiscope-nan-to-sparse.py
Created July 21, 2021 15:38
Transform chemiscope input with NaN to the new sparse environenments format
import gzip
import json
import numpy as np
input_path = "./app/examples/Zeolites.json.gz"
output_path = "Zeolites.json.gz"
with gzip.open(input_path) as fd:
data = json.load(fd)
@Luthaf
Luthaf / aarch64.cmake
Last active December 19, 2022 18:24
Ubuntu CMake Toolchain files
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 October 2, 2017 20:33
External buffer for nbind
#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 April 6, 2017 10:25
lazy_static in benchmarks
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"
$ 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 February 21, 2017 11:06
Initial configurations
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 September 16, 2016 20:49
Chemfiles Bus Error
==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)
@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
}