示例#1
0
文件: index.py 项目: xianshine/GromPy
def rd_index(statfile, ngroups, isizep=None, indexp=None, grpnamesp=None):
    filename = c_char_p(statfile)
    if not isizep:
        isize = (c_int * ngroups)()
        isizep = pointer(isize)
    if not indexp:
        index = (POINTER(c_int) * ngroups)()
        indexp = pointer(index)
    if not grpnamesp:
        grpnames = (c_char_p * ngroups)()
        grpnamesp = pointer(grpnames)

    libgmx.rd_index(filename, ngroups, isizep, indexp, grpnamesp)

    return isize, index, grpnames
示例#2
0
文件: index.py 项目: rolandschulz/2pt
def rd_index(statfile, ngroups, isizep=None, indexp=None, grpnamesp=None):
    filename = c_char_p(statfile)
    if not isizep:
        isize = (c_int * ngroups)()
        isizep = pointer(isize)
    if not indexp:
        index = (POINTER(c_int) * ngroups)()
        indexp = pointer(index)
    if not grpnamesp:
        grpnames = (c_char_p * ngroups)()
        grpnamesp = pointer(grpnames)

    libgmx.rd_index(filename, ngroups, isizep, indexp, grpnamesp)
    if auto_mode & mNumPy:
        nindex = [0] * ngroups
        for i in range(ngroups):
            tmp = (c_int * isize[i]).from_address(addressof(index[i].contents))
            nindex[i] = N.frombuffer(tmp, dtype=N.int32)  # count=3*self.f.natoms
        index = nindex
    return isize, index, grpnames
示例#3
0
文件: index.py 项目: rolandschulz/2pt
def rd_index(statfile, ngroups, isizep=None, indexp=None, grpnamesp=None):
    filename = c_char_p(statfile)
    if not isizep:
        isize = (c_int * ngroups)()
        isizep = pointer(isize)
    if not indexp:
        index = (POINTER(c_int) * ngroups)()
        indexp = pointer(index)
    if not grpnamesp:
        grpnames = (c_char_p * ngroups)()
        grpnamesp = pointer(grpnames)

    libgmx.rd_index(filename, ngroups, isizep, indexp, grpnamesp)
    if auto_mode & mNumPy:
        nindex = [0] * ngroups
        for i in range(ngroups):
            tmp = (c_int * isize[i]).from_address(addressof(index[i].contents))
            nindex[i] = N.frombuffer(tmp,
                                     dtype=N.int32)  #count=3*self.f.natoms
        index = nindex
    return isize, index, grpnames