Velocities and forces for selections.
[gromacs/qmmm-gamess-us.git] / include / hackblock.h
blob1264ed171183b1cb2ac6908cc58be1756e6c52f0
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.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
36 #ifndef _hackblock_h
37 #define _hackblock_h
39 #include "typedefs.h"
40 #include "pdbio.h"
41 #include "grompp.h"
42 #include "gpp_atomtype.h"
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
48 /* Used for reading .rtp/.tdb */
49 /* ebtsBONDS must be the first, new types can be added to the end */
50 /* these *MUST* correspond to the arrays in hackblock.c */
51 enum { ebtsBONDS, ebtsANGLES, ebtsPDIHS, ebtsIDIHS, ebtsEXCLS, ebtsCMAP, ebtsNR };
52 extern const char *btsNames[ebtsNR];
53 extern const int btsNiatoms[ebtsNR];
55 /* if changing any of these structs, make sure that all of the
56 free/clear/copy/merge_t_* functions stay updated */
58 /* BONDEDS */
59 typedef struct {
60 char *a[MAXATOMLIST]; /* atom names */
61 char *s; /* optional define string which gets copied from
62 .rtp/.tdb to .top and will be parsed by cpp
63 during grompp */
64 } t_rbonded;
66 typedef struct {
67 int nb; /* number of bondeds */
68 t_rbonded *b; /* bondeds */
69 } t_rbondeds;
71 /* RESIDUES (rtp) */
72 typedef struct {
73 char *resname;
74 /* atom data */
75 int natom;
76 t_atom *atom;
77 char ***atomname;
78 int *cgnr;
79 /* list of bonded interactions to add */
80 t_rbondeds rb[ebtsNR];
81 } t_restp;
83 /* Block to hack residues */
84 typedef struct {
85 int nr; /* Number of atoms to hack */
86 char *oname; /* Old name */
87 char *nname; /* New name */
88 /* the type of hack depends on the setting of oname and nname:
89 * if oname==NULL we're adding, must have tp>0 also!
90 * if oname!=NULL && nname==NULL we're deleting
91 * if oname!=NULL && nname!=NULL we're replacing
93 t_atom *atom; /* New atom data */
94 int cgnr; /* chargegroup number. if not read will be NOTSET */
95 int tp; /* Type of attachment (1..11) */
96 int nctl; /* How many control atoms there are */
97 char *a[4]; /* Control atoms i,j,k,l */
98 rvec newx; /* calculated new position */
99 atom_id newi; /* new atom index number (after additions) */
100 } t_hack;
102 typedef struct {
103 char *name; /* Name of hack block (residue or terminus) */
104 int nhack; /* Number of atoms to hack */
105 int maxhack;/* used for efficient srenew-ing */
106 t_hack *hack; /* Hack list */
107 /* list of bonded interactions to add */
108 t_rbondeds rb[ebtsNR];
109 } t_hackblock;
111 /* all libraries and other data to protonate a structure or trajectory */
112 typedef struct {
113 bool bInit; /* true after init; set false by init_t_protonate */
114 /* force field name: */
115 char FF[10];
116 /* libarary data: */
117 int *nab;
118 t_hack **ab;
119 t_hackblock *ah, *ntdb, *ctdb;
120 t_hackblock **sel_ntdb, **sel_ctdb;
121 int nah;
122 t_symtab tab;
123 /* residue indices (not numbers!) of the N and C termini */
124 int *rN, *rC;
125 gpp_atomtype_t atype;
126 /* protonated topology: */
127 t_atoms *patoms;
128 /* unprotonated topology: */
129 t_atoms *upatoms;
131 } t_protonate;
133 typedef struct {
134 char *res1, *res2;
135 char *atom1,*atom2;
136 char *newres1,*newres2;
137 int nbond1,nbond2;
138 real length;
139 } t_specbond;
141 extern t_specbond *get_specbonds(int *nspecbond);
142 extern void done_specbonds(int nsb,t_specbond sb[]);
144 extern void free_t_restp(int nrtp, t_restp **rtp);
145 extern void free_t_hack(int nh, t_hack **h);
146 extern void free_t_hackblock(int nhb, t_hackblock **hb);
147 /* free the whole datastructure */
149 extern void clear_t_hackblock(t_hackblock *hb);
150 extern void clear_t_hack(t_hack *hack);
151 /* reset struct */
153 extern void merge_t_bondeds(t_rbondeds s[], t_rbondeds d[],
154 bool bMin, bool bPlus);
155 /* add s[].b[] to d[].b[]
156 * If bMin==TRUE, don't copy bondeds with atoms starting with '-'
157 * If bPlus==TRUE, don't copy bondeds with atoms starting with '+'
160 extern void copy_t_restp(t_restp *s, t_restp *d);
161 extern void copy_t_hack(t_hack *s, t_hack *d);
162 extern void copy_t_hackblock(t_hackblock *s, t_hackblock *d);
163 /* make copy of whole datastructure */
165 extern void merge_hacks_lo(int ns, t_hack *s, int *nd, t_hack **d);
166 /* add s[] to *d[] */
168 extern void merge_hacks(t_hackblock *s, t_hackblock *d);
169 /* add s->hacks[] to d->hacks[] */
171 extern void merge_t_hackblock(t_hackblock *s, t_hackblock *d);
172 /* add s->hacks[] and s->rb[] to d*/
174 extern void dump_hb(FILE *out, int nres, t_hackblock hb[]);
175 /* print out whole datastructure */
177 extern void init_t_protonate(t_protonate *protonate);
178 /* initialize t_protein struct */
180 #ifdef __cplusplus
182 #endif
184 #endif /* _hackblock_h */