| 1 | /* lidia-core/chemical-feature-clusters.cc |
| 2 | * |
| 3 | * Copyright 2012 by the University of Oxford |
| 4 | * Copyright 2016 by Medical Research Council |
| 5 | * Author: Paul Emsley |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 20 | * 02110-1301, USA |
| 21 | */ |
| 22 | |
| 23 | // header-here |
| 24 | |
| 25 | #ifdef MAKE_ENHANCED_LIGAND_TOOLScxx . . $ `<built-in>:517:9`! |
| 26 | |
| 27 | #include <iostream> |
| 28 | #include <fstream> |
| 29 | #include <cstring> |
| 30 | |
| 31 | #include "utils/coot-utils.hh"cxx . . $ `<file>/utils/coot-utils.hh`/ |
| 32 | // #include "coot-utils/coot-coord-utils.hh" out of order |
| 33 | #include "rdkit-interface.hh"cxx . . $ `<file>/lidia-core/rdkit-interface.hh`/ |
| 34 | #include "chemical-feature-clusters.hh"cxx . . $ `<file>/lidia-core/chemical-feature-clusters.hh`/ |
| 35 | #include <GraphMol/MolChemicalFeatures/MolChemicalFeature.h> |
| 36 | |
| 37 | #include "get-residue.hh"cxx . . $ `<file>/lidia-core/get-residue.hh`/ |
| 38 | |
| 39 | |
| 40 | // do_alignment is an optional arg - default false |
| 41 | // |
| 42 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::chem_feat_clustcxx . . $ coot/chem_feat_clust#chem_feat_clust(43a5980bad5b8735).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<residue_spec_tcxx . . $ coot/residue_spec_t#> &protein_residues, |
| 43 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<chem_feat_solvated_ligand_speccxx . . $ coot/chem_feat_solvated_ligand_spec#> &ligands_in, |
| 44 | double water_dist_cutoff_in, |
| 45 | const protein_geometrycxx . . $ coot/protein_geometry# *geometry_p_in, |
| 46 | bool do_alignment) { |
| 47 | |
| 48 | water_dist_cutoffcxx . . $ coot/chem_feat_clust#water_dist_cutoff. = water_dist_cutoff_in; |
| 49 | geometry_pcxx . . $ coot/chem_feat_clust#geometry_p. = geometry_p_in; |
| 50 | setup_successcxx . . $ coot/chem_feat_clust#setup_success. = fill_ligandscxx . . $ coot/chem_feat_clust#fill_ligands(92e8511520294ec4).(ligands_in); |
| 51 | if (setup_successcxx . . $ coot/chem_feat_clust#setup_success.) { |
| 52 | setup_successcxx . . $ coot/chem_feat_clust#setup_success. = check_dictionariescxx . . $ coot/chem_feat_clust#check_dictionaries(c9857a73d68e59ba).(); |
| 53 | |
| 54 | if (setup_successcxx . . $ coot/chem_feat_clust#setup_success.) { // setup_success |
| 55 | if (do_alignment) |
| 56 | aligncxx . . $ coot/chem_feat_clust#align(49f6e7a06ebc5aa8).(); |
| 57 | |
| 58 | fill_waterscxx . . $ coot/chem_feat_clust#fill_waters(49f6e7a06ebc5aa8).(); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | |
| 64 | |
| 65 | void |
| 66 | cootcxx . . $ coot/::chem_feat_solvated_ligandcxx . . $ coot/chem_feat_solvated_ligand#::init_residuecxx . . $ coot/chem_feat_solvated_ligand#init_residue(49f6e7a06ebc5aa8).() { |
| 67 | |
| 68 | residuecxx . . $ coot/chem_feat_solvated_ligand#residue. = lidia_utilscxx . . $ coot/lidia_utils/::get_residuecxx . . $ coot/lidia_utils/get_residue(6049532bd3c35128).(ligand_speccxx . . $ coot/chem_feat_solvated_ligand_spec#ligand_spec., molcxx . . $ coot/chem_feat_solvated_ligand_spec#mol.); |
| 69 | |
| 70 | if (!residuecxx . . $ coot/chem_feat_solvated_ligand#residue.) { |
| 71 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING:: null residue from spec " <<cxx . . $ coot/`operator<<`(864abc555d23019c). ligand_speccxx . . $ coot/chem_feat_solvated_ligand_spec#ligand_spec. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | |
| 76 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::simple_chemical_feature_attributescxx . . $ coot/simple_chemical_feature_attributes#> |
| 77 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::get_chemical_featurescxx . . $ coot/chem_feat_clust#get_chemical_features(dd1cf33474b78ccc).(int imol, |
| 78 | residue_spec_tcxx . . $ coot/residue_spec_t# lig_spec, |
| 79 | mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *mol) { |
| 80 | |
| 81 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::simple_chemical_feature_attributescxx . . $ coot/simple_chemical_feature_attributes#> vcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 82 | bool success = false; |
| 83 | |
| 84 | if (! setup_successcxx . . $ coot/chem_feat_clust#setup_success.) |
| 85 | return vcxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 86 | |
| 87 | mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p = lidia_utilscxx . . $ coot/lidia_utils/::get_residuecxx . . $ coot/lidia_utils/get_residue(6049532bd3c35128).(lig_spec, mol); |
| 88 | |
| 89 | if (! residue_p) { |
| 90 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING:: failed to get ligand for molecule " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). imol |
| 91 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " at " <<cxx . . $ coot/`operator<<`(864abc555d23019c). lig_spec <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 92 | } else { |
| 93 | |
| 94 | try { |
| 95 | // this can throw an exception |
| 96 | RDKitcxx . . $ RDKit/::RWMolcxx . . $ RDKit/RWMol# rdkm = cootcxx . . $ coot/::rdkit_mol_sanitizedcxx . . $ coot/rdkit_mol_sanitized(7f98e365824287a0).(residue_p, imol, *geometry_pcxx . . $ coot/chem_feat_clust#geometry_p.); |
| 97 | |
| 98 | RDKitcxx . . $ RDKit/::MolChemicalFeatureFactorycxx . . $ RDKit/MolChemicalFeatureFactory# *factory = chemical_featurescxx . . $ chemical_features/::get_feature_factorycxx . . $ chemical_features/get_feature_factory(3c1d8be29d2fee03).(); |
| 99 | if (! factory) { |
| 100 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING:: no factory" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 101 | return vcxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 102 | } |
| 103 | |
| 104 | RDKitcxx . . $ RDKit/::FeatSPtrListcxx . . $ RDKit/FeatSPtrList# features = factory->getFeaturesForMolcxx . . $ RDKit/MolChemicalFeatureFactory#getFeaturesForMol(64a2f476c0af6ace).(rdkm); |
| 105 | |
| 106 | RDKitcxx . . $ RDKit/::Conformercxx . . $ RDKit/Conformer# conf = rdkmcxx . . $ RDKit/Conformer#Conformer(fa9982222ea8e6f6)..getConformercxx . . $ RDKit/ROMol#getConformer(6e9b493b005cef02).(0); // iconf? |
| 107 | |
| 108 | stdcxx . . $ std/::listcxx . . $ std/__cxx11/list#<RDKit::FeatSPtr>::const_iteratorcxx . . $ std/__cxx11/list#const_iterator# itcxx . . $ std/_List_const_iterator#_List_const_iterator(ced63f7c635d850d).; |
| 109 | for (it=cxx . . $ std/_List_const_iterator#`operator=`(f0c1a5de2fb06e4d).featurescxx . . $ std/_List_const_iterator#_List_const_iterator(2c469dd624388c9f)..begincxx . . $ std/__cxx11/list#begin(57ce810e58fbcab0).(); it!=featurescxx . . $ std/_List_const_iterator#_List_const_iterator(2c469dd624388c9f)..endcxx . . $ std/__cxx11/list#end(57ce810e58fbcab0).(); it++cxx . . $ std/_List_const_iterator#operator++(1a6c568c4660c65b).) { |
| 110 | RDKitcxx . . $ RDKit/::FeatSPtrcxx . . $ RDKit/FeatSPtr# feat_ptr = *cxx . . $ boost/shared_ptr#shared_ptr(773b157d8331f7d2).it; |
| 111 | boostcxx . . $ boost/::shared_ptrcxx . . $ boost/shared_ptr#<RDKitcxx . . $ RDKit/::MolChemicalFeaturecxx . . $ RDKit/MolChemicalFeature#> sp = *cxx . . $ boost/shared_ptr#shared_ptr(773b157d8331f7d2).it; |
| 112 | RDGeomcxx . . $ RDGeom/::Point3Dcxx . . $ RDGeom/Point3D# pos = sp.getcxx . . $ boost/shared_ptr#get(c378ccd34affdfd5).()->getPoscxx . . $ RDKit/MolChemicalFeature#getPos(a48853af479b9740).(); |
| 113 | clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# centrecxx . . $ clipper/Coord_orth#Coord_orth(3374d1a184fcc02e).(pos.xcxx . . $ RDGeom/Point3D#x., pos.ycxx . . $ RDGeom/Point3D#y., pos.zcxx . . $ RDGeom/Point3D#z.); |
| 114 | stdcxx . . $ std/::stringcxx . . $ std/string# family = spcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..getcxx . . $ boost/shared_ptr#get(c378ccd34affdfd5).()->getFamilycxx . . $ RDKit/MolChemicalFeature#getFamily(f4fff0029955a25f).(); |
| 115 | simple_chemical_feature_attributescxx . . $ coot/simple_chemical_feature_attributes# cfcxx . . $ coot/simple_chemical_feature_attributes#simple_chemical_feature_attributes(8bc8e2055ccf4471).(family, centre, imol, lig_spec); |
| 116 | v.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(cf); |
| 117 | } |
| 118 | } |
| 119 | catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &rte) { |
| 120 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING:: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). rte.whatcxx . . $ std/runtime_error#what(ba32b354807b2b81).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | return vcxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 125 | } |
| 126 | |
| 127 | |
| 128 | // return all chemical features |
| 129 | // |
| 130 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::simple_chemical_feature_attributescxx . . $ coot/simple_chemical_feature_attributes#> |
| 131 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::get_chemical_featurescxx . . $ coot/chem_feat_clust#get_chemical_features(d6006e8b29ce61fb).() { |
| 132 | |
| 133 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::simple_chemical_feature_attributescxx . . $ coot/simple_chemical_feature_attributes#> vcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 134 | |
| 135 | for (unsigned int i=0; i<ligandscxx . . $ coot/chem_feat_clust#ligands..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) { |
| 136 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::simple_chemical_feature_attributescxx . . $ coot/simple_chemical_feature_attributes#> cfs = |
| 137 | get_chemical_featurescxx . . $ coot/chem_feat_clust#get_chemical_features(dd1cf33474b78ccc).(ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].imolcxx . . $ coot/chem_feat_solvated_ligand_spec#imol., ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].ligand_speccxx . . $ coot/chem_feat_solvated_ligand_spec#ligand_spec., ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].molcxx . . $ coot/chem_feat_solvated_ligand_spec#mol.); |
| 138 | for (unsigned int j=0; j<cfs.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); j++) |
| 139 | v.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(cfs[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).j]); |
| 140 | } |
| 141 | return vcxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 142 | } |
| 143 | |
| 144 | |
| 145 | RDKitcxx . . $ RDKit/::MolChemicalFeatureFactorycxx . . $ RDKit/MolChemicalFeatureFactory# * |
| 146 | chemical_featurescxx . . $ chemical_features/::get_feature_factorycxx . . $ chemical_features/get_feature_factory(3c1d8be29d2fee03).() { |
| 147 | |
| 148 | RDKitcxx . . $ RDKit/::MolChemicalFeatureFactorycxx . . $ RDKit/MolChemicalFeatureFactory# *factory = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 149 | |
| 150 | stdcxx . . $ std/::stringcxx . . $ std/string# features_file_namecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).("BaseFeatures.fdef"); |
| 151 | stdcxx . . $ std/::stringcxx . . $ std/string# data_dir = "Data"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 152 | stdcxx . . $ std/::stringcxx . . $ std/string# dir = |
| 153 | cootcxx . . $ coot/::utilcxx . . $ coot/util/::append_dir_dircxx . . $ coot/util/append_dir_dir(203b42cd324c6c40).(cootcxx . . $ coot/::rdkit_package_data_dircxx . . $ coot/rdkit_package_data_dir(efd28698952f529a).(), data_dir); |
| 154 | stdcxx . . $ std/::stringcxx . . $ std/string# full_name = |
| 155 | cootcxx . . $ coot/::utilcxx . . $ coot/util/::append_dir_filecxx . . $ coot/util/append_dir_file(203b42cd324c6c40).(dir, features_file_name); |
| 156 | |
| 157 | // override that with an environment variable |
| 158 | const char *e = getenvcxx . . $ getenv(c63359b659779399).("COOT_CHEMICAL_FEATURES_DEF"); |
| 159 | if (e) full_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). e; |
| 160 | |
| 161 | if (cootcxx . . $ coot/::file_existscxx . . $ coot/file_exists(7c222eea44a24d43).(full_name)) { |
| 162 | stdcxx . . $ std/::ifstreamcxx . . $ std/ifstream# inStreamcxx . . $ std/basic_ifstream#basic_ifstream(b8cd37071ce335df).(full_name.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 163 | stdcxx . . $ std/::istreamcxx . . $ std/istream# &instrm = static_cast<stdcxx . . $ std/::istreamcxx . . $ std/istream# &>(inStream); |
| 164 | factory = RDKitcxx . . $ RDKit/::buildFeatureFactorycxx . . $ RDKit/buildFeatureFactory(8c466c81dbc51afe).(instrm); |
| 165 | |
| 166 | } else { |
| 167 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING:: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). full_name <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " does not exist. " |
| 168 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Stoping now." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 169 | } |
| 170 | return factory; |
| 171 | } |
| 172 | |
| 173 | bool |
| 174 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::fill_ligandscxx . . $ coot/chem_feat_clust#fill_ligands(92e8511520294ec4).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<chem_feat_solvated_ligand_speccxx . . $ coot/chem_feat_solvated_ligand_spec#> &ligands_in) { |
| 175 | |
| 176 | bool success = true; |
| 177 | for (unsigned int i=0; i<ligands_in.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) { |
| 178 | chem_feat_solvated_ligandcxx . . $ coot/chem_feat_solvated_ligand# ligcxx . . $ coot/chem_feat_solvated_ligand#chem_feat_solvated_ligand(9bcdfe89379339c2).(ligands_in[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i]); |
| 179 | if (! lig.residuecxx . . $ coot/chem_feat_solvated_ligand#residue.) { |
| 180 | success = false; |
| 181 | break; |
| 182 | } |
| 183 | ligandscxx . . $ coot/chem_feat_clust#ligands..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(lig); |
| 184 | } |
| 185 | return success; |
| 186 | } |
| 187 | |
| 188 | bool |
| 189 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::check_dictionariescxx . . $ coot/chem_feat_clust#check_dictionaries(c9857a73d68e59ba).() { |
| 190 | |
| 191 | // I think that imol should be part of the class chem_feat_clust |
| 192 | // for now I will fake up an imol |
| 193 | int imol_fake = 0; |
| 194 | bool success = true; |
| 195 | for (unsigned int ilig=0; ilig<ligandscxx . . $ coot/chem_feat_clust#ligands..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); ilig++) { |
| 196 | mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *res = ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig].residuecxx . . $ coot/chem_feat_solvated_ligand#residue.; |
| 197 | if (res) { |
| 198 | // it should be set by now |
| 199 | stdcxx . . $ std/::stringcxx . . $ std/string# res_name = rescxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).(); |
| 200 | |
| 201 | bool have = geometry_pcxx . . $ coot/chem_feat_clust#geometry_p.->have_at_least_minimal_dictionary_for_residue_typecxx . . $ coot/protein_geometry#have_at_least_minimal_dictionary_for_residue_type(de5fb838d5052d75).(res_name, imol_fake); |
| 202 | |
| 203 | if (! have) { |
| 204 | success = false; |
| 205 | break; |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | return success; |
| 210 | } |
| 211 | |
| 212 | |
| 213 | void |
| 214 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::fill_waterscxx . . $ coot/chem_feat_clust#fill_waters(49f6e7a06ebc5aa8).() { |
| 215 | |
| 216 | // This needs to be changed so that we only add waters that are |
| 217 | // some cut-off (4.2?) from the position of any of the atoms of any |
| 218 | // of the ligands |
| 219 | // |
| 220 | // we need to make a big vector of the positions of the ligand atoms |
| 221 | // and check that we are close enough |
| 222 | // |
| 223 | // so first get a big vector of ligand coords: |
| 224 | // |
| 225 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> lig_coords = get_ligands_coordscxx . . $ coot/chem_feat_clust#get_ligands_coords(d8fefbcdd2f94293).(); |
| 226 | // |
| 227 | // double dist_cutoff = 4.2; // a class member data |
| 228 | |
| 229 | for (unsigned int ilig=0; ilig<ligandscxx . . $ coot/chem_feat_clust#ligands..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); ilig++) { |
| 230 | for (unsigned int iw=0; iw<ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig].waterscxx . . $ coot/chem_feat_solvated_ligand_spec#waters..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); iw++) { |
| 231 | mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *res = lidia_utilscxx . . $ coot/lidia_utils/::get_residuecxx . . $ coot/lidia_utils/get_residue(6049532bd3c35128).(ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig].waterscxx . . $ coot/chem_feat_solvated_ligand_spec#waters.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).iw], ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig].molcxx . . $ coot/chem_feat_solvated_ligand_spec#mol.); |
| 232 | if (res) { |
| 233 | stdcxx . . $ std/::stringcxx . . $ std/string# res_name = rescxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->GetResNamecxx . . $ mmdb/Residue#GetResName(41208ce6ca65dd58).(); |
| 234 | if (res_name ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "HOH") { |
| 235 | mmdbcxx . . $ mmdb/::Atomcxx . . $ mmdb/Atom# *at = res->GetAtomcxx . . $ mmdb/Residue#GetAtom(aa774886b7cb8f8a).("O"); |
| 236 | if (! at) { |
| 237 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Missing O at HOH in " <<cxx . . $ coot/`operator<<`(864abc555d23019c). ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig].waterscxx . . $ coot/chem_feat_solvated_ligand_spec#waters.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).iw] |
| 238 | <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 239 | } else { |
| 240 | clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# pt = lidia_utilscxx . . $ coot/lidia_utils/::cocxx . . $ coot/lidia_utils/co(83465a92f19cbf90).(at); |
| 241 | |
| 242 | if (is_close_to_a_ligand_atomcxx . . $ coot/chem_feat_clust#is_close_to_a_ligand_atom(e3a84b223a78d960).(pt, lig_coords)) { |
| 243 | |
| 244 | water_attribscxx . . $ coot/chem_feat_clust#water_attribs# wacxx . . $ coot/chem_feat_clust#water_attribs#water_attribs(6f80ba00d90649f8).(ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig].imolcxx . . $ coot/chem_feat_solvated_ligand_spec#imol., ilig, iw, at, pt); |
| 245 | |
| 246 | if (false) |
| 247 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "fill_waters(): adding " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). ilig <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " |
| 248 | <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). iw <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ coot/`operator<<`(f8fcd6198bb35afb). atom_spec_tcxx . . $ coot/atom_spec_t#(at) <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 249 | |
| 250 | water_positionscxx . . $ coot/chem_feat_clust#water_positions..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(wa); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> |
| 260 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::get_ligands_coordscxx . . $ coot/chem_feat_clust#get_ligands_coords(d8fefbcdd2f94293).() const { |
| 261 | |
| 262 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> vcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 263 | |
| 264 | for (unsigned int i=0; i<ligandscxx . . $ coot/chem_feat_clust#ligands..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) { |
| 265 | mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *res = ligandscxx . . $ coot/chem_feat_clust#ligands.[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i].residuecxx . . $ coot/chem_feat_solvated_ligand#residue.; |
| 266 | if (res) { |
| 267 | mmdbcxx . . $ mmdb/::PAtomcxx . . $ mmdb/PAtom# *residue_atoms = 0; |
| 268 | int n_residue_atoms; |
| 269 | res->GetAtomTablecxx . . $ mmdb/Residue#GetAtomTable(9d9941bd98e0b231).(residue_atoms, n_residue_atoms); |
| 270 | for (int iat=0; iat<n_residue_atoms; iat++) { |
| 271 | clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# pt = lidia_utilscxx . . $ coot/lidia_utils/::cocxx . . $ coot/lidia_utils/co(83465a92f19cbf90).(residue_atoms[iat]); |
| 272 | v.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(pt); |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | return vcxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 278 | } |
| 279 | |
| 280 | bool |
| 281 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::is_close_to_a_ligand_atomcxx . . $ coot/chem_feat_clust#is_close_to_a_ligand_atom(e3a84b223a78d960).(const clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# &pt_test, |
| 282 | const stdcxx . . $ std/::vectorcxx . . $ std/vector#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#> &ligand_atom_positions) const { |
| 283 | |
| 284 | bool s = false; |
| 285 | double dc_sqrd = water_dist_cutoffcxx . . $ coot/chem_feat_clust#water_dist_cutoff. * water_dist_cutoffcxx . . $ coot/chem_feat_clust#water_dist_cutoff.; |
| 286 | for (unsigned int i=0; i<ligand_atom_positions.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) { |
| 287 | if (clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#(ligand_atom_positions[cxx . . $ std/vector#`operator[]`(c8255e0fa326ac32).i] -cxx . . $ clipper/operator-(44ad1d8741e04b17). pt_test).lengthsqcxx . . $ clipper/Coord_orth#lengthsq(21b6c25e127938e2).() < dc_sqrd) { |
| 288 | s = true; |
| 289 | break; |
| 290 | } |
| 291 | } |
| 292 | return s; |
| 293 | } |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | void |
| 299 | cootcxx . . $ coot/::chem_feat_clustcxx . . $ coot/chem_feat_clust#::aligncxx . . $ coot/chem_feat_clust#align(49f6e7a06ebc5aa8).() { |
| 300 | |
| 301 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "missing alignment fuction " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 302 | |
| 303 | } |
| 304 | |
| 305 | |
| 306 | #endif // MAKE_ENHANCED_LIGAND_TOOLS |