Skip to content

Instantly share code, notes, and snippets.

View cortner's full-sized avatar

Christoph Ortner cortner

View GitHub Profile
import matscipy
import numpy as np
import ase
from ase import Atoms
from ase.calculators.lj import LennardJones
# set up a heptamer
r0 = 1.0
N = 6
phi = np.linspace(0., (N-1)* 2*np.pi/N, N)
@cortner
cortner / Gideon-Crash.jl
Last active December 4, 2017 13:30
Reproduces the memory overwrite bug in neighbour list
using JuLIP, JuLIP.ASE, JuLIP.Potentials
using ProgressMeter
# set up a heptamer
r0 = 1.0
N = 6
phi = linspace(0., (N-1)* 2*pi/N, N)|>collect
x0 = 2.5 # position of center
y0 = 2.5
x = x0 + [0; r0 * cos.(phi)]
# benchmarking different ways to implement AnalyticPotential,
# in order to circumvent the World Age problem
using MacroTools
using BenchmarkTools
using Calculus: differentiate
using FunctionWrappers: FunctionWrapper
const F64fun = FunctionWrapper{Float64, Tuple{Float64}}
@cortner
cortner / breakkuma.py
Last active June 23, 2017 22:49
break kumagai calculator
from numpy import *
import atomistica
from ase.atoms import *
X=array([1.42588,-3.44239,0.0,2.73662,-1.97199,1.3575,1.28782,-0.724414,2.715,2.59344,0.745918,4.0725,4.18105,-3.22103,2.715,5.49312,-1.74281,4.0725,4.04571,-0.49763,0.0,5.35298,0.981145,1.3575,1.1371,1.98901,0.0,2.43615,3.45883,1.3575,0.9722,4.69833,2.715,2.263,6.16731,4.0725,3.89681,2.22019,2.715,5.1976,3.69884,4.0725,3.73204,4.93248,0.0,5.02423,6.41037,1.3575,0.792067,7.40456,0.0,2.07289,8.87273,1.3575,0.596638,10.1094,2.715,1.86617,11.5773,4.0725,3.54938,7.64001,2.715,4.8305,9.11683,4.0725,3.34779,10.3446,0.0,4.61557,11.8207,1.3575,0.387448,12.8151,0.0,1.64536,14.2836,1.3575,0.168044,15.524,2.715,1.41555,16.9944,4.0725,3.12829,13.0491,2.715,4.38163,14.5256,4.0725,2.8949,15.7567,0.0,4.13502,17.2353,1.3575,0.0561522,25.2023,0.0,1.53117,26.4442,1.3575,0.278721,27.9135,2.715,1.75727,29.1525,4.0725,2.77516,24.9699,2.715,4.25935,26.2028,4.0725,3.01295,27.6802,0.0,4.50068,28.9098,1.3575,0.493591,30.6205,0.0,1.97151,31.8576,1.3575,0.696213,33.3255,2.71
@cortner
cortner / test_FunctionWrappers.jl
Last active December 13, 2016 19:23
minitest of FunctionWrappers.jl
#
# Test performance of FunctionWrappers.jl
#
f1(r) = exp(3.0*r)
f2(r) = cos(7*r)^2
# N evaluates of sin, cos; hard-coded
function test1(N)