Switched to Headers fo the Gromacs-2016 branch.
This commit is contained in:
@ -17,6 +17,14 @@ Pygmx needs mainly two python packages to be installed, which are available in a
|
|||||||
|
|
||||||
Pygmx requires the shared library and header files of Gromacs 5.1 or higher to be installed.
|
Pygmx requires the shared library and header files of Gromacs 5.1 or higher to be installed.
|
||||||
|
|
||||||
|
Note that pygmx also supports the Gromacs-2016 version.
|
||||||
|
Checkout the followng git branch if this version of Gromacs is desired:
|
||||||
|
|
||||||
|
git checkout gromacs-2016
|
||||||
|
|
||||||
|
Note that Gromacs is backwards compatible, i. e. files produced by the 5.1 version will also work in the 2016 version.
|
||||||
|
But Gromacs-2016 is required to load files of the 2016 version.
|
||||||
|
|
||||||
#### Using a module
|
#### Using a module
|
||||||
|
|
||||||
If gromacs is installed as a module in your system, run
|
If gromacs is installed as a module in your system, run
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
from utility cimport *
|
from utility cimport *
|
||||||
from math cimport *
|
from math cimport *
|
||||||
|
|
||||||
cdef extern from "gromacs/legacyheaders/types/energy.h":
|
cdef extern from "gromacs/trajectory/energy.h":
|
||||||
ctypedef struct t_energy:
|
ctypedef struct t_energy:
|
||||||
real e
|
real e
|
||||||
double eav
|
double eav
|
||||||
double esum
|
double esum
|
||||||
|
|
||||||
|
|
||||||
cdef extern from "gromacs/legacyheaders/types/inputrec.h":
|
|
||||||
|
cdef extern from "gromacs/mdtypes/inputrec.h":
|
||||||
ctypedef struct t_simtemp:
|
ctypedef struct t_simtemp:
|
||||||
pass
|
pass
|
||||||
ctypedef struct t_lambda:
|
ctypedef struct t_lambda:
|
||||||
|
@ -43,6 +43,10 @@ cdef extern from "gromacs/topology/atoms.h":
|
|||||||
ctypedef struct t_atomtypes:
|
ctypedef struct t_atomtypes:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
ctypedef struct t_grps:
|
||||||
|
int nr; # Number of different groups */
|
||||||
|
int *nm_ind; # Index in the group names */
|
||||||
|
|
||||||
#ctypedef t_atoms *t_atoms_ptr
|
#ctypedef t_atoms *t_atoms_ptr
|
||||||
|
|
||||||
cdef extern from "gromacs/topology/symtab.h":
|
cdef extern from "gromacs/topology/symtab.h":
|
||||||
@ -81,6 +85,11 @@ cdef extern from "gromacs/topology/topology.h":
|
|||||||
|
|
||||||
ctypedef struct gmx_groups_t:
|
ctypedef struct gmx_groups_t:
|
||||||
pass
|
pass
|
||||||
|
# t_grps grps[0] # Groups of things */
|
||||||
|
# int ngrpname # Number of groupnames */
|
||||||
|
# char ***grpname # Names of the groups */
|
||||||
|
# int ngrpnr[0]
|
||||||
|
# unsigned char *grpnr[0] # Group numbers or NULL */
|
||||||
|
|
||||||
ctypedef struct gmx_mtop_t:
|
ctypedef struct gmx_mtop_t:
|
||||||
char **name # Name of the topology */
|
char **name # Name of the topology */
|
||||||
|
@ -34,7 +34,7 @@ cdef extern from "gromacs/fileio/tpxio.h":
|
|||||||
int *natoms,
|
int *natoms,
|
||||||
rvec *x,
|
rvec *x,
|
||||||
rvec *v,
|
rvec *v,
|
||||||
rvec *f,
|
# rvec *f,
|
||||||
gmx_mtop_t *mtop)
|
gmx_mtop_t *mtop)
|
||||||
|
|
||||||
|
|
||||||
@ -83,12 +83,17 @@ cdef atom_mass(t_atom atom):
|
|||||||
return atom.m
|
return atom.m
|
||||||
|
|
||||||
|
|
||||||
|
cdef index_groups_from_topology(gmx_mtop_t *topology):
|
||||||
|
# retrieve the index groups from the topology->groups ?
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
cdef open_tpx(const char* filename, t_inputrec *ir, matrix box, int *natoms, gmx_mtop_t *top):
|
cdef open_tpx(const char* filename, t_inputrec *ir, matrix box, int *natoms, gmx_mtop_t *top):
|
||||||
#cdef stdio.FILE *old_stderr = stdio.stderr
|
#cdef stdio.FILE *old_stderr = stdio.stderr
|
||||||
#stdio.stderr = stdio.freopen('tmp', 'w', stdio.stderr)
|
#stdio.stderr = stdio.freopen('tmp', 'w', stdio.stderr)
|
||||||
cdef char buffer[stdio.BUFSIZ]
|
cdef char buffer[stdio.BUFSIZ]
|
||||||
stdio.setbuf(stdio.stderr, buffer)
|
stdio.setbuf(stdio.stderr, buffer)
|
||||||
return_code = read_tpx(filename, ir, box, natoms, NULL, NULL, NULL, top)
|
return_code = read_tpx(filename, ir, box, natoms, NULL, NULL, top)
|
||||||
|
|
||||||
for i in range(stdio.BUFSIZ):
|
for i in range(stdio.BUFSIZ):
|
||||||
buffer[i] = 0
|
buffer[i] = 0
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
# C-API in gromacs/utility
|
# C-API in gromacs/utility
|
||||||
|
|
||||||
|
from libc.stdint cimport int64_t
|
||||||
|
|
||||||
#cdef extern from "inttypes.h":
|
#cdef extern from "inttypes.h":
|
||||||
ctypedef unsigned long __int64
|
ctypedef unsigned long __int64
|
||||||
|
ctypedef int64_t gmx_int64_t
|
||||||
|
|
||||||
cdef extern from "gromacs/utility/basedefinitions.h":
|
cdef extern from "gromacs/utility/basedefinitions.h":
|
||||||
ctypedef int gmx_bool
|
ctypedef int gmx_bool
|
||||||
|
@ -21,11 +21,11 @@ cdef extern from "gromacs/fileio/xtcio.h":
|
|||||||
void close_xtc(t_fileio *fio)
|
void close_xtc(t_fileio *fio)
|
||||||
|
|
||||||
int read_first_xtc(t_fileio *fio,
|
int read_first_xtc(t_fileio *fio,
|
||||||
int *natoms, int *step, real *time,
|
int *natoms, gmx_int64_t *step, real *time,
|
||||||
matrix box, rvec **x, real *prec, gmx_bool *_bOK)
|
matrix box, rvec **x, real *prec, gmx_bool *_bOK)
|
||||||
|
|
||||||
int read_next_xtc(t_fileio *fio,
|
int read_next_xtc(t_fileio *fio,
|
||||||
int natoms, int *step, real *time,
|
int natoms, gmx_int64_t *step, real *time,
|
||||||
matrix box, rvec *x, real *prec, gmx_bool *_bOK)
|
matrix box, rvec *x, real *prec, gmx_bool *_bOK)
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,8 @@ else:
|
|||||||
cdef array get_xtc_index(t_fileio *fio):
|
cdef array get_xtc_index(t_fileio *fio):
|
||||||
cdef:
|
cdef:
|
||||||
gmx_bool _bOK
|
gmx_bool _bOK
|
||||||
int natoms, step, frame, state = 1
|
int natoms, frame, state = 1
|
||||||
|
gmx_int64_t step
|
||||||
real time, prec
|
real time, prec
|
||||||
matrix box
|
matrix box
|
||||||
rvec *x
|
rvec *x
|
||||||
@ -156,7 +157,7 @@ cdef class XTCReader:
|
|||||||
self.filename = filename.decode()
|
self.filename = filename.decode()
|
||||||
|
|
||||||
cdef:
|
cdef:
|
||||||
int step
|
gmx_int64_t step
|
||||||
matrix box
|
matrix box
|
||||||
gmx_bool _bOK
|
gmx_bool _bOK
|
||||||
real time, prec
|
real time, prec
|
||||||
@ -193,7 +194,7 @@ cdef class XTCReader:
|
|||||||
cdef np.ndarray[real, ndim=2] coords = np.empty((self.natoms, 3), dtype=np_real)
|
cdef np.ndarray[real, ndim=2] coords = np.empty((self.natoms, 3), dtype=np_real)
|
||||||
if frame < len(self):
|
if frame < len(self):
|
||||||
self.seek(frame)
|
self.seek(frame)
|
||||||
read_next_xtc(self.fio, self.natoms, &self.cur_step, &time, box,
|
read_next_xtc(self.fio, self.natoms, <gmx_int64_t *>self.cur_step, &time, box,
|
||||||
<rvec *>coords.data, &self.prec, &_bOK)
|
<rvec *>coords.data, &self.prec, &_bOK)
|
||||||
if _bOK:
|
if _bOK:
|
||||||
frame = XTCFrame()
|
frame = XTCFrame()
|
||||||
|
Reference in New Issue
Block a user