Skip to content

Instantly share code, notes, and snippets.

View pastewka's full-sized avatar

Lars Pastewka pastewka

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pastewka on github.
  • I am pastewka (https://keybase.io/pastewka) on keybase.
  • I have a public key whose fingerprint is 5D9A 2E8D 588C A996 AC0B F767 8FF9 C74C 5FF5 1678

To claim this, I am signing this object:

@pastewka
pastewka / get_free_cuda_devices.c
Last active December 26, 2015 19:48
Print a list of free CUDA devices on screen. This is useful to select a free GPU in a job submission script.
/* ======================================================================
Copyright (2013) Lars Pastewka
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#! /usr/bin/env python
from socket import gethostname
from mpi4py import MPI
print "Process", MPI.COMM_WORLD.Get_rank(), "of", MPI.COMM_WORLD.Get_size(), "runs on host", gethostname()
@pastewka
pastewka / matplotlibrc
Last active September 21, 2016 13:49
My matplotlibrc
# Place in $HOME/.config/matplotlib/matplotlibrc
backend : Qt4Agg
font.family : sans-serif
font.sans-serif : Arial Unicode MS
font.size : 10.0
svg.fonttype : none
xtick.labelsize : 8 # fontsize of the tick labels
ytick.labelsize : 8 # fontsize of the tick labels
pdf.fonttype : 42 # Output Type 3 (Type3) or Type 42 (TrueType)
legend.frameon : False
@pastewka
pastewka / compute_virial.sh
Created November 16, 2016 10:30
Compute virial from a trajectory file in a post-processing step
#! /usr/bin/env python
from __future__ import division, print_function
import sys
from ase.io import NetCDFTrajectory
from atomistica import TabulatedAlloyEAM, KumagaiScr
@pastewka
pastewka / reset_to_upstream.sh
Created May 4, 2017 11:56
Reset git repository upstream/master
#! /bin/bash -x
git fetch upstream
git checkout master
git reset --hard upstream/master
@pastewka
pastewka / Stress field under a sliding spherical indenter.ipynb
Created June 13, 2017 06:56
Stress field under a sliding spherical indenter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pastewka
pastewka / png2mp4.sh
Created July 25, 2017 19:33
Encode sequence of pngs to mp4
ffmpeg -r 60 -f image2 -i vacancy_diffusion%04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4
@pastewka
pastewka / nc2data.cpp
Last active July 27, 2017 11:32
Convert AMBER NetCDF trajectory to LAMMPS data file
/*
Copyright (c) 2017 Lars Pastewka
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@pastewka
pastewka / ncsparsify.sh
Last active September 24, 2017 07:10
Pick out every n-th frame from a NetCDF file
# --rad is "retain all dimensions", makes sure unused dimensions are not deleted
ncks --rad -F -d frame,1,,n input.nc output.nc