예제 #1
0
    def write_dcd(self,filename):
        '''
        This method writes data in the Charmm/Xplor data format.
        by calling a pre-compiled C module (dcdio).
        '''
		
        outfile=dcdio.open_dcd_write(filename)

        nset = self._coor[:,0,0].shape[0]
        natoms = self._coor[0,:,0].shape[0]
        istart = 0 ; nsavc = 1 ; delta = 1.0
		
        headerresult=dcdio.write_dcdheader(outfile,filename,natoms,nset,istart,nsavc,delta)

        for frame in xrange(nset):
            print ".",
            sys.stdout.flush()

            tx=self._coor[frame,:,0].astype(numpy.float32)	
            ty=self._coor[frame,:,1].astype(numpy.float32)	
            tz=self._coor[frame,:,2].astype(numpy.float32)	

            stepresult=dcdio.write_dcdstep(outfile,tx,ty,tz,frame+1)

        result = dcdio.close_dcd_write(outfile)

        return
예제 #2
0
    def write_dcd_frames(self, filename, start, end):
        '''
        This method writes a single step or multiple frames
        in the Charmm/Xplor data format.
        by calling a pre-compiled C module (dcdio).
        '''

        outfile = dcdio.open_dcd_write(filename)
        nset = end - start
        natoms = self._coor[0, :, 0].shape[0]
        istart = 0
        nsavc = 1
        delta = 1.0

        headerresult = dcdio.write_dcdheader(outfile, filename, natoms, nset,
                                             istart, nsavc, delta)

        i = 0
        for frame in xrange(start, end):
            print ".",
            sys.stdout.flush()

            tx = self._coor[frame, :, 0].astype(numpy.float32)
            ty = self._coor[frame, :, 1].astype(numpy.float32)
            tz = self._coor[frame, :, 2].astype(numpy.float32)

            stepresult = dcdio.write_dcdstep(outfile, tx, ty, tz, i + 1)
            i += 1

        result = dcdio.close_dcd_write(outfile)

        return
예제 #3
0
    def close_dcd_write(self,filepointer):
        '''
        This method closes a dcd file.
        '''
        result = dcdio.close_dcd_write(filepointer)
        print 'result = ',result
	
        return
예제 #4
0
파일: test_dcdio.py 프로젝트: dww100/sasmol
for blah in range(nset):
    print ".",
    sys.stdout.flush()

    x = x + 5.0
    y = y + 5.0
    z = z + 5.0
    stepresult = dcdio.write_dcdstep(fp, x, y, z, blah)

end_time = time.time()

dt = end_time - start_time

print '\ntotal time = ', dt, ' time per structure = ', dt / nset

dcdio.close_dcd_write(fp)

filename = '200c.dcd'
filename = 'c7.dcd'

ifp = dcdio.open_dcd_read(filename)

nnatoms = 0
nset = 0
istart = 0
nsavc = 0
delta = 0.0
namnf = 0
freeindexes = []
reverseEndian = 0
charmm = 0
예제 #5
0
파일: test_dcdio.py 프로젝트: ianhi/sasmol
for blah in range(nset):
     print ".",
     sys.stdout.flush()

     x=x+5.0
     y=y+5.0
     z=z+5.0
     stepresult=dcdio.write_dcdstep(fp,x,y,z,blah)

end_time=time.time()

dt=end_time-start_time

print '\ntotal time = ',dt,' time per structure = ',dt/nset

dcdio.close_dcd_write(fp)


filename='200c.dcd'
filename='c7.dcd'

ifp=dcdio.open_dcd_read(filename)

nnatoms=0 ; nset=0 ; istart=0 ; nsavc=0 ; delta=0.0
namnf=0 ; freeindexes=[] ; reverseEndian=0 ; charmm=0

print 'nnatoms = ',nnatoms
print 'nset = ',nset
print 'freeindexes = ',freeindexes

readheaderresult,nnatoms,nset,istart,nsavc,delta,namnf,reverseEndian,charmm=dcdio.read_dcdheader(ifp)