2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
38 #ifndef GMX_BONDED_BONDED_H
39 #define GMX_BONDED_BONDED_H
43 #include "gromacs/legacyheaders/genborn.h"
44 #include "gromacs/legacyheaders/nrnb.h"
45 #include "gromacs/legacyheaders/typedefs.h"
54 int glatnr(int *global_atom_index, int i);
55 /* Returns the global topology atom number belonging to local atom index i.
56 * This function is intended for writing ascii output
57 * and returns atom numbers starting at 1.
58 * When global_atom_index=NULL returns i+1.
61 /*! \brief Return whether this is a potential calculated in
62 * bonded.cpp, i.e. an interaction that actually calculates a
63 * potential and works on multiple atoms (not e.g. a connection or a
64 * position restraint). */
65 gmx_bool ftype_is_bonded_potential(int ftype);
67 void calc_bonds(const gmx_multisim_t *ms,
69 const rvec x[], history_t *hist,
70 rvec f[], t_forcerec *fr,
71 const struct t_pbc *pbc, const struct t_graph *g,
72 gmx_enerdata_t *enerd, t_nrnb *nrnb, real *lambda,
74 t_fcdata *fcd, int *ddgatindex,
77 * The function calc_bonds() calculates all bonded force interactions.
78 * The "bonds" are specified as follows:
80 * the total number of bonded interactions.
82 * specifies which atoms are involved in a bond of a certain
83 * type, see also struct t_idef.
84 * t_functype *functype
85 * defines for every bonded force type what type of function to
86 * use, see also struct t_idef.
87 * t_iparams *forceparams
88 * defines the parameters for every bond type, see also struct
91 * total potential energy split up over the function types.
93 * global atom number indices, should be NULL when not using DD.
95 * the total potential energy (sum over epot).
98 void calc_bonds_lambda(const t_idef *idef,
101 const struct t_pbc *pbc, const struct t_graph *g,
102 gmx_grppairener_t *grpp, real *epot, t_nrnb *nrnb,
105 t_fcdata *fcd, int *global_atom_index);
106 /* As calc_bonds, but only determines the potential energy
107 * for the perturbed interactions.
108 * The shift forces in fr are not affected.
111 real posres(int nbonds,
112 const t_iatom forceatoms[], const t_iparams forceparams[],
113 const rvec x[], rvec f[], rvec vir_diag,
115 real lambda, real *dvdlambda,
116 int refcoord_scaling, int ePBC, rvec comA, rvec comB);
117 /* Position restraints require a different pbc treatment from other bondeds */
119 real fbposres(int nbonds,
120 const t_iatom forceatoms[], const t_iparams forceparams[],
121 const rvec x[], rvec f[], rvec vir_diag,
122 struct t_pbc *pbc, int refcoord_scaling, int ePBC, rvec com);
123 /* Flat-bottom posres. Same PBC treatment as in normal position restraints */
125 real bond_angle(const rvec xi, const rvec xj, const rvec xk,
126 const struct t_pbc *pbc,
127 rvec r_ij, rvec r_kj, real *costh,
128 int *t1, int *t2); /* out */
129 /* Calculate bond-angle. No PBC is taken into account (use mol-shift) */
131 real dih_angle(const rvec xi, const rvec xj, const rvec xk, const rvec xl,
132 const struct t_pbc *pbc,
133 rvec r_ij, rvec r_kj, rvec r_kl, rvec m, rvec n, /* out */
135 int *t1, int *t2, int *t3);
136 /* Calculate dihedral-angle. No PBC is taken into account (use mol-shift) */
138 void do_dih_fup(int i, int j, int k, int l, real ddphi,
139 rvec r_ij, rvec r_kj, rvec r_kl,
140 rvec m, rvec n, rvec f[], rvec fshift[],
141 const struct t_pbc *pbc, const struct t_graph *g,
142 const rvec *x, int t1, int t2, int t3);
143 /* Do an update of the forces for dihedral potentials */
145 void make_dp_periodic(real *dp);
146 /* make a dihedral fall in the range (-pi,pi) */
148 /*************************************************************************
150 * Bonded force functions
152 *************************************************************************/
153 t_ifunc bonds, g96bonds, morse_bonds, cubic_bonds, FENE_bonds, restraint_bonds;
154 t_ifunc angles, g96angles, cross_bond_bond, cross_bond_angle, urey_bradley, quartic_angles, linear_angles;
156 t_ifunc pdihs, idihs, rbdihs;
157 t_ifunc restrdihs, cbtdihs;
158 t_ifunc tab_bonds, tab_angles, tab_dihs;
159 t_ifunc polarize, anharm_polarize, water_pol, thole_pol, angres, angresz, dihres, unimplemented;