Debian Codegraph @

ligand/find-ligand.cc

raw symbols SCIP
1 /* ligand/find-ligands.cc
2 *
3 * Copyright 2004, 2005, 2006, 2007 The University of York
4 * Author: Paul Emsley
5 * Copyright 2007 The University of Oxford
6 * Copyright 2012, 2014 by Medical Research Council
7 * Author: Paul Emsley
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * 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 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301, USA.
23 */
24
25 // Portability (getopt) gubbins
26 #ifndef _MSC_VER
27 #include <unistd.h> // for getopt(3)
28 #endif
29
30 #ifndef _GNU_SOURCEcxx . . $ `<built-in>:481:9`!
31 #define _GNU_SOURCE
32 #endif
33
34 #ifdef __GNU_LIBRARY__cxx . . $ `<external>/18206667465210621810/features.h:510:9`!
35 #include "compat/coot-getopt.h"cxx . . $ `<file>/compat/coot-getopt.h`/
36 #else
37 #define __GNU_LIBRARY__
38 #include "compat/coot-getopt.h"
39 #undef __GNU_LIBRARY__
40 #endif
41
42 #include <iostream>
43 #include <string>
44 #include <stdexcept>
45
46 #include "utils/coot-utils.hh"cxx . . $ `<file>/utils/coot-utils.hh`/
47 #include "coot-utils/coot-coord-utils.hh"cxx . . $ `<file>/coot-utils/coot-coord-utils.hh`/
48 #include "wligand.hh"cxx . . $ `<file>/ligand/wligand.hh`/
49
50 void
51 do_just_conformerscxx . . $ do_just_conformers(448e1223d74ef93).(int n_conformers, const stdcxx . . $ std/::stringcxx . . $ std/string# &cif_file_name) {
52
53 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "INFO:: do-just-conformers " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). cif_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
54
55 // c.f. the ligand_search_make_conformers_internal() in src.
56
57 // the model will be extracted from the cif file
58 cootcxx . . $ coot/::protein_geometrycxx . . $ coot/protein_geometry# geomcxx . . $ coot/protein_geometry#protein_geometry(49f6e7a06ebc5aa8).;
59 cootcxx . . $ coot/::read_refmac_mon_lib_info_tcxx . . $ coot/read_refmac_mon_lib_info_t# rmit = geom.init_refmac_mon_libcxx . . $ coot/protein_geometry#init_refmac_mon_lib(278c00b5a38ac6e0).(cif_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., 10);
60 if (rmit.n_bondscxx . . $ coot/read_refmac_mon_lib_info_t#n_bonds. == 0) {
61 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "failed to parse cif " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). cif_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
62 } else {
63 // happy path
64 unsigned int n_threads = cootcxx . . $ coot/::get_max_number_of_threadscxx . . $ coot/get_max_number_of_threads(db52760e79bf9054).();
65 ctplcxx . . $ ctpl/::thread_poolcxx . . $ ctpl/thread_pool# thread_poolcxx . . $ ctpl/thread_pool#thread_pool(3e454b8ccf442868).(n_threads);
66 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> monomer_names = geom.monomer_typescxx . . $ coot/protein_geometry#monomer_types(491c255a7e496038).();
67 if (! monomer_names.emptycxx . . $ std/vector#empty(3482b152b9333168).()) {
68 stdcxx . . $ std/::stringcxx . . $ std/string# comp_id = monomer_namescxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)..backcxx . . $ std/vector#back(6baabfa6fc7b3a8e).();
69 int imol_enc = cootcxx . . $ coot/::protein_geometrycxx . . $ coot/protein_geometry#::IMOL_ENC_ANYcxx . . $ coot/protein_geometry#IMOL_ENC_ANY.;
70 stdcxx . . $ std/::paircxx . . $ std/pair#<bool, cootcxx . . $ coot/::dictionary_residue_restraints_tcxx . . $ coot/dictionary_residue_restraints_t#> rest = geom.get_monomer_restraintscxx . . $ coot/protein_geometry#get_monomer_restraints(a55f7295d433dd41).(comp_id, imol_enc);
71 if (rest.firstcxx . . $ std/pair#first.) {
72 try {
73 bool idealize_flag = true;
74 mmdbcxx . . $ mmdb/::Residuecxx . . $ mmdb/Residue# *residue_p = geom.get_residuecxx . . $ coot/protein_geometry#get_residue(be6d773c024dd61a).(comp_id, imol_enc, idealize_flag);
75 if (residue_p) {
76 cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::residuecxx . . $ coot/minimol/residue# mmrescxx . . $ coot/minimol/residue#residue(199c331f07f0c901).(residue_p);
77 // somewhat clumsy
78 cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::fragmentcxx . . $ coot/minimol/fragment# fragcxx . . $ coot/minimol/fragment#fragment(49f6e7a06ebc5aa8).;
79 frag.addresiduecxx . . $ coot/minimol/fragment#addresidue(429d90603f4ee4f0).(mmres, false);
80 cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# mmolcxx . . $ coot/minimol/molecule#molecule(ad195614e62a99c1).(frag);
81 cootcxx . . $ coot/::wligandcxx . . $ coot/wligand# wligcxx . . $ coot/wligand#wligand(49f6e7a06ebc5aa8).;
82 int imol_ligand = -1;
83 bool optim_geom = true;
84 bool fill_vec = true;
85 wlig.install_simple_wiggly_ligandscxx . . $ coot/wligand#install_simple_wiggly_ligands(9aeef2f1189788a7).(&geom, mmol, imol_ligand, n_conformers, optim_geom,
86 fill_vec, &thread_pool, n_threads);
87 stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule#> conformers = wlig.get_conformerscxx . . $ coot/wligand#get_conformers(dd990fe74b3e03bb).();
88 stdcxx . . $ std/::stringcxx . . $ std/string# file_name_stub = "conformer-" +cxx . . $ std/operator+(42c652dfebe55ad7). comp_id +cxx . . $ std/operator+(900ec9581c410ad9). "-";
89 for (unsigned int i=0; i<conformers.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) {
90 stdcxx . . $ std/::stringcxx . . $ std/string# fn = file_name_stub +cxx . . $ std/operator+(ee59693d670ab61e). stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(8c2ead51e4ae4fc6).(i) +cxx . . $ std/operator+(900ec9581c410ad9). ".pdb";
91 cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# m = conformers[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i];
92 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# c = m.centrecxx . . $ coot/minimol/molecule#centre(465b636ddbe0fc84).();
93 m.translatecxx . . $ coot/minimol/molecule#translate(61dba2504133ecd5).(-cxx . . $ clipper/operator-(fa49a7c8eefc15a4).c);
94 m.write_filecxx . . $ coot/minimol/molecule#write_file(d292696f89fe1693).(fncxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., 30.0f);
95 }
96 }
97 }
98 catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &mess) {
99 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Failed to install flexible ligands\n" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). mess.whatcxx . . $ std/runtime_error#what(ba32b354807b2b81).()
100 <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
101 }
102 } else {
103 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "failed to get monomer restraints for " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). comp_id <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
104 }
105 }
106 }
107 }
108
109 int
110 maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) {
111
112 if (argc < 4) {
113 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Usage: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
114 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --pdbin pdb-in-filename" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --hklin mtz-filename" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
115 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --f f_col_label" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --phi phi_col_label" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
116 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --clusters nclust" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
117 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --sigma sigma-level" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
118 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --absolute level" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
119 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --fit-fraction frac" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
120 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --flexible" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
121 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --samples nsamples" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
122 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --sampling-rate map-sampling-rate" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
123 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --dictionary cif-dictionary-name" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
124 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --just-conformers (no fitting, just make conformers)" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
125 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --mmcif (output files in mmcif) " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n "
126 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --script script-file-name\n"
127 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " ligand-coordinates-file-name(s)\n";
128 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " where pdbin is the protein (typically)\n"
129 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " nclust is the number of clusters to fit [default 10]\n"
130 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sigma is the search level of the map (default 2.0)\n"
131 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " or specify --absolute and pass level in e/A^3\n"
132 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --flexible means use torsional conformation ligand search\n"
133 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " --dictionary file containing the CIF ligand dictionary description\n"
134 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " nsamples is the number of flexible conformation samples [default 30]\n"
135 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " frac is the minimum fraction of atoms in density allowed after fit [default 0.75]\n"
136 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " script-file-name is a file name of helper script suitable for use in Coot\n"
137 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " (default: coot-ligands.scm)."
138 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " just-conformers means just generate and write out the conformers - no density search\n"
139 <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
140
141 } else {
142
143 int n_used_args = 1;
144 stdcxx . . $ std/::stringcxx . . $ std/string# pdb_file_namecxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
145 stdcxx . . $ std/::stringcxx . . $ std/string# mtz_filenamecxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
146 stdcxx . . $ std/::stringcxx . . $ std/string# f_colcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
147 stdcxx . . $ std/::stringcxx . . $ std/string# phi_colcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
148 stdcxx . . $ std/::stringcxx . . $ std/string# sigma_strcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
149 stdcxx . . $ std/::stringcxx . . $ std/string# n_cluster_stringcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
150 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lig_filescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
151 short int use_wiggly_ligand = 0;
152 int wiggly_ligand_n_samples = 30;
153 stdcxx . . $ std/::stringcxx . . $ std/string# cif_file_name = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
154 stdcxx . . $ std/::stringcxx . . $ std/string# fit_frac_str = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
155 stdcxx . . $ std/::stringcxx . . $ std/string# coot_ligands_script_file_name = "coot-ligands.scm"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
156 float fit_frac = -1.0; // tested for positivity
157 bool set_absolute = 0;
158 stdcxx . . $ std/::stringcxx . . $ std/string# absolute_string = ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
159 bool blobs_mode = false;
160 float map_sampling_factor = 1.5;
161 stdcxx . . $ std/::stringcxx . . $ std/string# map_sampling_factor_strcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).;
162 bool just_conformers_flag = false;
163 bool output_files_in_mmcif = false;
164
165 // These hold the coordinates of a particular position. The
166 // bool is whether they were set in the input or not. Only of
167 // all 3 are set will findligand search in a particular position
168 // (pretty obviously).
169 //
170 stdcxx . . $ std/::paircxx . . $ std/pair#<bool,float> pos_xcxx . . $ std/pair#pair(62e1774a2dc03c82).(0, 0.0), pos_ycxx . . $ std/pair#pair(62e1774a2dc03c82).(0, 0.0), pos_zcxx . . $ std/pair#pair(62e1774a2dc03c82).(0, 0.0);
171
172 const char *optstr = "i:h:f:p:s:c:w:n:d";
173 struct optioncxx . . $ option# long_options[] = {
174 {"pdbin", 1, 0, 0},
175 {"hklin", 1, 0, 0},
176 {"f", 1, 0, 0},
177 {"phi", 1, 0, 0},
178 {"sigma", 1, 0, 0},
179 {"absolute", 1, 0, 0},
180 {"mmcif", 0, 0, 0},
181 {"clusters", 1, 0, 0},
182 {"samples", 1, 0, 0},
183 {"dictionary", 1, 0, 0},
184 {"fit-fraction", 1, 0, 0},
185 {"flexible", 0, 0, 0},
186 {"script", 0, 0, 0},
187 {"blobs", 0, 0, 0},
188 {"just-conformers", 0, 0, 0},
189 {"sampling-factor", 1, 0, 0},
190 {"pos-x", 1, 0, 0},
191 {"pos-y", 1, 0, 0},
192 {"pos-z", 1, 0, 0},
193 {0, 0, 0, 0}
194 };
195
196 int ch;
197 int option_index = 0;
198 while ( -1 !=
199 (ch = coot_getopt_longcxx . . $ coot_getopt_long(41f665c090816971).(argc, argv, optstr, long_options, &option_index))) {
200
201 switch(ch) {
202
203 case 0:
204 if (coot_optargcxx . . $ coot_optarg.) {
205
206 // std::cout << "DEBUG:: " << option_index << " " << strlen(coot_optarg) << std::endl;
207 // std::cout << " " << coot_optarg << std::endl;
208 // std::cout << " ch:: " << ch << std::endl;
209
210 stdcxx . . $ std/::stringcxx . . $ std/string# arg_str = long_optionscxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[option_index].namecxx . . $ option#name.;
211
212 // std::cout << " considering arg_str :" << arg_str << ":\n";
213
214 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pdbin") {
215 pdb_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
216 n_used_args += 2;
217 }
218 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pdb") {
219 pdb_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
220 n_used_args += 2;
221 }
222 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "hklin") {
223 mtz_filename =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
224 n_used_args += 2;
225 }
226 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "f") {
227 f_col =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
228 n_used_args += 2;
229 }
230 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "phi") {
231 phi_col =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
232 n_used_args += 2;
233 }
234 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sigma") {
235 sigma_str =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
236 n_used_args += 2;
237 }
238 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "absolute") {
239 absolute_string =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
240 set_absolute = 1;
241 n_used_args += 2;
242 }
243 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "clusters") {
244 n_cluster_string =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
245 n_used_args += 2;
246 }
247
248 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "samples") {
249 wiggly_ligand_n_samples = atoi(coot_optargcxx . . $ coot_optarg.);
250 n_used_args += 2;
251 }
252
253 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "dictionary") {
254 cif_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
255 n_used_args += 2;
256 }
257
258 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "sampling-factor") {
259 map_sampling_factor_str =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
260 n_used_args += 2;
261 }
262
263 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "fit-fraction") {
264 fit_frac_str =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
265 n_used_args += 2;
266 }
267
268 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "script") {
269 coot_ligands_script_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
270 n_used_args += 2;
271 }
272
273 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pos-x" || arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pos-y" || arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pos-z") {
274 try {
275 float v = cootcxx . . $ coot/::utilcxx . . $ coot/util/::string_to_floatcxx . . $ coot/util/string_to_float(102f6ade4638bb18).(coot_optargcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
276 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pos-x")
277 pos_x =cxx . . $ std/pair#`operator=`(ab9ebd0b824095ec). stdcxx . . $ std/pair#pair(62e1774a2dc03c82).::paircxx . . $ std/pair#<bool, float> (1, v);
278 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pos-y")
279 pos_y =cxx . . $ std/pair#`operator=`(ab9ebd0b824095ec). stdcxx . . $ std/pair#pair(62e1774a2dc03c82).::paircxx . . $ std/pair#<bool, float> (1, v);
280 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "pos-z")
281 pos_z =cxx . . $ std/pair#`operator=`(ab9ebd0b824095ec). stdcxx . . $ std/pair#pair(62e1774a2dc03c82).::paircxx . . $ std/pair#<bool, float> (1, v);
282 }
283 catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &rte) {
284 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING:: Failed to convert " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). arg_str <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " to a number"
285 <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
286 }
287 n_used_args += 2;
288 }
289
290 } else {
291
292 // options without arguments:
293
294 // long argument without parameter:
295 stdcxx . . $ std/::stringcxx . . $ std/string# arg_strcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(long_options[option_index].namecxx . . $ option#name.);
296
297 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "flexible") {
298 use_wiggly_ligand = 1;
299 n_used_args += 1;
300 }
301
302 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "blobs") {
303 blobs_mode = true;
304 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "set blobs mode " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
305 n_used_args++;
306 }
307
308 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "just-conformers") {
309 just_conformers_flag = true;
310 n_used_args++;
311 }
312
313 if (arg_str ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "mmcif") {
314 output_files_in_mmcif = true;
315 n_used_args++;
316 }
317
318 }
319 break;
320
321 case 'i':
322 pdb_file_name =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
323 n_used_args += 2;
324 break;
325
326 case 'h':
327 mtz_filename =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
328 n_used_args += 2;
329 break;
330
331 case 'f':
332 f_col =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
333 n_used_args += 2;
334 break;
335
336 case 'p':
337 phi_col =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
338 n_used_args += 2;
339 break;
340
341 case 's':
342 sigma_str =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
343 n_used_args += 2;
344 break;
345
346 case 'c':
347 n_cluster_string =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). coot_optargcxx . . $ coot_optarg.;
348 n_used_args += 2;
349 break;
350
351 default:
352 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "default coot_optarg: " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). coot_optargcxx . . $ coot_optarg. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
353 break;
354 }
355 }
356
357 if (just_conformers_flag) {
358 // the model is in the cif file
359 do_just_conformerscxx . . $ do_just_conformers(448e1223d74ef93).(wiggly_ligand_n_samples, cif_file_name);
360 exit(0);
361 }
362
363 bool do_it = false;
364 if (pdb_file_name.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
365 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Missing input PDB file\n";
366 exit(1);
367 } else {
368 if (mtz_filename.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
369 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Missing MTZ file\n";
370 exit(1);
371 } else {
372 if (f_col.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
373 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Missing F column name\n";
374 exit(1);
375 } else {
376 if (phi_col.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
377 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Missing PHI column name\n";
378 exit(1);
379 } else {
380 if (sigma_str.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
381 sigma_str =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "2.0";
382 }
383 if (n_cluster_string.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
384 n_cluster_string =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). "10";
385 }
386
387 // std::cout << "------------ argc: " << argc << " n_used_args: "
388 // << n_used_args << std::endl;
389
390 // 20140520 What was I thinking? The last argument
391 // is the one where the ligand pdb file is. Now we
392 // check all the arguments.
393 //
394 // for (int i=n_used_args; i<(argc-1); i++)
395
396 for (int i=n_used_args; i<argc; i++) {
397 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "----- pushing back ligand file name \"" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[i] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\""
398 <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
399 lig_files.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(argvcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[i]);
400 }
401 do_it = true;
402 }
403 }
404 }
405 }
406
407 if (do_it) {
408
409 if ((lig_files.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() == 0) && ! blobs_mode) {
410 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "No ligand pdb files specified\n";
411 exit(1);
412
413 } else {
414
415 if (fit_frac_str != "") { // it was set
416 fit_frac = atof(fit_frac_str.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
417 } else {
418 fit_frac = 0.75;
419 }
420 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "INFO:: Using acceptable fit fraction of: " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). fit_frac <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
421 float input_sigma_level = 2.0;
422 try {
423 input_sigma_level = cootcxx . . $ coot/::utilcxx . . $ coot/util/::string_to_floatcxx . . $ coot/util/string_to_float(102f6ade4638bb18).(sigma_str);
424 }
425 catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &rte) {
426 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). rte.whatcxx . . $ std/runtime_error#what(ba32b354807b2b81).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " - using default 2.0 sigma";
427 }
428
429 short int use_weights = 0;
430 short int is_diff_map = 0;
431 cootcxx . . $ coot/::wligandcxx . . $ coot/wligand# wligcxx . . $ coot/wligand#wligand(49f6e7a06ebc5aa8).;
432 // wlig.set_verbose_reporting();
433
434 // sampling rate
435 if (! map_sampling_factor_str.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) {
436 try {
437 map_sampling_factor = cootcxx . . $ coot/::utilcxx . . $ coot/util/::string_to_floatcxx . . $ coot/util/string_to_float(102f6ade4638bb18).(map_sampling_factor_str);
438 }
439 catch(const stdcxx . . $ std/::exception &e) {
440 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "failed to convert " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). map_sampling_factor_str <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
441 }
442 }
443
444
445 if (! use_wiggly_ligand) {
446
447 // rigid ligands path
448
449 short int map_stat = wlig.map_fill_from_mtzcxx . . $ coot/ligand#map_fill_from_mtz(a5e4c650d1302cad).(mtz_filenamecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., f_colcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., phi_colcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
450 use_weights, is_diff_map,
451 map_sampling_factor);
452
453 // Now we have the map, we can the convert absolute level (if it was set by
454 // the user to absolute) which is what the interface to the ligand class
455 // want to be passed).
456 //
457 if (set_absolute) {
458 try {
459 float ab = cootcxx . . $ coot/::utilcxx . . $ coot/util/::string_to_floatcxx . . $ coot/util/string_to_float(102f6ade4638bb18).(absolute_string);
460 clippercxx . . $ clipper/::Map_statscxx . . $ clipper/Map_stats# stats = wlig.map_statisticscxx . . $ coot/ligand#map_statistics(a02896074cf43ad6).();
461 input_sigma_level = ab/stats.std_devcxx . . $ clipper/Map_stats#std_dev(cb83ef2068996cec).();
462 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Masking with level " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). absolute_string <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "("
463 <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). input_sigma_level <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sigma)" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
464 }
465 catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &rte) {
466 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). rte.whatcxx . . $ std/runtime_error#what(ba32b354807b2b81).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
467 }
468 }
469
470 if (map_stat == 0) {
471 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Map making failure." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
472 } else {
473 wlig.mask_by_atomscxx . . $ coot/ligand#mask_by_atoms(89800cbf2a9b278f).(pdb_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).);
474 if (wlig.masking_molecule_has_atomscxx . . $ coot/ligand#masking_molecule_has_atoms(524863554b4a534e).()) {
475 wlig.set_acceptable_fit_fractioncxx . . $ coot/ligand#set_acceptable_fit_fraction(9364e6e7bff7660).(fit_frac);
476 // lig.output_map("find-ligands-masked.map"); // debugging
477
478 if (pos_x.firstcxx . . $ std/pair#first. && pos_y.firstcxx . . $ std/pair#first. && pos_z.firstcxx . . $ std/pair#first.) {
479
480 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# ptcxx . . $ clipper/Coord_orth#Coord_orth(3374d1a184fcc02e).(pos_x.secondcxx . . $ std/pair#second., pos_y.secondcxx . . $ std/pair#second., pos_z.secondcxx . . $ std/pair#second.);
481 wlig.cluster_from_pointcxx . . $ coot/ligand#cluster_from_point(7b4faa4c1ce0ced8).(pt, input_sigma_level);
482 wlig.fit_ligands_to_clusterscxx . . $ coot/ligand#fit_ligands_to_clusters(d4f767463ce0a6b3).(1); // just this cluster.
483
484 } else {
485
486 if (blobs_mode) {
487 int n_cycles = 1;
488 wlig.water_fitcxx . . $ coot/ligand#water_fit(1746e8aa98ca1bc0).(input_sigma_level, n_cycles);
489 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth#, double> > big_blobs = wlig.big_blobscxx . . $ coot/ligand#big_blobs(99817c873cdd3615).();
490 unsigned int n_big_blobs = big_blobs.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();
491 if (n_big_blobs) {
492 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "=============== start blob-table ==========\n";
493 for (unsigned int i=0; i<n_big_blobs; i++) {
494 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " blob " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). i <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). big_blobs[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].firstcxx . . $ std/pair#first..formatcxx . . $ clipper/Coord_orth#format(9c83e4702554ac51).()
495 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sum: " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). big_blobs[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i].secondcxx . . $ std/pair#second. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
496 }
497 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "=============== end blob-table ==========\n";
498 }
499 } else {
500 wlig.find_clusterscxx . . $ coot/ligand#find_clusters(9364e6e7bff7660).(input_sigma_level);
501 }
502 }
503 // install ligands:
504 for (unsigned int ilig=0; ilig<lig_files.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); ilig++)
505 wlig.install_ligandcxx . . $ coot/ligand#install_ligand(8d4ab0a187bf9331).(lig_filescxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig]);
506 wlig.fit_ligands_to_clusterscxx . . $ coot/ligand#fit_ligands_to_clusters(d4f767463ce0a6b3).(10);
507 } else {
508 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "No atoms found in masking molecule: "
509 <<cxx . . $ std/`operator<<`(88df5bef833f7f83). pdb_file_name <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
510 }
511 }
512
513 } else {
514
515 // wiggly ligands path
516
517 cootcxx . . $ coot/::protein_geometrycxx . . $ coot/protein_geometry# geomcxx . . $ coot/protein_geometry#protein_geometry(49f6e7a06ebc5aa8).;
518 // wlig.set_verbose_reporting();
519
520 // this might be a pain if the flexible ligand is in the standard
521 // refmac dictionary...
522 if (cif_file_name.lengthcxx . . $ std/__cxx11/basic_string#length(7e80fff40d76986b).() == 0) {
523 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "No cif dictionary file given\n";
524 } else {
525 // geom.init_standard();
526 cootcxx . . $ coot/::read_refmac_mon_lib_info_tcxx . . $ coot/read_refmac_mon_lib_info_t# rmit = geom.init_refmac_mon_libcxx . . $ coot/protein_geometry#init_refmac_mon_lib(278c00b5a38ac6e0).(cif_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., 10);
527 if (rmit.n_bondscxx . . $ coot/read_refmac_mon_lib_info_t#n_bonds. == 0) {
528 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Critical cif dictionary reading failure." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
529 } else {
530 short int map_stat = wlig.map_fill_from_mtzcxx . . $ coot/ligand#map_fill_from_mtz(a5e4c650d1302cad).(mtz_filenamecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., f_colcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., phi_colcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., ""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
531 use_weights, is_diff_map,
532 map_sampling_factor);
533
534 // Now we have the map, we can the convert absolute level (if it was set by
535 // the user to absolute) which is what the interface to the ligand class
536 // want to be passed).
537 //
538 if (set_absolute) {
539 try {
540 float ab = cootcxx . . $ coot/::utilcxx . . $ coot/util/::string_to_floatcxx . . $ coot/util/string_to_float(102f6ade4638bb18).(absolute_string);
541 clippercxx . . $ clipper/::Map_statscxx . . $ clipper/Map_stats# stats = wlig.map_statisticscxx . . $ coot/ligand#map_statistics(a02896074cf43ad6).();
542 input_sigma_level = ab/stats.std_devcxx . . $ clipper/Map_stats#std_dev(cb83ef2068996cec).();
543 }
544 catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &rte) {
545 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). rte.whatcxx . . $ std/runtime_error#what(ba32b354807b2b81).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
546 }
547 }
548
549
550 if (map_stat == 0) {
551 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Map making failure." <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
552 } else {
553
554 wlig.mask_by_atomscxx . . $ coot/ligand#mask_by_atoms(89800cbf2a9b278f).(pdb_file_namecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).);
555 if (wlig.masking_molecule_has_atomscxx . . $ coot/ligand#masking_molecule_has_atoms(524863554b4a534e).()) {
556 wlig.output_mapcxx . . $ coot/ligand#output_map(fcf609cc4b7f1549).("find-ligands-masked.map"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
557 wlig.set_acceptable_fit_fractioncxx . . $ coot/ligand#set_acceptable_fit_fraction(9364e6e7bff7660).(fit_frac);
558
559
560 if (pos_x.firstcxx . . $ std/pair#first. && pos_y.firstcxx . . $ std/pair#first. && pos_z.firstcxx . . $ std/pair#first.) {
561
562 clippercxx . . $ clipper/::Coord_orthcxx . . $ clipper/Coord_orth# ptcxx . . $ clipper/Coord_orth#Coord_orth(3374d1a184fcc02e).(pos_x.secondcxx . . $ std/pair#second., pos_y.secondcxx . . $ std/pair#second., pos_z.secondcxx . . $ std/pair#second.);
563 wlig.cluster_from_pointcxx . . $ coot/ligand#cluster_from_point(7b4faa4c1ce0ced8).(pt, input_sigma_level);
564 wlig.fit_ligands_to_clusterscxx . . $ coot/ligand#fit_ligands_to_clusters(d4f767463ce0a6b3).(1); // just this cluster.
565
566 } else {
567 wlig.find_clusterscxx . . $ coot/ligand#find_clusters(9364e6e7bff7660).(input_sigma_level);
568
569 }
570
571 // install wiggly ligands...
572 //
573 // wiggly ligands currently have to be minimols
574 for (unsigned int ilig=0; ilig<lig_files.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); ilig++) {
575 cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# mmolcxx . . $ coot/minimol/molecule#molecule(49f6e7a06ebc5aa8).;
576 mmol.read_filecxx . . $ coot/minimol/molecule#read_file(89800cbf2a9b278f).(lig_filescxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).ilig]);
577
578 bool optim_geom = true;
579 bool fill_vec = false;
580 try {
581 unsigned int n_threads = cootcxx . . $ coot/::get_max_number_of_threadscxx . . $ coot/get_max_number_of_threads(db52760e79bf9054).();
582 ctplcxx . . $ ctpl/::thread_poolcxx . . $ ctpl/thread_pool# thread_poolcxx . . $ ctpl/thread_pool#thread_pool(3e454b8ccf442868).(n_threads);
583 int imol_ligand = 0;
584 stdcxx . . $ std/::vectorcxx . . $ std/vector#<cootcxx . . $ coot/::installed_wiggly_ligand_info_tcxx . . $ coot/installed_wiggly_ligand_info_t#>
585 wiggled_ligands =
586 wlig.install_simple_wiggly_ligandscxx . . $ coot/wligand#install_simple_wiggly_ligands(9aeef2f1189788a7).(&geom, mmol,
587 imol_ligand,
588 wiggly_ligand_n_samples,
589 optim_geom,
590 fill_vec, &thread_pool, n_threads);
591 }
592 catch (const stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error# &mess) {
593 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Failed to install flexible ligands\n" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). mess.whatcxx . . $ std/runtime_error#what(ba32b354807b2b81).()
594 <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).;
595 }
596 }
597 wlig.fit_ligands_to_clusterscxx . . $ coot/ligand#fit_ligands_to_clusters(d4f767463ce0a6b3).(10);
598 }
599 }
600 }
601 }
602 }
603
604 // what are the results?
605
606 // now add in the solution ligands:
607 int n_clusters = wlig.n_clusters_finalcxx . . $ coot/ligand#n_clusters_final(ddd8539a2fcdd4ce).();
608
609 cootcxx . . $ coot/::minimolcxx . . $ coot/minimol/::moleculecxx . . $ coot/minimol/molecule# mcxx . . $ coot/minimol/molecule#molecule(49f6e7a06ebc5aa8).;
610 for (int iclust=0; iclust<n_clusters; iclust++) {
611
612 // frac_lim is the fraction of the score of the best solutions
613 // that we should consider as solutions. 0.5 is generous, I
614 // think.
615 float frac_lim = 0.7;
616 float correl_frac_lim = 0.9;
617
618 // nino-mode
619 unsigned int nlc = 1;
620 wlig.score_and_resort_using_correlationcxx . . $ coot/ligand#score_and_resort_using_correlation(b4d55b1286ff73e8).(iclust, nlc);
621
622 correl_frac_lim = 0.975;
623
624 if (nlc > 12) nlc = 12; // arbitrary limit of max 12 solutions per cluster
625 float tolerance = 20.0;
626 // limit_solutions should be run only after a post-correlation sort.
627 //
628 wlig.limit_solutionscxx . . $ coot/ligand#limit_solutions(6a26d941d6978d57).(iclust, correl_frac_lim, nlc, tolerance, true);
629
630 for (unsigned int isol=0; isol<nlc; isol++) {
631
632 m =cxx . . $ coot/minimol/molecule#`operator=`(a44e414b04cd4faa). wlig.get_solutioncxx . . $ coot/ligand#get_solution(b41068f31d21093).(isol, iclust);
633 if (! m.is_emptycxx . . $ coot/minimol/molecule#is_empty(50ce9a9e25b4a850).()) {
634 mmdbcxx . . $ mmdb/::Managercxx . . $ mmdb/Manager# *ligand_mol = m.pcmmdbmanagercxx . . $ coot/minimol/molecule#pcmmdbmanager(6b2d30ba321e06d6).();
635 cootcxx . . $ coot/::hetify_residues_as_neededcxx . . $ coot/hetify_residues_as_needed(ad6320eb32428dbf).(ligand_mol);
636
637 stdcxx . . $ std/::stringcxx . . $ std/string# ext = ".pdb"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;
638 if (output_files_in_mmcif) ext =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). ".cif";
639
640 stdcxx . . $ std/::stringcxx . . $ std/string# file_name = "fitted-ligand-" +cxx . . $ std/operator+(39ed2c165380f78e).
641 cootcxx . . $ coot/::utilcxx . . $ coot/util/::int_to_stringcxx . . $ coot/util/int_to_string(7eb93f795f0defb3).(iclust) +cxx . . $ std/operator+(aa1c00e85b87da6b). stdcxx . . $ std/::stringcxx . . $ std/string#("-") +cxx . . $ std/operator+(aa1c00e85b87da6b).
642 cootcxx . . $ coot/::utilcxx . . $ coot/util/::int_to_stringcxx . . $ coot/util/int_to_string(7eb93f795f0defb3).(isol) +cxx . . $ std/operator+(db5dc2ea912c6495). ext;
643 if (output_files_in_mmcif)
644 ligand_mol->WriteCIFASCIIcxx . . $ mmdb/Root#WriteCIFASCII(9eb88f3d8809bd24).(file_name.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
645 else
646 ligand_mol->WritePDBASCIIcxx . . $ mmdb/Root#WritePDBASCII(9eb88f3d8809bd24).(file_name.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).());
647 }
648 }
649 }
650 }
651 }
652 }
653 return 0;
654 }