ec8fba881cfde9bba832479610fe3c23d5c1e455
[alexxy/gromacs.git] / include / pull.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  *                        VERSION 3.2.0
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2004, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  * 
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  * 
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  * 
30  * For more info, check our website at http://www.gromacs.org
31  * 
32  * And Hey:
33  * Gromacs Runs On Most of All Computer Systems
34  */
35
36 #ifndef _pull_h
37 #define _pull_h
38 #include "visibility.h"
39 #include "vec.h"
40 #include "typedefs.h"
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46
47 /* This file contains datatypes and function declarations necessary 
48    for mdrun to interface with the pull code */
49
50 /* Get the distance to the reference and deviation for pull group g */
51 GMX_LIBMD_EXPORT
52 void get_pullgrp_distance(t_pull *pull,t_pbc *pbc,int g,double t,
53                                  dvec dr,dvec dev);
54
55 /* Set the all the pull forces to zero */
56 void clear_pull_forces(t_pull *pull);
57
58 /* Determine the COM pull forces and add them to f, return the potential */
59 real pull_potential(int ePull,t_pull *pull, t_mdatoms *md, t_pbc *pbc,
60                            t_commrec *cr, double t, real lambda,
61                            rvec *x, rvec *f, tensor vir, real *dvdlambda);
62
63 /* Constrain the coordinates xp in the directions in x
64  * and also constrain v when v!=NULL.
65  */
66 void pull_constraint(t_pull *pull, t_mdatoms *md, t_pbc *pbc,
67                             t_commrec *cr, double dt, double t,
68                             rvec *x, rvec *xp, rvec *v, tensor vir);
69
70 /* Make a selection of the home atoms for all pull groups.
71  * Should be called at every domain decomposition.
72  */
73 GMX_LIBMD_EXPORT
74 void dd_make_local_pull_groups(gmx_domdec_t *dd,
75                                       t_pull *pull,t_mdatoms *md);
76
77 /* get memory and initialize the fields of pull that still need it, and
78    do runtype specific initialization */
79 GMX_LIBMD_EXPORT
80 void init_pull(FILE *fplog,  
81                       t_inputrec *ir, /* the inputrec */
82                       int nfile,       
83                       const t_filenm fnm[], /* standard filename struct */
84                       gmx_mtop_t *mtop, /* the topology of the whole system */
85                       t_commrec * cr, /* struct for communication info */
86                       const output_env_t oenv,  /* output options */
87                       real lambda, /* FEP lambda */
88                       gmx_bool bOutFile,   /* open output files */
89                       unsigned long Flags);
90
91 /* Close the pull output files */
92 GMX_LIBMD_EXPORT
93 void finish_pull(FILE *fplog,t_pull *pull);
94
95 /* Print the pull output (x and/or f) */
96 GMX_LIBMD_EXPORT
97 void pull_print_output(t_pull *pull, gmx_large_int_t step, double time);
98
99 /* In pullutil.c */
100
101 /* Calculates centers of mass all pull groups */
102 GMX_LIBMD_EXPORT
103 void pull_calc_coms(t_commrec *cr,
104                            t_pull *pull,   /* the pull group */
105                            t_mdatoms *md,  /* all atoms */
106                            t_pbc *pbc,
107                            double t,       /* only used for cylinder ref. */
108                            rvec x[],       /* local coordinates */
109                            rvec *xp        /* updated x, can be NULL */
110                            );    
111
112 #ifdef __cplusplus
113 }
114 #endif
115
116 #endif