Example #1
0
def read_stx_conf(infile,title,atoms,x,v):
    ifile=c_char_p(infile)
    ttl=c_char_p(title)
    m=matrix()
    pbc=c_int(-1)
    libgmx.read_stx_conf(ifile, ttl,byref(atoms),x,v,byref(pbc),m);
    return pbc,m
Example #2
0
def read_next_xtc(handle, natoms, xpointer):
	step = c_int()
	time = c_real()
	prec = c_real()
	bOK = c_int()
	box =  matrix()
	ret=libgmx.read_next_xtc(handle,natoms,byref(step),byref(time),box,xpointer,byref(prec),byref(bOK))
#	if ret!=1:
#		raise GMXctypesError,"read_next_xtc did not return 1"

	return step.value,time.value,box,prec.value,bOK.value,ret
Example #3
0
def calc_fit_R(weights,atomsvec1,atomsvec2,natoms=None,dimensions=3,mtx=None):
    if mNumPy:
        if natoms==None:
            if not len(weights)==len(atomsvec1)==len(atomsvec2):
                raise TypeError("Array dimension don't match")
            natoms=len(weights)
        if mtx==None: mtx = N.empty((3,3),N_real)
    else:
        if mtx==None: mtx = matrix()

    libgmx.calc_fit_R(dimensions,natoms,weights,atomsvec1,atomsvec2,mtx)
    return mtx
Example #4
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
Example #5
0
def read_next_xtc(handle, natoms, xpointer):
    step = c_int()
    time = c_real()
    prec = c_real()
    bOK = c_int()
    box = matrix()
    ret = libgmx.read_next_xtc(handle, natoms, byref(step), byref(time), box,
                               xpointer, byref(prec), byref(bOK))
    #	if ret!=1:
    #		raise GMXctypesError,"read_next_xtc did not return 1"

    return step.value, time.value, box, prec.value, bOK.value, ret
Example #6
0
def read_first_xtc(handle):
	natoms = c_int()
	step = c_int()
	time = c_real()
	prec = c_real()
	bOK = c_int()
	box =  matrix()
	xpointer = POINTER(rvec)()
	ret=libgmx.read_first_xtc(handle,byref(natoms),byref(step),byref(time),box,byref(xpointer),byref(prec),byref(bOK))
#	if ret!=1:
#		raise GMXctypesError,"read_first_xtc did not return 1"
	return natoms.value,step.value,time.value,box,xpointer,prec.value,bOK.value,ret
Example #7
0
def copy_mat(a = matrix):
    b     = matrix()
    b[XX] = copy_rvec(a[XX])
    b[YY] = copy_rvec(a[YY])
    b[ZZ] = copy_rvec(a[ZZ])

    return b
#static inline void copy_mat(matrix a,matrix b)
#{
#  copy_rvec(a[XX],b[XX]);
#  copy_rvec(a[YY],b[YY]);
#  copy_rvec(a[ZZ],b[ZZ]);
#}
Example #8
0
def read_first_xtc(handle):
    natoms = c_int()
    step = c_int()
    time = c_real()
    prec = c_real()
    bOK = c_int()
    box = matrix()
    xpointer = POINTER(rvec)()
    ret = libgmx.read_first_xtc(handle, byref(natoms), byref(step),
                                byref(time), box, byref(xpointer), byref(prec),
                                byref(bOK))
    #	if ret!=1:
    #		raise GMXctypesError,"read_first_xtc did not return 1"
    return natoms.value, step.value, time.value, box, xpointer, prec.value, bOK.value, ret
Example #9
0
def copy_mat(a=matrix):
    b = matrix()
    b[XX] = copy_rvec(a[XX])
    b[YY] = copy_rvec(a[YY])
    b[ZZ] = copy_rvec(a[ZZ])

    return b


#static inline void copy_mat(matrix a,matrix b)
#{
#  copy_rvec(a[XX],b[XX]);
#  copy_rvec(a[YY],b[YY]);
#  copy_rvec(a[ZZ],b[ZZ]);
#}
Example #10
0
def calc_fit_R(weights,
               atomsvec1,
               atomsvec2,
               natoms=None,
               dimensions=3,
               mtx=None):
    if mNumPy:
        if natoms == None:
            if not len(weights) == len(atomsvec1) == len(atomsvec2):
                raise TypeError("Array dimension don't match")
            natoms = len(weights)
        if mtx == None: mtx = N.empty((3, 3), N_real)
    else:
        if mtx == None: mtx = matrix()

    libgmx.calc_fit_R(dimensions, natoms, weights, atomsvec1, atomsvec2, mtx)
    return mtx
Example #11
0
def calc_fit_R(natoms,weights,atomsvec1,atomsvec2,dimensions=3):
    mtx = matrix()
    libgmx.calc_fit_R(dimensions,natoms,weights,atomsvec1,atomsvec2,mtx)
    return mtx
Example #12
0
def calc_fit_R(natoms, weights, atomsvec1, atomsvec2, dimensions=3):
    mtx = matrix()
    libgmx.calc_fit_R(dimensions, natoms, weights, atomsvec1, atomsvec2, mtx)
    return mtx