Ejemplo n.º 1
0
 def __init__(self, filename, flags=TRX_READ_X):
     self.status = c_int()
     self.f = gmxframe()
     self.ret = libgmx.read_first_frame(byref(self.status), filename, byref(self.f.fr), flags)
     if not self.ret:
         raise IOError("Failed to open %s. File not found or not a valid GROMACS trajectory." % (filename,))
     self.natoms = self.f.natoms
     if auto_mode == mNumPy:
         if self.f.bX:
             self.f.x = maprvec(self.f.fr.x, self.natoms)
         if self.f.bV:
             self.f.v = maprvec(self.f.fr.v, self.natoms)
         if self.f.bF:
             self.f.f = maprvec(self.f.fr.f, self.natoms)
Ejemplo n.º 2
0
 def __init__(self, filename, flags=TRX_READ_X):
     self.status = c_int()
     self.f = gmxframe()
     self.ret = libgmx.read_first_frame(byref(self.status), filename,
                                        byref(self.f.fr), flags)
     if not self.ret:
         raise IOError(
             "Failed to open %s. File not found or not a valid GROMACS trajectory."
             % (filename, ))
     self.natoms = self.f.natoms
     if auto_mode == mNumPy:
         if self.f.bX: self.f.x = maprvec(self.f.fr.x, self.natoms)
         if self.f.bV: self.f.v = maprvec(self.f.fr.v, self.natoms)
         if self.f.bF: self.f.f = maprvec(self.f.fr.f, self.natoms)
Ejemplo n.º 3
0
 def __init__(self,filename):
     toptitle=(c_char*256)()
     top=t_topology()
     xp=POINTER(rvec)()
     vp=POINTER(rvec)()
     cePBC=c_int(-1)
     box=matrix()
     bMass=c_int()
     ret = libgmx.read_tps_conf(filename,byref(toptitle),byref(top),byref(cePBC),byref(xp),byref(vp),box,byref(bMass))
     if ret!=1:
         raise GMXctypesError("Error reading topology with read_tps_conf")
     self.title,self.top,self.ePBC,self.x,self.v,self.box,self.bMass=toptitle.value,top,cePBC.value,xp,vp,box,bMass.value
     self.natoms = self.top.atoms.nr
     if auto_mode==mNumPy:
       self.x = maprvec(self.x,self.natoms)
       self.v = maprvec(self.v,self.natoms)
       self.A = mapatom(self.top.atoms.atom,self.natoms)