Debian Codegraph @

coot-utils/polar-atoms.cc

raw symbols SCIP
1 /*
2 * coot-utils/polar-atoms.cc
3 *
4 * Copyright 2020 by Medical Research Council
5 * Author: Paul Emsley
6 *
7 * This file is part of Coot
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copies of the GNU General Public License and
20 * the GNU Lesser General Public License along with this program; if not,
21 * write to the Free Software Foundation, Inc., 51 Franklin Street,
22 * Fifth Floor, Boston, MA, 02110-1301, USA.
23 * See http://www.gnu.org/licenses/
24 *
25 */
26
27 #include <iostream>
28 #include <map>
29
30 #include "geometry/protein-donor-acceptors.hh"cxx . . $ `<file>/geometry/protein-donor-acceptors.hh`/
31 #include "polar-atoms.hh"cxx . . $ `<file>/coot-utils/polar-atoms.hh`/
32
33 #include "contacts-by-bricks.hh"cxx . . $ `<file>/coot-utils/contacts-by-bricks.hh`/
34 #include "geometry/residue-and-atom-specs.hh"cxx . . $ `<file>/geometry/residue-and-atom-specs.hh`/
35
36 #include "analysis/daca.hh"cxx . . $ `<file>/analysis/daca.hh`/
37
38 // This molecule should have hydrogen atoms.
39 void
40 cootcxx . . $ coot/::buried_unsatisfied_polar_atomscxx . . $ coot/buried_unsatisfied_polar_atoms(5b0a958cc70af8d5).(mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol) {
41
42 stdcxx . . $ std/::setcxx . . $ std/set#<unsigned int> fixed_atom_indicescxx . . $ std/set#set(49f6e7a06ebc5aa8).; // empty
43
44 int SelectionHandle = mol->NewSelectioncxx . . $ mmdb/SelManager#NewSelection(b126dc7c1de90089).(); // d
45 mol->SelectAtomscxx . . $ mmdb/SelManager#SelectAtoms(395440d8c4963665). (SelectionHandle, 0, "*",
46 mmdbcxx . . $ mmdb/::ANY_REScxx . . $ mmdb/ANY_RES., // starting resno, an int
47 "*", // any insertion code
48 mmdbcxx . . $ mmdb/::ANY_REScxx . . $ mmdb/ANY_RES., // ending resno
49 "*", // ending insertion code
50 "*", // any residue name
51 "*", // atom name
52 "*", // elements
53 "*" // alt loc.
54 );
55
56 // -: ASP GLU
57 // +: LYS ARG HIS
58 // H: ASN GLN SER THR TYR
59
60 mmdbcxx . . $ mmdb/::Atomcxx . . $ mmdb/Atom# **atom_selection = 0;
61 int n_selected_atoms = 0;
62 mol->GetSelIndexcxx . . $ mmdb/SelManager#GetSelIndex(72b04e22d1bb79c2).(SelectionHandle, atom_selection, n_selected_atoms);
63 stdcxx . . $ std/::mapcxx . . $ std/map#<stdcxx . . $ std/::stringcxx . . $ std/string#, bool> is_polar_mapcxx . . $ std/map#map(49f6e7a06ebc5aa8).;
64
65 cootcxx . . $ coot/::quick_protein_donor_acceptorscxx . . $ coot/quick_protein_donor_acceptors# pdacxx . . $ coot/quick_protein_donor_acceptors#quick_protein_donor_acceptors(49f6e7a06ebc5aa8).;
66
67 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "selected " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). n_selected_atoms <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " atoms " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
68 if (n_selected_atoms > 0) {
69 contacts_by_brickscxx . . $ coot/contacts_by_bricks# contactscxx . . $ coot/contacts_by_bricks#contacts_by_bricks(feb9667c0854532c).(atom_selection, n_selected_atoms, fixed_atom_indices);
70 // max distance between hydrogen atom and a hydrogen bond acceptor
71 contacts.set_dist_maxcxx . . $ coot/contacts_by_bricks#set_dist_max(9364e6e7bff7660).(3.0); // Hmmm
72 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::setcxx . . $ std/set#<unsigned int> > veccxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
73 contacts.find_the_contactscxx . . $ coot/contacts_by_bricks#find_the_contacts(50f317ca353d72f8).(&vec);
74
75 #if 0
76 daca d;
77 std::vector<std::pair<mmdb::Residue *, float> > se = d.solvent_exposure(mol);
78 std::map<mmdb::Residue *, float> se_map;
79 for (auto p : se)
80 se_map[p.first] = p.second;
81 #endif
82
83 stdcxx . . $ std/::vectorcxx . . $ std/vector#<bool> is_polarcxx . . $ std/vector#vector(3413bcf9e068cf98).(n_selected_atoms, false);
84 for (int i=0; i<n_selected_atoms; i++) {
85 mmdbcxx . . $ mmdb/::Atomcxx . . $ mmdb/Atom# *at = atom_selection[i];
86 stdcxx . . $ std/::stringcxx . . $ std/string# res_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(at->residuecxx . . $ mmdb/Atom#residue.->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).());
87 stdcxx . . $ std/::stringcxx . . $ std/string# at_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(at->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).());
88 quick_protein_donor_acceptorscxx . . $ coot/quick_protein_donor_acceptors#::keycxx . . $ coot/quick_protein_donor_acceptors#key# kcxx . . $ coot/quick_protein_donor_acceptors#key#key(c3ca1c130ce09c52).(res_name, at_name);
89 hb_tcxx . . $ coot/hb_t# hb_type = pda.get_typecxx . . $ coot/quick_protein_donor_acceptors#get_type(82488ddb32ba4c08).(k);
90 if (hb_type == HB_BOTHcxx . . $ coot/HB_BOTH. || hb_type == HB_DONORcxx . . $ coot/HB_DONOR. || hb_type == HB_ACCEPTORcxx . . $ coot/HB_ACCEPTOR. || hb_type == HB_HYDROGENcxx . . $ coot/HB_HYDROGEN.)
91 is_polar[cxx . . $ std/vector#`operator[]`(1450282ea0befc17).i] =cxx . . $ std/_Bit_reference#`operator=`(2a6c206c8bbf32aa). true;
92 }
93
94 if (!vec.emptycxx . . $ std/vector#empty(3482b152b9333168).()) {
95 int vs = vec.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
96 if (vs != n_selected_atoms) {
97 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "size problem " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). vs <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). n_selected_atoms <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
98 } else {
99 for (int i=0; i<n_selected_atoms; i++) {
100 if (is_polar[cxx . . $ std/vector#`operator[]`(1450282ea0befc17).i]) {
101 if (! vec[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].emptycxx . . $ std/set#empty(3482b152b9333168).()) {
102 mmdbcxx . . $ mmdb/::Atomcxx . . $ mmdb/Atom# *at = atom_selection[i];
103 if (at) {
104 if (! at->isTercxx . . $ mmdb/Atom#isTer(c9857a73d68e59ba).()) {
105 bool found_something = false;
106 stdcxx . . $ std/::stringcxx . . $ std/string# res_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(at->residuecxx . . $ mmdb/Atom#residue.->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).());
107 stdcxx . . $ std/::stringcxx . . $ std/string# at_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(at->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).());
108 quick_protein_donor_acceptorscxx . . $ coot/quick_protein_donor_acceptors#::keycxx . . $ coot/quick_protein_donor_acceptors#key# key_1cxx . . $ coot/quick_protein_donor_acceptors#key#key(c3ca1c130ce09c52).(res_name, at_name);
109 stdcxx . . $ std/::setcxx . . $ std/set#<unsigned int>::const_iteratorcxx . . $ std/set#const_iterator# itcxx . . $ std/_Rb_tree_const_iterator#_Rb_tree_const_iterator(ced63f7c635d850d).;
110 for (it=cxx . . $ std/_Rb_tree_const_iterator#`operator=`(144a18f9ed4078ac).vec[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].begincxx . . $ std/set#begin(3220b82c0db6d2a1).(); it!=vec[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].endcxx . . $ std/set#end(3220b82c0db6d2a1).(); ++cxx . . $ std/_Rb_tree_const_iterator#operator++(9cb79ab07bb244bf).it) {
111 mmdbcxx . . $ mmdb/::Atomcxx . . $ mmdb/Atom# *at_neighb = atom_selection[*cxx . . $ std/_Rb_tree_const_iterator#`operator*`(2042464fc1fea03e).it];
112 if (at_neighb) {
113 if (! at_neighb->isTercxx . . $ mmdb/Atom#isTer(c9857a73d68e59ba).()) {
114 stdcxx . . $ std/::stringcxx . . $ std/string# res_name_ncxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(at->residuecxx . . $ mmdb/Atom#residue.->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).());
115 stdcxx . . $ std/::stringcxx . . $ std/string# at_name_ncxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(at->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).());
116 quick_protein_donor_acceptorscxx . . $ coot/quick_protein_donor_acceptors#::keycxx . . $ coot/quick_protein_donor_acceptors#key# key_2cxx . . $ coot/quick_protein_donor_acceptors#key#key(c3ca1c130ce09c52).(res_name_n, at_name_n);
117 stdcxx . . $ std/::paircxx . . $ std/pair#<bool, bool> is_valid = pda.is_hydrogen_bond_by_typescxx . . $ coot/quick_protein_donor_acceptors#is_hydrogen_bond_by_types(7635c75eb365b830).(key_1, key_2);
118 if (is_valid.firstcxx . . $ std/pair#first.)
119 if (is_valid.secondcxx . . $ std/pair#second.)
120 found_something = true;
121 }
122 }
123 }
124 if (! found_something) {
125 // std::cout << "Nothing was found for atom " << atom_spec_t(at) << std::endl;
126 }
127
128 // mmdb::Residue *residue_p = at->residue;
129 // std::cout << atom_spec_t(at) << " " << se_map[residue_p] << " " << found_something
130 // << std::endl;
131 }
132 }
133 }
134 }
135 }
136 }
137 } else {
138 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "empty vec - sad face" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
139 }
140 }
141
142 }