Skip to content

Instantly share code, notes, and snippets.

View robertodr's full-sized avatar
🤡
Clowning around

Roberto Di Remigio Eikås robertodr

🤡
Clowning around
View GitHub Profile
include(CheckCXXCompilerFlag)
list(APPEND ASAN_FLAGS "-fsanitize=address" "-fno-omit-frame-pointer")
foreach(flag IN LISTS ASAN_FLAGS)
set(CMAKE_REQUIRED_FLAGS ${flag})
check_cxx_compiler_flag(${flag} flag_works)
unset(CMAKE_REQUIRED_FLAGS)
if(flag_works)
string(REPLACE " " ";" _flag ${flag})
list(APPEND _asan_flags ${_flag})

Keybase proof

I hereby claim:

  • I am robertodr on github.
  • I am robertodr (https://keybase.io/robertodr) on keybase.
  • I have a public key whose fingerprint is 856B 1961 DB91 0E16 8F24 6C25 E4FA DFE6 DFB2 9C6E

To claim this, I am signing this object:

@robertodr
robertodr / reftex-markdown.el
Created December 28, 2018 00:31 — forked from kleinschmidt/reftex-markdown.el
Insert markdown (pandoc-citeproc) formatted citations using RefTeX
;; reftex in markdown mode
;; if this isn't already set in your .emacs
(setq reftex-default-bibliography '("/path/to/library.bib"))
;; define markdown citation formats
(defvar markdown-cite-format)
(setq markdown-cite-format
'(
(?\C-m . "[@%l]")
@robertodr
robertodr / update-runtest.md
Last active January 14, 2020 22:35
Update to runtest v2
  1. Compile LSDALTON.
  2. Select a test (e.g. ddynam). Tests that use v1 of runtest are declared using the CMake macro add_lsdalton_runtest_v1. Choose one and cd to its folder.
  3. Run it with ./test -b /build/folder
  4. Edit the test script:
    • Adjust imports. Screenshot from 2020-01-14 23-21-57
    • Declare filters as a list not an object. Screenshot from 2020-01-14 23-24-27
    • Run the tests, looping over lists of inputs if necessary. Accumulate the exit code into the ierr variable. Screenshot from 2020-01-14 23-24-27
try: dict
except: from UserDict import UserDict as dict
class Xlator(dict):
""" All-in-one multiple-string-substitution class """
def _make_regex(self):
""" Build re object based on the keys of the current dictionary """
return re.compile("|".join(map(re.escape, self.keys( ))))
def __call__(self, match):
@robertodr
robertodr / cube-slider.py
Created March 3, 2021 12:44
Visualize two cube files with an interactive slider
from ipywidgets import interact, fixed, widgets
@interact(mol_xyz=fixed(pyridine_xyz), cube=widgets.SelectionSlider(options=["HOMO", "LUMO"], description="MO"))
def draw_geometry_and_cube(mol_xyz, cube):
# Adapted from: https://adreasnow.com/Cheat%20Sheets/Python/Psi4Interactive/#viewing-psi4-molecules-with-cubes-py3dmol
# read volumetric data
with open(f"{cube}.cube", "r") as f:
cube = f.read()
@robertodr
robertodr / dftd3-pre-jax-profile.py
Created April 7, 2021 08:03
Example profiling script for pyDFTD3 v2.0a0
import cProfile
from dftd3.dftd3 import d3
def main(charges, coordinates, functional, damping):
_, _, _ = d3(charges, coordinates, functional=functional, damp=damping)
coordinates = [
@robertodr
robertodr / dftd3-gradient-profile.py
Created April 7, 2021 08:18
Example profiling script for D3 gradient with JAX
import cProfile
from dftd3.dftd3 import D3Configuration, D3_derivatives
def main(order, config, charges, coordinates):
_ = D3_derivatives(order, config, charges, *coordinates)
coordinates = [
@robertodr
robertodr / configuration.nix
Created September 13, 2021 13:37
Caddy on NixOS
{ config, pkgs, options, ... }:
let
baseConfig = {
allowUnfree = true;
};
unstable = import <nixos-unstable> { config = baseConfig; };
in
{
imports = [
@robertodr
robertodr / flake.nix
Last active December 14, 2023 12:36
Sample Nix flake using mach-nix
{
description = "veloxchem-hpc";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
pypi-deps-db = {
url = "github:DavHau/pypi-deps-db/a8ea7f774b76d3b61237c0bc20c97629a2248462";
flake = false;
};
mach-nix = {