Example #1
0
import numpy
import mp3

s = mp3.system()
s.cord = mp3.dcd()
s.cord.setinput("water1000.dcd")
s.labels.getfrompsf("water1000.psf")

s.cord.nextframe()

# return a list of protein atoms:
 # make a list containing atom numbers and properties

atoms = [ i for i in xrange(0,s.cord.natoms) if s.labels.data.field('atomtype')[i] == "OSPC" ]

goodatoms = s.cord.frame[atoms]
#print goodatoms

minatoms = goodatoms.argmin(axis=0)
maxatoms = goodatoms.argmax(axis=0)

boxmin = numpy.asarray( [ goodatoms[minatoms[i],i] for i in (0,1,2) ] )
boxmax = numpy.asarray( [ goodatoms[maxatoms[i],i] for i in (0,1,2) ] )

numpy.add(boxmin, -10, boxmin )
numpy.add(boxmax,  10, boxmax )

print boxmin, boxmax
Example #2
0
File: msd2.py Project: rkdarst/mp3
def main():

    # Put what you want here.
    dcd_to_msd = "/home/richard/research/mp3/tests/water1000.dcd"
    psf_name = "/home/richard/research/mp3/tests/water1000.psf"
    
    # Set up the systems, so that you can find the atoms you want below.

    cord = mp3.dcd()
    cord.setinput(dcd_to_msd)
    s = mp3.system(cord=cord, psf=psf_name)

    # Find which atoms you want right here.
    # First, we find all atoms in the protein, and all in the residues we
    # want.
    
    residue_low = 10
    residue_high = 20
    residues = [i for i in xrange(s.labels.natoms) if
                (s.labels.data.field("resnum") >= residue_low and
                 s.labels.data.field("resnum") <= residue_high)    ]
    protein = s.labels.findatoms(name="SPCE", field="resname")
    
    # Find alpha carbons, add them all to a set.  This is what we align by
    
    alpha_carbons = s.labels.findatoms(name="CA", field="atomtype")
    atomset = sets.Set()
    atomset |= protein  # union update
    atomset &= alpha_carbons  # intersection update
    atomset &= residues
    atoms_to_align_by = list(atomset)

    # Find all atoms in the residues.  Then find all hydrogens, and remove 
    # the hydrogens from the set
    
    # residues has been defined above
    hydrogens = s.labels.findatoms(name="H", field="atomtype")
    atomset = sets.Set()
    atomset |= protein
    atomset &= residues
    atomset -= hydrogens
    atoms_to_msd = list(atomset)
    
    # Set up our aligned cord, now

    #atomlist = range(cord.natoms)
    #atoms_to_align_by = atomlist
    #atoms_to_msd = atomlist
    
    aligned_cord = mp3.aligncord()
    aligned_cord.setcord(s.cord)
    aligned_cord.setatoms( atoms_to_align_by )
    aligned_cord.init()
    s.cord = aligned_cord

    msd = Msder(cord=s.cord, window=5, atomlist=atoms_to_msd )
    

    print "beginning correlation"
    msd.do_n_msd(5)
    

    print msd.msd()
Example #3
0
import mp3, sys, numpy


# Here is some argument parsing, but "optparse" (standard library in 2.3)
# is FAR better.
#
if len(sys.argv) < 3:    # do we have enough arguments?
        print "%s dcdname pdbname" % sys.argv[0]  # usage syntax
dcdname = sys.argv[1]   # get the file names
psfname = sys.argv[2]


# I always have trouble thinking of what the names will be.
# "mols" means "the molecules" we want to analyze
mols = mp3.system()               # set up the system here
mols.labels.getfrompsf(psfname)   # This opens the file, reads it in, closes it

mols.cord = mp3.dcd()             # mols.dcd isn't automatically there
                                  #  because there can be different types of "containers"
                                  #  for it
mols.cord.setfile(dcdname)        # Tells it where we are going to be reading from.
                                  #  You -no longer- need to call mols.cord.init()



group_of_interest = "OSPC"

print "Seaching for %s groups"%group_of_interest
print '---'