File: restraints.hh

package info (click to toggle)
coot 1.1.18%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 219,960 kB
  • sloc: cpp: 495,934; python: 35,043; ansic: 26,143; lisp: 22,768; sh: 13,186; makefile: 2,746; awk: 441; xml: 245; csh: 14
file content (143 lines) | stat: -rw-r--r-- 4,680 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* pyrogen/restraints-boost.hh
 * 
 * Copyright 2011 by the University of Oxford
 * Copyright 2014 by Medical Research Council
 * Author: Paul Emsley
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA
 */

#ifndef RESTRAINTS_HH
#define RESTRAINTS_HH

#include <Python.h>
#include <cstddef>
#include <string>
#include <vector>

#include "compat/coot-sysdep.h"
#include <GraphMol/GraphMol.h>
#include <GraphMol/MolOps.h>
#include <GraphMol/Bond.h>

#include <geometry/protein-geometry.hh>
#include <analysis/mogul-interface.hh>

#include "restraints-private.hh"

namespace coot {

   class quartet_set {
   public:
      quartet_set() {
	 idx.resize(4,0);
      }
      explicit quartet_set(const std::vector<unsigned int> &q_in) {
	 unsigned int n_max = 4;
	 idx.resize(4,0);
	 if (q_in.size() < n_max)
	    n_max = q_in.size();
	 for (unsigned int i=0; i<n_max; i++)
	    idx[i] = q_in[i];
      } 
      std::vector<unsigned int> idx;
      const unsigned int & operator[](unsigned int i) const { return idx[i]; }
   };

   class indexed_name_and_rank_t {
   public:
      unsigned int atom_index;
      unsigned int cip_rank;
      std::string atom_name;
      indexed_name_and_rank_t(unsigned int i, unsigned int r, const std::string &n) : atom_name(n) {
         atom_index = i;
         cip_rank = r;
      }
      bool operator<(const indexed_name_and_rank_t &o) const {
         return (o.cip_rank < cip_rank);
      }
   };

   int get_volume_sign_from_coordinates(const RDKit::ROMol &mol,
                                        unsigned int idx_chiral_centre_atom,
                                        const std::vector<indexed_name_and_rank_t> &neighb_names_and_ranks);

   void mogul_out_to_mmcif_dict(const std::string &mogul_file_name,
				const std::string &comp_id,
				const std::string &compound_name,
				const std::vector<std::string> &atom_names,
				int n_atoms_all,
				int n_atoms_non_hydrogen,
				PyObject *bond_order_restraints_py,
				const std::string &mmcif_out_file_name,
				bool quartet_planes, bool quartet_hydrogen_planes);

   // return restraints
   PyObject *mogul_out_to_mmcif_dict_by_mol(const std::string &mogul_file_name,
					    const std::string &comp_id,
					    const std::string &compound_name,
					    PyObject *rdkit_mol,
					    PyObject *bond_order_restraints_py,
					    const std::string &mmcif_out_file_name,
					    bool quartet_planes, bool quartet_hydrogen_planes,
					    bool replace_with_mmff_b_a_restraints=true);

   PyObject *
   mmcif_dict_from_mol(const std::string &comp_id,
		       const std::string &compound_name,
		       PyObject *rdkit_mol,
                       bool do_minimization,
		       const std::string &mmcif_out_file_name,
		       bool quartet_planes, bool quartet_hydrogen_planes,
		       bool replace_with_mmff_b_a_restraints=true);
   
   // which is a wrapper for:
   std::pair<bool, coot::dictionary_residue_restraints_t>
   mmcif_dict_from_mol_using_energy_lib(const std::string &comp_id,
					const std::string &compound_name,
					PyObject *rdkit_mol,
					bool quartet_planes, bool quartet_hydrogen_planes);
   
   void write_restraints(PyObject *restraints_py,
			 const std::string &monomer_type,
			 const std::string &file_name);

   void regularize(PyObject *rdkit_mol, PyObject *restraints_py,
		   const std::string &res_name);

   //
   void regularize_and_write_pdb(PyObject *rdkit_mol, PyObject *restraints_py,
				 const std::string &res_name,
				 const std::string &pdb_file_name);

   void write_pdb_from_mol(PyObject *rdkit_mol_py,
			   const std::string &res_name,
			   const std::string &file_name);

   PyObject *types_from_mmcif_dictionary(const std::string &file_name);

   PyObject *test_tuple();
   PyObject *match_restraints_to_dictionaries(PyObject *restraints_in,
					      PyObject *template_comp_id_list,
					      PyObject *template_cif_dict_file_names);
   void write_restraints(PyObject *restraints_py, const std::string &file_name);

}



#endif // RESTRAINTS_HH