Skip to content

Instantly share code, notes, and snippets.

View leelasd's full-sized avatar
🏠
Working from home

Leela S. Dodda leelasd

🏠
Working from home
View GitHub Profile
@leelasd
leelasd / mpi4py.sh
Created December 23, 2015 06:33
Running MPI4PY programme in GRACE
## mpirun -np 2 python helloworld.py
"""
Parallel Hello World
"""
from mpi4py import MPI
import sys
size = MPI.COMM_WORLD.Get_size()
@leelasd
leelasd / contacts.py
Created January 2, 2016 02:00 — forked from bougui505/contacts.py
compute h-bonds with chimera. Launch it with chimera --nogui --script 'contacts.py structure.pdb'
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# for chimera 1.4
from chimera import runCommand
import sys
rec_file = sys.argv[1]
basename = rec_file.split('/')[-1].split('.')[0]
#runCommand("open 0 receptor.pdb")
runCommand("open 0 %s"%rec_file)
runCommand("hbonds intramodel true distSlop 0.65 angleSlop 80 saveFile output/%s_hbonds.txt namingStyle serial"%basename)
@leelasd
leelasd / chimera_cli.py
Created January 2, 2016 02:07 — forked from jaimergp/chimera_cli.py
Use UCSF Chimera IDLE directly in terminal, no GUI
"""
Experimental wrapper to use Chimera's Python directly from console.
You can `import chimera` with no errors!
Usage
=====
1. Alias your /path/to/chimera/bin/python binary to something more user-friendly, like `chimerapy`.
2. Download these two files and put them together
3. Run `chimerapy -i chimera_cli.py`. (Tip: Realias `chimerapy` to this command).
open prometryn.pdb
preset apply pub 3
aromatic disk;
focus
center
color byatom
repr bs
copy file prometryn.png dpi 300
stop
@leelasd
leelasd / Fig_from_smiles.py
Last active January 5, 2016 21:07
Generating Chemdraw 2d Figures from MOL file or Smiles file. Download SAMPL1_Dataset from https://github.com/leelasd/SAMPL1/blob/master/SAMPL1_Dataset.csv.
## installing dependencies
## conda install boost
## conda install rdkit
## Download SAMPL1 database file from leelasd/SAMPL1 github repo
from __future__ import print_function
from rdkit import Chem
from rdkit.Chem import AllChem,Draw
import pandas as pd
df=pd.read_csv('SAMPL1_Dataset.csv')
mols = [Chem.MolFromSmiles(smi) for smi in df.SMILES]
@leelasd
leelasd / anilin.pdb
Created February 7, 2016 19:57
PDB file for the MD simulations in OpenMM using OPLS-AA forcefield.
REMARK Aniline
REMARK Created by BOSS 4.9 Feb 12 Linux
ATOM 1 C00 UNK 1 0.000 1.400 0.000
ATOM 2 C01 UNK 1 0.000 0.695 -1.220
ATOM 3 C02 UNK 1 -0.000 0.694 1.219
ATOM 4 C03 UNK 1 0.006 -0.713 -1.220
ATOM 5 C04 UNK 1 0.006 -0.715 1.218
ATOM 6 C05 UNK 1 0.010 -1.420 -0.002
ATOM 7 N06 UNK 1 -0.001 2.739 0.001
ATOM 8 H07 UNK 1 -0.008 1.225 -2.162
@leelasd
leelasd / anilin.xml
Created February 7, 2016 19:58
Aniline OPLS-AA forcefield file for simulating Aniline in Water
<ForceField>
<AtomTypes>
<Type name="opls_145" class="CA" element="C" mass="12.011000" />
<Type name="opls_146" class="HA" element="H" mass="1.008000" />
<Type name="opls_900" class="NT" element="N" mass="14.007000" />
<Type name="opls_916" class="CA" element="C" mass="12.011000" />
<Type name="opls_909" class="H" element="H" mass="1.008000" />
</AtomTypes>
<HarmonicBondForce>
<Bond class1="CA" class2="CA" length="0.140" k="392459.20"/>
@leelasd
leelasd / tip3p.xml
Created February 7, 2016 20:04
OPLS-AA Water TIP3P Forcefield file
<ForceField>
<AtomTypes>
<Type name="tip3p-O" class="OW" element="O" mass="15.99943"/>
<Type name="tip3p-H" class="HW" element="H" mass="1.007947"/>
</AtomTypes>
<Residues>
<Residue name="HOH">
<Atom name="O" type="tip3p-O"/>
<Atom name="H1" type="tip3p-H"/>
<Atom name="H2" type="tip3p-H"/>
@leelasd
leelasd / dcdreporter.py
Created February 9, 2016 04:56
Hacked DCDReporter for OpenMM allowing unwrapped coordinates
"""
dcdreporter.py: Outputs simulation trajectories in DCD format
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.
Portions copyright (c) 2012 Stanford University and the Authors.
Authors: Peter Eastman
@leelasd
leelasd / edecomp.py
Created February 25, 2016 16:06
Energy decomposition analysis in OpenMM -- Thanks to RMCGibbo
import numpy as np
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
def getForceByClass(system, klass):
for i in range(system.getNumForces()):
f = system.getForce(i)
if isinstance(f, klass):