Fixed segv in make_edi when no reference structure given
[gromacs/adressmacs.git] / include / typedefs.h
blobcf70e748f1a792d6ae5f7386bffb31d3ae2c624e
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 3.2.0
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
33 * And Hey:
34 * Gromacs Runs On Most of All Computer Systems
37 #ifndef _typedefs_h
38 #define _typedefs_h
40 #ifdef HAVE_CONFIG_H
41 #include <config.h>
42 #endif
44 #ifdef CPLUSPLUS
45 extern "C" {
46 #endif
48 #define STRLEN 4096
49 #define NOTSET -12345
51 #include <sys/types.h>
52 #include <sysstuff.h>
53 #include <types/simple.h>
54 #include <types/enums.h>
55 #include <types/block.h>
56 #include <types/symtab.h>
57 #include <types/idef.h>
58 #include <types/atoms.h>
59 #include <types/trx.h>
60 #include <types/topology.h>
61 #include <types/energy.h>
62 #include <types/inputrec.h>
63 #include <types/ishift.h>
64 #include <types/graph.h>
65 #include <types/nrnb.h>
66 #include <types/nblist.h>
67 #include <types/nsgrid.h>
68 #include <types/commrec.h>
69 #include <types/forcerec.h>
70 #include <types/fcdata.h>
71 #include <types/mdatom.h>
72 #include <types/pbc.h>
73 #include <types/ifunc.h>
74 #include <types/filenm.h>
75 #include <types/group.h>
76 #include <types/state.h>
77 #include <types/shellfc.h>
78 #include <types/constr.h>
79 #include <types/matrix.h>
81 /*
82 * Memory (re)allocation can be VERY slow, especially with some
83 * MPI libraries that replace the standard malloc and realloc calls.
84 * To avoid slow memory allocation we use over_alloc to set the memory
85 * allocation size for large data blocks. Since this scales the size
86 * with a factor, we use log(n) realloc calls instead of n.
87 * This can reduce allocation times from minutes to seconds.
89 /* This factor leads to 4 realloc calls to double the array size */
90 #define OVER_ALLOC_FAC 1.19
92 extern void set_over_alloc_dd(bool set);
93 /* Turns over allocation for variable size atoms/cg/top arrays on or off,
94 * default is off.
97 extern int over_alloc_dd(int n);
98 /* Returns n when domain decomposition over allocation is off.
99 * Returns OVER_ALLOC_FAC*n + 100 when over allocation in on.
100 * This is to avoid frequent reallocation
101 * during domain decomposition in mdrun.
104 /* Over allocation for small data types: int, real etc. */
105 #define over_alloc_small(n) (OVER_ALLOC_FAC*(n) + 8000)
107 /* Over allocation for large data types: complex structs */
108 #define over_alloc_large(n) (OVER_ALLOC_FAC*(n) + 1000)
110 /* Functions to initiate and delete structures *
111 * These functions are defined in gmxlib/typedefs.c
113 void init_block(t_block *block);
114 void init_blocka(t_blocka *block);
115 void init_atom (t_atoms *at);
116 void init_mtop(gmx_mtop_t *mtop);
117 void init_top (t_topology *top);
118 void init_inputrec(t_inputrec *ir);
119 void init_gtc_state(t_state *state,int ngtc);
120 void init_state(t_state *state,int natoms,int ngtc);
122 void copy_blocka(const t_blocka *src,t_blocka *dest);
124 void done_block(t_block *block);
125 void done_blocka(t_blocka *block);
126 void done_atom (t_atoms *at);
127 void done_moltype(gmx_moltype_t *molt);
128 void done_molblock(gmx_molblock_t *molb);
129 void done_mtop(gmx_mtop_t *mtop,bool bDoneSymtab);
130 void done_top(t_topology *top);
131 void done_inputrec(t_inputrec *ir);
132 void done_state(t_state *state);
134 void set_box_rel(t_inputrec *ir,t_state *state);
135 /* Set state->box_rel used in mdrun to preserve the box shape */
137 void preserve_box_shape(t_inputrec *ir,matrix box_rel,matrix b);
138 /* Preserve the box shape, b can be box or boxv */
140 void stupid_fill_block(t_block *grp, int natom,bool bOneIndexGroup);
141 /* Fill a block structure with numbers identical to the index
142 * (0, 1, 2, .. natom-1)
143 * If bOneIndexGroup, then all atoms are lumped in one index group,
144 * otherwise there is one atom per index entry
147 void stupid_fill_blocka(t_blocka *grp, int natom);
148 /* Fill a block structure with numbers identical to the index
149 * (0, 1, 2, .. natom-1)
150 * There is one atom per index entry
153 void init_t_atoms(t_atoms *atoms, int natoms, bool bPdbinfo);
154 /* allocate memory for the arrays, set nr to natoms and nres to 0
155 * set pdbinfo to NULL or allocate memory for it */
157 void free_t_atoms(t_atoms *atoms,bool bFreeNames);
158 /* free all the arrays and set the nr and nres to 0 */
160 t_atoms *mtop2atoms(gmx_mtop_t *mtop);
161 /* generate a t_atoms struct for the system from gmx_mtop_t */
163 #ifdef CPLUSPLUS
165 #endif
168 #endif /* _typedefs_h */