Pteros  2.0
Molecular modeling library for human beings!
gromacs_trajectory_file.h
1 /*
2  *
3  * This source code is part of
4  * ******************
5  * *** Pteros ***
6  * ******************
7  * molecular modeling library
8  *
9  * Copyright (c) 2009-2013, Semen Yesylevskyy
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of Artistic License:
13  *
14  * Please note, that Artistic License is slightly more restrictive
15  * then GPL license in terms of distributing the modified versions
16  * of this software (they should be approved first).
17  * Read http://www.opensource.org/licenses/artistic-license-2.0.php
18  * for details. Such license fits scientific software better then
19  * GPL because it prevents the distribution of bugged derivatives.
20  *
21 */
22 
23 #ifndef GROMACS_TRAJECTORY_FILE_H
24 #define GROMACS_TRAJECTORY_FILE_H
25 
26 #include "xdrfile.h"
27 #include "xdrfile_xtc.h"
28 #include "xdrfile_trr.h"
29 
30 #include "pteros/core/mol_file.h"
31 
32 namespace pteros {
33 
37  public:
38 
39  Gromacs_trajectory_file(std::string& fname);
40 
41  virtual void open(char openmode);
42 
43  virtual ~Gromacs_trajectory_file();
44 
45  virtual Mol_file_content get_content_type() const {
46  return MFC_TRAJ;
47  }
48 
49  protected:
50 
51  XDRFILE* xd;
52  int step, ret;
53  float prec;
54  matrix box;
55  rvec* x;
56  char mode;
57  int fr;
58 
59  virtual int read_num_atoms(char* fname, int* num) = 0;
60  virtual int read_record(XDRFILE *xd, int natoms, int *step,
61  float *time, matrix box,rvec *x) = 0;
62  virtual int write_record(XDRFILE *xd,
63  int natoms,int step,float time,
64  matrix box,rvec *x) = 0;
65 
67  virtual bool do_read(System *sys, Frame *frame, const Mol_file_content& what);
69  virtual void do_write(const Selection &sel, const Mol_file_content& what);
70 };
71 
72 }
73 #endif // GROMACS_TRAJECTORY_H
Definition of single trajectory frame.
Definition: system.h:67
Pteros namespace.
Definition: options.cpp:32
virtual void open(char openmode)
Opens a file with given access mode. Need to be defined by derived classes.
Definition: gromacs_trajectory_file.cpp:37
The system of atoms.
Definition: system.h:95
Base class for XTC and TRR readers.
Definition: gromacs_trajectory_file.h:36
Selection class.
Definition: atom_proxy.h:57
virtual Mol_file_content get_content_type() const
Reports content of this file type.
Definition: gromacs_trajectory_file.h:45
Generic API for reading and writing any molecule file formats.
Definition: mol_file.h:43