Skip to content

Instantly share code, notes, and snippets.

View hainm's full-sized avatar

Hai Nguyen hainm

View GitHub Profile
In [1]: traj = pt.load('rna.pdb')
In [2]: ref = pt.iterload("./rna_nab.pdb")
In [3]: nu = pt.nastruct(traj, ref=ref, groove_3dna=True)
In [4]: nu.minor
Out[4]:
(['3G14C-4C13G', '4C13G-5G12C', '5G12C-6C11G'],
array([[ 15.80853176, 15.817976 , 15.48555374]]))
# Q: [AMBER] Working with pytraj
# use all atoms in residue 1
c_o_G = pt.center_of_geometry(traj, mask=':1')
# or
# use given atoms in residue 1
c_o_G = pt.center_of_geometry(traj, mask=':1@C1,N6,C2,C4,N7')
pt.vector.corrplane(traj, mask=':1@C1,N6,C2,C4,N7')
import pytraj as pt
import numpy as np
traj = pt.iterload('tz2.nc', 'tz2.parm7')
# note: use pt.load method if your trajectory is fit well to memory
c0 = pt.center_of_mass(traj, ':1-3')
c1 = pt.center_of_mass(traj, ':4-7')
c2 = pt.center_of_mass(traj, ':8-10')
c3 = pt.center_of_mass(traj, ':11-13')
$ pip install https://github.com/ParmEd/ParmEd/archive/2.0.5.tar.gz
Collecting https://github.com/ParmEd/ParmEd/archive/2.0.5.tar.gz
Downloading https://github.com/ParmEd/ParmEd/archive/2.0.5.tar.gz
| 32.0MB 12.1MB/s
Installing collected packages: ParmEd
Found existing installation: ParmEd 2.3.2
Uninstalling ParmEd-2.3.2:
Successfully uninstalled ParmEd-2.3.2
Running setup.py install for ParmEd ... done
Successfully installed ParmEd-2.3.2
CPPTRAJ: Trajectory Analysis. V16.00b
___ ___ ___ ___
| \/ | \/ | \/ |
_|_/\_|_/\_|_/\_|_
| Date/time: 08/05/15 16:30:04
| Available memory: 132.562 MB
INPUT: Reading Input from file dih.in
[parm G5.pdb]
@hainm
hainm / most-active-users-on-github-2015.md
Last active August 29, 2015 14:26 — forked from eddiejaoude/most-active-users-on-github-2015.md
Most active users on GitHub 2015

This is the top 1000 users on GitHub

Where are you on here?

For the first 6 months of 2015 (Jan - June).

Query used on Google's BigQuery with GitHubArchive Data

SELECT actor.login as user, COUNT(*) as total FROM (
@hainm
hainm / gist:3dc21e9585a8c1103650
Created June 9, 2015 19:43
cython + python2 error
Traceback (most recent call last):
File "/home/hainm/anaconda3/envs/python2/bin/cython", line 9, in <module>
load_entry_point('Cython==0.23.dev0', 'console_scripts', 'cython')()
File "/home/hainm/anaconda3/envs/python2/lib/python2.7/site-packages/Cython-0.23.dev0-py2.7-linux-x86_64.egg/Cython/Compiler/Main.py", line 676, in setuptools_main
return main(command_line = 1)
File "/home/hainm/anaconda3/envs/python2/lib/python2.7/site-packages/Cython-0.23.dev0-py2.7-linux-x86_64.egg/Cython/Compiler/Main.py", line 693, in main
result = compile(sources, options)
File "/home/hainm/anaconda3/envs/python2/lib/python2.7/site-packages/Cython-0.23.dev0-py2.7-linux-x86_64.egg/Cython/Compiler/Main.py", line 668, in compile
return compile_multiple(source, options)
File "/home/hainm/anaconda3/envs/python2/lib/python2.7/site-packages/Cython-0.23.dev0-py2.7-linux-x86_64.egg/Cython/Compiler/Main.py", line 646, in compile_multiple
@hainm
hainm / test_rmsd.py
Last active August 29, 2015 14:20
check_rmsd_from_dataset
# test get reference Frame from DataSetList
traj = mdio.load("./data/md1_prod.Tc5b.x", "./data/Tc5b.top")
dslist = DataSetList()
dslist.add_set("ref_frame", "myname")
dslist[0].top = traj.top.copy()
# use last Frame for reference
dslist[0].append(traj[-1])
# dslist.get_reference_frame("myname")
@hainm
hainm / test_cython_setter.pyx
Created April 8, 2015 22:26
cython settter
cdef class MyTest (object):
cdef public object _x
def __cinit__(self):
self._x = 0
@property
def x(self):
return self._x
@x.setter
@hainm
hainm / test.pyx
Last active March 27, 2017 08:35
test.pyx
# distutils: language = c++
cdef cppclass A:
void c_test():
print ("hello from A")
cdef cppclass B(A):
void SetObject(A* ptr):
print ("dummy method, hello from B")
cdef class pyA: