Skip to content

Instantly share code, notes, and snippets.

View nathanmlim's full-sized avatar

Nathan M. Lim nathanmlim

View GitHub Profile
@nathanmlim
nathanmlim / Brewfile
Last active April 26, 2020 15:52
Homebrew Files
cask_args appdir: "/Applications"
### TAPS
tap "getantibody/tap"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "mas-cli/tap"
@nathanmlim
nathanmlim / submit_slurm.py
Created March 1, 2018 03:15
Submit SLURM jobs through python iteratively
import subprocess, os, glob
cwd = os.getcwd()
nc_files = glob.glob('nc_traj/*.nc')
for nc in nc_files:
l = nc.split('/')
fn = l[1].strip('pEH_l').split('-')
molid = fn[0]
suffix = fn[1].strip('.nc')
@nathanmlim
nathanmlim / add_permission.sh
Created February 2, 2018 22:28
Sets permissions for specific users, without changing the ownership of the directory.
setfacl -m u:username:rwx myfolder
@nathanmlim
nathanmlim / rename_logfiles.sh
Last active February 5, 2018 03:50
Move Logfiles and rename by jobid
#!/bin/bash
for fn in *.local/*.log; do
file=$( basename $fn )
pjobid=${fn%.tscc-mgr.local/*}
molid=${file%*-blues00*}
outfname="$molid-$pjobid-blues00.log"
cp $fn centered/$outfname
done
@nathanmlim
nathanmlim / nest-files.sh
Last active February 2, 2018 22:39
Create directories by file prefix
#!/bin/sh
for fn in *-centered.dcd; do
molid=${fn%*-107*-blues00*}
echo $molid
mkdir "$molid" && cp $fn $molid
done
@nathanmlim
nathanmlim / process_mdtraj.py
Created December 6, 2017 18:08
Pre-process MD Trajectories
import mdtraj as md
def centerTrajectory(traj,outfname):
nosolv = traj.remove_solvent()
anchor = nosolv.top.guess_anchor_molecules()[0]
imgd = nosolv.image_molecules(anchor_molecules=[anchor])
prt_idx = imgd.top.select('protein')
superposed = imgd.superpose(reference=imgd,frame=0,atom_indices=prt_idx)
superposed.save_dcd(outfname+'-centered.dcd')
superposed[0].save_pdb(outfname+'-centered.pdb')
@nathanmlim
nathanmlim / submit_jobs.pbs
Created November 22, 2017 18:53
Batch submit PBS jobs
for i in *-prod01-truncated.oeb.gz; do
suffix=${i%-prod01-truncated.oeb.gz}
qsub -N ${suffix} gpu_floe-blues.pbs
done
@nathanmlim
nathanmlim / filecount_dircleanup.sh
Created November 22, 2017 18:52
Delete directories by file count
find . -maxdepth 1 -type d -exec bash -c "echo -ne '{}\t'; ls '{}' | wc -l" \; | awk -F"\t" '$NF<=2{print $1}' >> cleanup.txt
while read p; do echo $p; rm -rf $p ; done <cleanup.txt
@nathanmlim
nathanmlim / submit_all_jobs.sh
Created October 4, 2017 22:21
Batch submit jobs SLURM
#!/bin/bash
input="prep"
for fname in *-${input}.oeb.gz; do
molid="${fname%%-${input}.oeb.gz}"
echo Submitting molecule $molid
sbatch -J "$molid" gpu_floe.slurm
sleep 2
done
@nathanmlim
nathanmlim / .vmdrc
Last active May 6, 2019 12:36
VMD Configuration file
############################################################################
# DESCRIPTION:
#
# VMD startup script. The commands here are executed as soon as VMD starts up
############################################################################
# turn on lights 0 and 1
light 0 on
light 1 on
light 2 off