fixed incorrect table allocation
[alexxy/gromacs.git] / src / mdlib / gmx_qhop_db.h
1 #ifndef _GMX_QHOP_DB_H
2 #define _GMX_QHOP_DB_H
3
4 typedef struct{
5   real  alpha, beta, gamma;
6   real  k_1, k_2, k_3, m_1, m_2, m_3;
7   real  s_A, t_A, v_A, s_B, s_C, t_C, v_C;
8   real  f, g, h;
9   real  p_1, q_1, q_2, q_3, r_1, r_2, r_3;
10 } t_qhop_parameters;
11         
12 typedef struct gmx_qhop_db_t *gmx_qhop_db;
13
14 /* Return database if successful, or NULL on failure */
15 extern gmx_qhop_db gmx_qhop_db_read(char *forcefield);
16  
17 /* Write the database to a filename. Return 1 on success, or 0 for
18    failure */
19 extern int gmx_qhop_db_write(char *fn,gmx_qhop_db qdb);
20
21 /* Destroy the internal datastructures to free memory. Return 1 on
22    success, 0 for failure */
23 extern int gmx_qhop_db_done(gmx_qhop_db qdb);
24
25 /* Return the number of states in the database for a given residue
26    name: e.g. 1 for alanine, 2 for lysine, 4 for histidine. Returns
27    NOTSET when the residue is not present in the database. */
28 extern int gmx_qhop_db_get_nstates(gmx_qhop_db qdb,char *resname);
29
30 /* Return the net charge for a given state for a given
31    residue. Returns NOTSET when the residue is not in the database, or
32    when the state is invalid for the residue. */
33 extern int gmx_qhop_db_get_qstate(gmx_qhop_db qdb,char *resname,int state);
34
35 /* Return a NULL-terminated list of atomnames of the donors in the
36    residue for the indicated state. If NULL there are no donors in the
37    residue. This assumes atomnames are unique, which is true for
38    proteins and nucleic acids at least. */
39 extern char **gmx_qhop_db_get_donors(gmx_qhop_db qdb,char *resname,int state);
40
41 /* Return a NULL-terminated list of atomnames of the acceptors in the
42    residue for the indicated state. If NULL there are no acceptors in
43    the residue. This assumes atomnames are unique, which is true for
44    proteins and nucleic acids at least. */
45 extern char **gmx_qhop_db_get_acceptors(gmx_qhop_db qdb,char *resname,int state);
46
47 /* Fills the array q (length natoms) with the charges corresponding to
48    residue name and state. Return 1 on success, NOTSET if the resname
49    is not found or the state is incorrect. */
50 extern int gmx_qhop_db_set_charges(gmx_qhop_db qdb,char *resname,int state,
51                                    int natoms,real q[]);
52
53 /* Fill the qhop_parameters for a given donor/acceptor pair. Returns 1
54    if OK or 0 if either donor or acceptor does not exist. */
55 extern int gmx_qhop_db_get_parameters(gmx_qhop_db qdb,
56                                       char *donor,char *acceptor,
57                                       t_qhop_parameters *qp);
58
59 #endif