Include Gromacs internal function for making Frames Whole

This commit is contained in:
Niels Müller
2019-10-24 12:45:13 +02:00
parent fa7e3347d9
commit b8b61380c8
2 changed files with 17 additions and 0 deletions

View File

@ -146,3 +146,11 @@ cdef extern from "gromacs/topology/topology.h":
# cdef extern from "gromacs/topology/topology.h": # cdef extern from "gromacs/topology/topology.h":
# generate a t_atoms struct for the system from gmx_mtop_t # generate a t_atoms struct for the system from gmx_mtop_t
# t_atoms* mtop2atoms(gmx_mtop_t *mtop) # t_atoms* mtop2atoms(gmx_mtop_t *mtop)
cdef extern from "gromacs/topology/mtop_util.h":
t_atoms gmx_mtop_global_atoms(const gmx_mtop_t *mtop)
cdef extern from "gromacs/pbcutil/rmpbc.h":
void rm_gropbc(const t_atoms *atoms, rvec x[], const matrix box);

View File

@ -251,3 +251,12 @@ cdef class TPXReader:
&self.topology &self.topology
) )
self.topology_name = self.topology.name[0] self.topology_name = self.topology.name[0]
@cython.binding(True)
def make_xtcframe_whole(coords, box, <TPXReader>reader):
cdef t_atoms = gmx_mtop_global_atoms(reader.topology)
cdef np.ndarray[real, ndim=2] b = np.asarray(box, dtype=np.float32)
cdef np.ndarray[real, ndim=2] x = np.asarray(coords, dtype=np.float32)
rm_gropbc(const t_atoms *atoms, <rvec *>x.data, <matrix> b)
return x