2b3504f29626544c3a156c723eff41bcb5326ba7
[alexxy/gromacs.git] / include / displacement.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11  * Copyright (c) 2001-2009, The GROMACS development team,
12  * check out http://www.gromacs.org for more information.
13
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * If you want to redistribute modifications, please consider that
20  * scientific software is very special. Version control is crucial -
21  * bugs must be traceable. We will be happy to consider code for
22  * inclusion in the official distribution, but derived work must not
23  * be called official GROMACS. Details are found in the README & COPYING
24  * files - if they are missing, get the official version at www.gromacs.org.
25  *
26  * To help us fund GROMACS development, we humbly ask that you cite
27  * the papers on the package - you can find them in the top README file.
28  *
29  * For more info, check our website at http://www.gromacs.org
30  */
31 /*! \file
32  * \brief API for on-line calculation of displacements.
33  *
34  * The API is documented in more detail on a separate page:
35  * \ref displacements
36  *
37  * The functions within this file can be used and developed independently of
38  * the other parts of the library.
39  * Other parts of the library do not reference these functions.
40  */
41 #ifndef DISPLACEMENT_H
42 #define DISPLACEMENT_H
43
44 #include "typedefs.h"
45
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50
51 /** Data structure for displacement calculation. */
52 typedef struct gmx_ana_displ_t gmx_ana_displ_t;
53
54 struct gmx_ana_pos_t;
55
56 /** Allocates memory for displacement calculation. */
57 int
58 gmx_ana_displ_create(gmx_ana_displ_t **d, int nmax, real tmax);
59 /** Initializes displacement calculation for a frame. */
60 int
61 gmx_ana_displ_start_frame(gmx_ana_displ_t *d, real t);
62 /** Returns the number of steps corresponding to a given time interval. */
63 int
64 gmx_ana_displ_time_to_steps(gmx_ana_displ_t *d, real time, int *nsteps);
65 /** Stores the position of a particle for displacement calculation. */
66 int
67 gmx_ana_displ_store(gmx_ana_displ_t *d, atom_id id, rvec x, bool bPres);
68 /** Convenience function for storing an array of particle positions for displacement calculation. */
69 int
70 gmx_ana_displ_store_array(gmx_ana_displ_t *d, int n, atom_id id[], rvec x[]);
71 /** Stores an array of particle positions for displacement calculation, including unselected particles. */
72 int
73 gmx_ana_displ_store_all(gmx_ana_displ_t *d, atom_id id[], rvec x[]);
74 /** Convenience function for storing a set of positions from \c gmx_ana_pos_t. */
75 int
76 gmx_ana_displ_store_pos(gmx_ana_displ_t *d, struct gmx_ana_pos_t *p);
77 /** Calculates the displacement vector for a particle. */
78 int
79 gmx_ana_displ_vector(gmx_ana_displ_t *d, int step, t_pbc *pbc,
80                      atom_id id, rvec x, rvec xout, bool *pout);
81 /** Calculates the displacement vectors for a list of particles. */
82 int
83 gmx_ana_displ_vectors(gmx_ana_displ_t *d, int step, t_pbc *pbc,
84                       int n, atom_id id[], rvec x[],
85                       rvec xout[], bool *pout);
86 /** Calculates the displacement vectors for all particles, including unselected. */
87 int
88 gmx_ana_displ_vectors_all(gmx_ana_displ_t *d, int step, t_pbc *pbc,
89                           rvec x[], rvec xout[], bool *pout);
90 /** Frees the memory allocated for displacement calculation. */
91 void
92 gmx_ana_displ_free(gmx_ana_displ_t *d);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif