Debian Codegraph @

ideal/coot-compare-residues.cc

raw symbols SCIP
1 /* ideal/coot-compare-residues.cc
2 *
3 * Copyright 2012 by Medical Research Council
4 * Author: Paul Emsley
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 3 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License and
17 * the GNU Lesser General Public License along with this program; if not,
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
19 * Fifth Floor, Boston, MA, 02110-1301, USA.
20 */
21
22 #include "compat/coot-sysdep.h"cxx . . $ `<file>/compat/coot-sysdep.h`/
23
24 #include "simple-restraint.hh"cxx . . $ `<file>/ideal/simple-restraint.hh`/
25 #include "geometry/protein-geometry.hh"cxx . . $ `<file>/geometry/protein-geometry.hh`/
26 #include "coot-utils/coot-coord-utils.hh"cxx . . $ `<file>/coot-utils/coot-coord-utils.hh`/
27 #include "coot-compare-residues.hh"cxx . . $ `<file>/ideal/coot-compare-residues.hh`/
28 #include "torsion-bonds.hh"cxx . . $ `<file>/ideal/torsion-bonds.hh`/
29
30 bool
31 cootcxx . . $ coot/::compare_residue_torsionscxx . . $ coot/compare_residue_torsions(e5b2fc91992ee952).(int imol_1, mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol1, mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *res_1,
32 int imol_2, mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol2, mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *res_2,
33 double tolerance,
34 cootcxx . . $ coot/::protein_geometrycxx . . $ coot/protein_geometry# *geom_p) {
35
36 bool similar_status = false;
37 stdcxx . . $ std/::stringcxx . . $ std/string# resname_1 = res_1cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).();
38 stdcxx . . $ std/::stringcxx . . $ std/string# resname_2 = res_2cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).();
39
40 stdcxx . . $ std/::paircxx . . $ std/pair#<bool, cootcxx . . $ coot/::dictionary_residue_restraints_tcxx . . $ coot/dictionary_residue_restraints_t#> restraints =
41 geom_p->get_monomer_restraintscxx . . $ coot/protein_geometry#get_monomer_restraints(a55f7295d433dd41).(resname_1, imol_1);
42
43 if (restraints.firstcxx . . $ std/pair#first.) {
44
45 mmdbcxx . . $ mmdb/::PPAtomcxx . . $ mmdb/PPAtom# residue_atoms_1 = 0;
46 mmdbcxx . . $ mmdb/::PPAtomcxx . . $ mmdb/PPAtom# residue_atoms_2 = 0;
47 int n_residue_atoms_1;
48 int n_residue_atoms_2;
49 res_1->GetAtomTablecxx . . $ mmdb/Residue#GetAtomTable(9d9941bd98e0b231).(residue_atoms_1, n_residue_atoms_1);
50 res_2->GetAtomTablecxx . . $ mmdb/Residue#GetAtomTable(9d9941bd98e0b231).(residue_atoms_2, n_residue_atoms_2);
51
52 if (n_residue_atoms_1 && n_residue_atoms_2) {
53
54 stdcxx . . $ std/::vectorcxx . . $ std/vector#<torsion_atom_quadcxx . . $ coot/torsion_atom_quad#> tqv_1 =
55 torsionable_quadscxx . . $ coot/torsionable_quads(53c95b5d9624d931).(imol_1, mol1, residue_atoms_1, n_residue_atoms_1, geom_p);
56 stdcxx . . $ std/::vectorcxx . . $ std/vector#<torsion_atom_quadcxx . . $ coot/torsion_atom_quad#> tqv_2 =
57 torsionable_quadscxx . . $ coot/torsionable_quads(53c95b5d9624d931).(imol_2, mol2, residue_atoms_2, n_residue_atoms_2, geom_p);
58
59 bool all_atom_names_match = compare_residue_torsion_atom_namescxx . . $ coot/compare_residue_torsion_atom_names(9597aa8647c46021).(tqv_1, tqv_2);
60
61 if (all_atom_names_match) {
62 similar_status = true;
63 for (unsigned int i=0; i<tqv_1.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
64 double t_1 = tqv_1[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].torsioncxx . . $ coot/atom_quad#torsion(21b6c25e127938e2).();
65 double t_2 = tqv_2[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].torsioncxx . . $ coot/atom_quad#torsion(21b6c25e127938e2).();
66 double delta = t_2 - t_1;
67 if (delta < -360.0)
68 delta += 360.0;
69 if (delta > 360.0)
70 delta -= 360.0;
71 if (delta > tolerance)
72 return false;
73 // std::cout << " " << i << " " << t_1 << " " << t_2 << " "
74 // << delta << std::endl;
75 }
76 }
77 }
78 }
79 return similar_status;
80 }
81
82 bool
83 cootcxx . . $ coot/::compare_residue_torsion_atom_namescxx . . $ coot/compare_residue_torsion_atom_names(9597aa8647c46021).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<torsion_atom_quadcxx . . $ coot/torsion_atom_quad#> &tqv_1,
84 const stdcxx . . $ std/::vectorcxx . . $ std/vector#<torsion_atom_quadcxx . . $ coot/torsion_atom_quad#> &tqv_2) {
85
86 bool status = false;
87 unsigned int n1 = tqv_1.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
88 unsigned int n2 = tqv_2.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
89 if (n1 != n2) {
90 return false;
91 } else {
92 for (unsigned int i=0; i<tqv_1.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
93 if (! tqv_1[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].filled_pcxx . . $ coot/atom_quad#filled_p(50ce9a9e25b4a850).()) return false;
94 if (! tqv_2[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].filled_pcxx . . $ coot/atom_quad#filled_p(50ce9a9e25b4a850).()) return false;
95 stdcxx . . $ std/::stringcxx . . $ std/string# n11=tqv_1cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_1cxx . . $ coot/atom_quad#atom_1.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
96 stdcxx . . $ std/::stringcxx . . $ std/string# n12=tqv_1cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_2cxx . . $ coot/atom_quad#atom_2.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
97 stdcxx . . $ std/::stringcxx . . $ std/string# n13=tqv_1cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_3cxx . . $ coot/atom_quad#atom_3.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
98 stdcxx . . $ std/::stringcxx . . $ std/string# n14=tqv_1cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_4cxx . . $ coot/atom_quad#atom_4.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
99 stdcxx . . $ std/::stringcxx . . $ std/string# n21=tqv_2cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_1cxx . . $ coot/atom_quad#atom_1.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
100 stdcxx . . $ std/::stringcxx . . $ std/string# n22=tqv_2cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_2cxx . . $ coot/atom_quad#atom_2.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
101 stdcxx . . $ std/::stringcxx . . $ std/string# n23=tqv_2cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_3cxx . . $ coot/atom_quad#atom_3.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
102 stdcxx . . $ std/::stringcxx . . $ std/string# n24=tqv_2cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].atom_4cxx . . $ coot/atom_quad#atom_4.->GetAtomNamecxx . . $ mmdb/Atom#GetAtomName(41208ce6ca65dd58).();
103 if (! ((n11 ==cxx . . $ std/`operator==`(5ea818b58063a774). n21) && (n12 ==cxx . . $ std/`operator==`(5ea818b58063a774). n22) && (n13 ==cxx . . $ std/`operator==`(5ea818b58063a774). n23) && (n14 ==cxx . . $ std/`operator==`(5ea818b58063a774). n24))) {
104 return false;
105 }
106 }
107 status = true;
108 }
109 return status;
110 }
111