libcootapi
 
Loading...
Searching...
No Matches
/opt/conda/conda-bld/coot-headless_1766554182969/work/api/molecules-container.hh
1
2#ifndef MOLECULES_CONTAINER_HH
3#define MOLECULES_CONTAINER_HH
4
5#include <memory>
6#ifdef SWIG
7#include "Python.h"
8#endif
9
10#include <vector>
11
12#ifdef HAVE_SSMLIB
13#include <ssm/ssm_align.h>
14#endif
15
16#if NB_VERSION_MAJOR // for flychecking
17#include <nanobind/nanobind.h>
18#endif
19
20#include "compat/coot-sysdep.h"
21
22#include "coords/Cartesian.hh"
23#include "coords/ramachandran-container.hh"
24#include "coot-molecule.hh"
25#include "coot-utils/coot-rama.hh"
26#include "coot-utils/coot-coord-extras.hh" // the missing atoms type
27#include "coot-utils/coot-map-utils.hh"
28#include "utils/coot-utils.hh"
29#include "utils/setup-syminfo.hh"
30#include "ideal/simple-restraint.hh" // needed?
31#include "atom-pull.hh"
32#include "validation-information.hh"
33#include "superpose-results.hh"
34#include "lsq-results.hh"
35#include "coot-utils/simple-mesh.hh"
36#include "coot-utils/texture-as-floats.hh"
37#include "phi-psi-prob.hh"
38#include "instancing.hh"
39#include "coot-colour.hh" // put this in utils
40#include "saved-strand-info.hh"
41#include "svg-store-key.hh"
42#include "moorhen-h-bonds.hh"
43#include "header-info.hh"
44#include "positioned-atom-spec.hh"
45#include "user-defined-colour-table.hh"
46
49
50 std::vector<coot::molecule_t> molecules;
51 coot::protein_geometry geom;
52 coot::rotamer_probability_tables rot_prob_tables;
53 ramachandrans_container_t ramachandrans_container;
54 static std::atomic<bool> on_going_updating_map_lock;
55 bool draw_missing_residue_loops_flag;
56
57 class rail_points_t {
58 public:
59 int model_rail_points_delta; // for the latest change, I mean
60 int map_rail_points_delta;
61 float rmsd_of_difference_map;
62 explicit rail_points_t(float rmsd) {
63 model_rail_points_delta = 0;
64 map_rail_points_delta = 0;
65 rmsd_of_difference_map = rmsd;
66 }
67 rail_points_t(float rmsd_diff_map_current, const rail_points_t &rail_points_prev) {
68 model_rail_points_delta = 0;
69 rmsd_of_difference_map = rmsd_diff_map_current;
70 map_rail_points_delta = rail_points_delta(rail_points_prev);
71 }
72 int rail_points_delta(const rail_points_t &prev) {
73 float fudge = 2.4; // 20230117-PE makes 1000 rail points equal ~1% in R-factor for the tutorial data
74 return int(100000.0 * fudge * (prev.rmsd_of_difference_map - rmsd_of_difference_map));
75 }
76 static int total(const std::vector<rail_points_t> &rail_point_history) {
77 int sum = 0;
78 for (const auto &item : rail_point_history) {
79 sum += item.map_rail_points_delta;
80 }
81 return sum;
82 }
83 };
84 std::vector<rail_points_t> rail_point_history; // map and model (model currently not used)
85
86 class updating_maps_info_f {
87 public:
88 bool maps_need_an_update;
89 int imol_model;
90 int imol_2fofc;
91 int imol_fofc;
92 int imol_with_data_info_attached;
93 updating_maps_info_f() {
94 maps_need_an_update = false;
95 imol_model = -1;
96 imol_2fofc = -1;
97 imol_fofc = -1;
98 imol_with_data_info_attached = -1;
99 }
100 };
101#ifdef SKIP_FOR_PYTHON_DOXYGEN
102#else
108 updating_maps_info_f updating_maps_info;
109 void set_updating_maps_need_an_update(int imol);
110 // Checks the above information before acting, of course.
111 // No action if imol is the the model for updating maps.
112
116 void update_updating_maps(int imol); // called from the get_map_contours_mesh() function
117
118 coot::util::sfcalc_genmap_stats_t latest_sfcalc_stats;
119#endif
120 // --------------------- superposition --------------------------
121
122 // --------------------- refinement --------------------------
123
124 // 201803004:
125 // refinement now uses references to Xmaps.
126 // A dummy_map is created and a reference to that is created. Then
127 // the reference is reset to a real xmap in a molecule (imol_for_map).
128 // But, for a reason I don't understand, the refinement crashes when I do that.
129 // When the initial dummy_xmap doesn't go out of scope, then the refinement is OK.
130 // So this static dummy map is the map that doesn't go out of scope.
131 // We only need one of it, so it goes here, rather than get created every
132 // time we do a refinement. It may need to be public in future.
133 //
134 // 20221018-PE:
135 // Now that we are in api, then I am now no longer sure that this should be static
136 // or what static means in WebAssembly.
137 static clipper::Xmap<float> *dummy_xmap;
138 float map_weight;
139 float geman_mcclure_alpha;
140
141 bool use_rama_plot_restraints;
142 float rama_plot_restraints_weight;
143
144 bool use_torsion_restraints;
145 float torsion_restraints_weight;
146
147 ctpl::thread_pool thread_pool;
148 bool show_timings;
149
150 coot::restraints_container_t *last_restraints;
151 bool continue_threaded_refinement_loop;
152 bool refinement_is_quiet;
153 int cif_dictionary_read_number;
154
158 std::string adjust_refinement_residue_name(const std::string &resname) const;
159#ifdef DOXYGEN_SHOULD_PARSE_THIS
160#else
161 bool make_last_restraints(const std::vector<std::pair<bool,mmdb::Residue *> > &local_residues,
162 const std::vector<mmdb::Link> &links,
163 const coot::protein_geometry &geom,
164 mmdb::Manager *mol_for_residue_selection,
165 const std::vector<coot::atom_spec_t> &fixed_atom_specs,
166 coot::restraint_usage_Flags flags,
167 bool use_map_flag,
168 const clipper::Xmap<float> *xmap_p);
169 coot::refinement_results_t refine_residues_vec(int imol,
170 const std::vector<mmdb::Residue *> &residues,
171 const std::string &alt_conf,
172 mmdb::Manager *mol);
173
174 atom_selection_container_t make_moving_atoms_asc(mmdb::Manager *residues_mol,
175 const std::vector<mmdb::Residue *> &residues) const;
176
177 int find_serial_number_for_insert(int seqnum_new,
178 const std::string &ins_code_for_new,
179 mmdb::Chain *chain_p) const;
180
181 // return 0 if any of the residues in selection don't have (at least) bond
182 // restraints. Try to auto-load the dictionary cifs and try again.
183 // The vector is a list of residues for which no restraints could be found.
184
185 std::pair<int, std::vector<std::string> >
186 check_dictionary_for_residue_restraints(int imol, mmdb::PResidue *SelResidues, int nSelResidues);
187
188 std::pair<int, std::vector<std::string> >
189 check_dictionary_for_residue_restraints(int imol, const std::vector<mmdb::Residue *> &residues);
190
191 std::pair<mmdb::Manager *, std::vector<mmdb::Residue *> >
192 create_mmdbmanager_from_res_vector(const std::vector<mmdb::Residue *> &residues,
193 int imol,
194 mmdb::Manager *mol_in,
195 std::string alt_conf);
196
197 // simple mmdb::Residue * interface to refinement. 20081216
198 coot::refinement_results_t
199 generate_molecule_and_refine(int imol, // needed for UDD Atom handle transfer
200 const std::vector<mmdb::Residue *> &residues,
201 const std::string &alt_conf,
202 mmdb::Manager *mol,
203 bool use_map_flag=true);
204
205 static void thread_for_refinement_loop_threaded();
206
207 static std::atomic<bool> restraints_lock;
208 static void get_restraints_lock(const std::string &calling_function_name);
209 static void release_restraints_lock(const std::string &calling_function_name);
210 static std::string restraints_locking_function_name; // static because it is set by above
211
212 bool particles_have_been_shown_already_for_this_round_flag;
213
214#ifdef DOXYGEN_SHOULD_PARSE_THIS
215#else
216 int servalcat_refine_xray_internal(int imol, int imol_map, const std::string &output_prefix,
217 const std::map<std::string, std::string> &key_value_pairs);
218#endif
219
220
221#ifdef SKIP_FOR_PYTHON_DOXYGEN
222#else
227 std::pair<short int, clipper::RTop_orth> get_lsq_matrix_internal(int imol_ref, int imol_mov, bool summary_to_screen) const;
228#endif
229
231 get_q_score_validation_information(mmdb::Manager *mol, int udd_q_score, bool do_per_atom) const;
232
233#endif
234
235
236 bool refinement_immediate_replacement_flag = true;
237 int imol_moving_atoms;
238 enum moving_atoms_asc_t {
239 NEW_COORDS_UNSET = 0, // moving_atoms_asc_type values
240 NEW_COORDS_ADD = 1, // not used?
241 NEW_COORDS_REPLACE = 2,
242 NEW_COORDS_REPLACE_CHANGE_ALTCONF = 3,
243 NEW_COORDS_INSERT = 4,
244 NEW_COORDS_INSERT_CHANGE_ALTCONF = 5};
245 short int moving_atoms_asc_type;
246
247#ifdef DOXYGEN_SHOULD_PARSE_THIS
248#else
249 static void all_atom_pulls_off();
250 static std::vector<atom_pull_info_t> atom_pulls;
251 // nanobinds doesn't have a atom_spec_t, does it?
252 static void atom_pull_off(const coot::atom_spec_t &spec);
253 static void atom_pulls_off(const std::vector<coot::atom_spec_t> &specs);
254#endif
255
256#ifdef DOXYGEN_SHOULD_PARSE_THIS
257#else
258 std::vector<std::pair<mmdb::Residue *, std::vector<coot::dict_torsion_restraint_t> > > make_rotamer_torsions(const std::vector<std::pair<bool, mmdb::Residue *> > &local_residues) const;
259#endif
260
269
270#ifdef DOXYGEN_SHOULD_PARSE_THIS
271#else
273 int refine_direct(int imol, std::vector<mmdb::Residue *> rv, const std::string &alt_loc, int n_cycles);
274
276 double phi_psi_probability(const coot::util::phi_psi_t &phi_psi, const ramachandrans_container_t &rc) const;
277#endif
278
279#ifdef SKIP_FOR_PYTHON_DOXYGEN
280#else
282 void read_standard_residues();
283
284 std::map<svg_store_key_t, std::string> ligand_svg_store;
285
286 atom_selection_container_t standard_residues_asc;
287#endif
288
289#ifdef DOXYGEN_SHOULD_PARSE_THIS
290#else
291
292 coot::graph_match_info_t overlap_ligands_internal(int imol_ligand, int imol_ref, const std::string &chain_id_ref,
293 int resno_ref, bool apply_rtop_flag);
294
295 int install_model(const coot::molecule_t &m);
296
298 superpose_with_atom_selection(atom_selection_container_t asc_ref,
299 atom_selection_container_t asc_mov,
300 int imol_mov,
301 std::string moving_mol_name,
302 std::string reference_mol_name,
303 bool move_copy_of_imol2_flag);
304#endif
305
306#ifdef HAVE_SSMLIB
307
308 void print_ssm_sequence_alignment(ssm::Align *SSMAlign,
309 atom_selection_container_t asc_ref,
310 atom_selection_container_t asc_mov,
311 mmdb::PAtom *atom_selection1,
312 mmdb::PAtom *atom_selection2,
313 int n_selected_atoms_1, int n_selected_atoms_2,
314 bool move_copy_of_imol2_flag);
315
317 make_ssm_sequence_alignment_as_validation_information(ssm::Align *SSMAlign,
318 atom_selection_container_t asc_ref,
319 atom_selection_container_t asc_mov,
320 mmdb::PAtom *atom_selection1, mmdb::PAtom *atom_selection2,
321 int n_selected_atoms_1, int n_selected_atoms_2,
322 bool move_copy_of_imol2_flag);
323
324 void make_and_print_horizontal_ssm_sequence_alignment(ssm::Align *SSMAlign,
325 atom_selection_container_t asc_ref,
326 atom_selection_container_t asc_mov,
327 mmdb::PAtom *atom_selection1,
328 mmdb::PAtom *atom_selection2,
329 int n_selected_atoms_1, int n_selected_atoms_2) const;
330
331 void map_secondary_structure_headers(ssm::Align *SSMAlign,
332 atom_selection_container_t asc_ref,
333 atom_selection_container_t asc_mov,
334 mmdb::PAtom *atom_selection1,
335 mmdb::PAtom *atom_selection2,
336 int n_selected_atoms_1, int n_selected_atoms_2) const;
337
338 std::pair<std::string, std::string>
339 get_horizontal_ssm_sequence_alignment(ssm::Align *SSMAlign,
340 atom_selection_container_t asc_ref,
341 atom_selection_container_t asc_mov,
342 mmdb::PAtom *atom_selection1, mmdb::PAtom *atom_selection2,
343 int n_selected_atoms_1, int n_selected_atoms_2) const;
344
345 // for gesampt this will be vector of vector
346 std::vector<std::pair<coot::residue_validation_information_t, coot::residue_validation_information_t> >
347 get_pairs(ssm::Align *SSMAlign,
348 atom_selection_container_t asc_ref,
349 atom_selection_container_t asc_mov,
350 mmdb::PAtom *atom_selection1, mmdb::PAtom *atom_selection2,
351 int n_selected_atoms_1, int n_selected_atoms_2) const;
352
353
354 void print_horizontal_ssm_sequence_alignment(std::pair<std::string, std::string> aligned_sequences) const;
355
356 std::string generate_horizontal_ssm_sequence_alignment_string(const std::pair<std::string, std::string> &aligned_sequences) const;
357
358#endif // HAVE_SSMLIB
359
360#ifdef SKIP_FOR_PYTHON_DOXYGEN
361#else
363 int valid_labels(const std::string &mtz_file_name, const std::string &f_col, const std::string &phi_col,
364 const std::string &weight_col, int use_weights) const;
365
366 // water fitting settings
367 float ligand_water_to_protein_distance_lim_max;
368 float ligand_water_to_protein_distance_lim_min;
369 float ligand_water_variance_limit;
370 float ligand_water_sigma_cut_off;
371#endif
372
373 unsigned int max_number_of_simple_mesh_vertices;
374
375 // --------------------- init --------------------------
376#ifdef SKIP_FOR_PYTHON_DOXYGEN
377#else
378 void init(); // private
379#endif
380
381#ifdef SKIP_FOR_PYTHON_DOXYGEN
382#else
384 void debug() const;
385
386 bool map_is_contoured_using_thread_pool_flag;
387 double contouring_time;
388#endif
389
390public:
391
393 explicit molecules_container_t(bool verbose=true);
394
396
400 int imol_refinement_map; // direct access
404 int imol_difference_map; // direct access
405
406 bool use_gemmi; // for mmcif and PDB parsing. 20240112-PE set to true by default in init()
407
408 // -------------------------------- Basic Utilities -----------------------------------
410
415 std::string package_version() const;
416
420 void set_use_gemmi(bool state) { use_gemmi = state; }
421
423 bool get_use_gemmi() { return use_gemmi; }
424
425
429 void set_make_backups(bool state) { make_backups_flag = state; }
430
434 bool get_make_backups() const { return make_backups_flag; }
435
438
444 std::string file_name_to_string(const std::string &file_name) const;
445
449 unsigned int get_number_of_molecules() const { return molecules.size(); }
450
457 void create_empty_molecules(unsigned int n_empty);
458
463
467 void set_map_weight(float w) { map_weight = w; }
468
472 float get_map_weight() const { return map_weight; }
473
478 void scale_map(int imol_map, float scale_factor);
479
486 coot::atom_spec_t atom_cid_to_atom_spec(int imol, const std::string &cid) const;
487
494 coot::residue_spec_t residue_cid_to_residue_spec(int imol, const std::string &cid) const;
495
502 void set_show_timings(bool s) { show_timings = s; }
503
504 // duplicate?
505 // coot::protein_geometry & get_geom() { return geom; }
506
514 moorhen::header_info_t get_header_info(int imol) const;
515
521 int get_imol_enc_any() const;
522
523 // -------------------------------- generic utils -----------------------------------
525
531 std::string get_molecule_name(int imol) const;
532
537 void set_molecule_name(int imol, const std::string &new_name);
538
541
549 bool is_valid_model_molecule(int imol) const;
550
558 bool is_valid_map_molecule(int imol_map) const;
559
565 bool is_a_difference_map(int imol_map) const;
566
570 int new_molecule(const std::string &name);
571
577 int close_molecule(int imol);
578
582
584 void pop_back();
585
587 void clear();
588
597 std::vector<double> get_eigenvalues(int imol, const std::string &chain_id, int res_no, const std::string &ins_code);
598
603
604#ifdef SWIG
605#else
606#ifdef DOXYGEN_SHOULD_PARSE_THIS
607#else
609 coot::molecule_t & operator[] (unsigned int imol);
610#endif
611#endif
612
613#ifdef DOXYGEN_SHOULD_PARSE_THIS
614#else
616 mmdb::Manager *get_mol(unsigned int imol) const;
617#endif
618
621
626 void accept_rotamer_probability_tables_compressed_data(const std::string &data_stream);
627
628 // -------------------------------- backup and saving -----------------------------------
630
637
640
641 // -------------------------------- geometry/dictionaries --------------------------------
643
646
652 std::vector<std::string> non_standard_residue_types_in_model(int imol) const;
653
654#ifdef MAKE_ENHANCED_LIGAND_TOOLS
661 // RDKit::RWMol get_rdkit_mol(const std::string &residue_name, int imol_enc);
662
663 // std::shared_ptr<RDKit::RWMol> get_rdkit_mol_shared(const std::string &residue_name, int imol_enc);
664
670 std::string get_rdkit_mol_pickle_base64(const std::string &residue_name, int imol_enc);
671#endif
672
673 // -------------------------------- coordinates utils -----------------------------------
675
681 int read_coordinates(const std::string &file_name);
682
690 int read_pdb(const std::string &file_name);
691
697 int read_small_molecule_cif(const std::string &file_name);
698
702 void print_secondary_structure_info(int imol) const;
703
711 void replace_molecule_by_model_from_file(int imol, const std::string &pdb_file_name);
712
718 std::vector<int> split_multi_model_molecule(int imol);
719
725 int make_ensemble(const std::string &model_molecules_list);
726
732 std::string molecule_to_PDB_string(int imol) const;
733
739 std::string molecule_to_mmCIF_string(int imol) const;
740
750 std::pair<int, std::string> get_active_atom(float x, float y, float z, const std::string &displayed_model_molecules_list) const;
751
758 int import_cif_dictionary(const std::string &cif_file_name, int imol_enc);
759
766 std::string get_cif_file_name(const std::string &comp_id, int imol_enc) const;
767
774 std::string get_cif_restraints_as_string(const std::string &comp_id, int imol_enc) const;
775
781 bool copy_dictionary(const std::string &monomer_name, int imol_current, int imol_new);
782
788 int get_monomer(const std::string &monomer_name);
789
798 int get_monomer_from_dictionary(const std::string &comp_id, int imol, bool idealised_flag);
799
809 int get_monomer_and_position_at(const std::string &comp_id, int imol, float x, float y, float z);
810
819 std::map<std::string, std::string>
820 dictionary_atom_name_map(const std::string &comp_id_1, int imol_1, const std::string &comp_id_2, int imol_2);
821
823 std::vector<std::string> get_types_in_molecule(int imol) const;
824
825 // 20221030-PE nice to have one day:
826 // int get_monomer_molecule_by_network_and_dict_gen(const std::string &text);
827
835 std::vector<std::string> get_groups_for_monomers(const std::vector<std::string> &residue_names) const;
836
843 std::string get_group_for_monomer(const std::string &residue_name) const;
844
853 std::string get_hb_type(const std::string &compound_id, int imol_enc, const std::string &atom_name) const;
854
862 std::vector<std::pair<std::string, std::string> > get_gphl_chem_comp_info(const std::string &compound_id, int imol_enc);
863
871 std::vector<std::pair<std::string, std::string> > get_acedrg_atom_types(const std::string &compound_id, int imol_enc) const;
872
879 coot::acedrg_types_for_residue_t get_acedrg_atom_types_for_ligand(int imol, const std::string &residue_cid) const;
880
886 void set_occupancy(int imol, const std::string &cid, float occ_new);
887
892 std::string get_molecule_selection_as_json(int imol, const std::string &cid) const;
893
900 void write_png(const std::string &compound_id, int imol, const std::string &file_name) const;
901
908 int write_coordinates(int imol, const std::string &file_name) const;
909
918
933 coot::simple_mesh_t get_bonds_mesh(int imol, const std::string &mode,
934 bool against_a_dark_background,
935 float bond_width, float atom_radius_to_bond_width_ratio,
936 int smoothness_factor);
937
955 coot::instanced_mesh_t get_bonds_mesh_instanced(int imol, const std::string &mode,
956 bool against_a_dark_background,
957 float bond_width, float atom_radius_to_bond_width_ratio,
958 bool show_atoms_as_aniso_flag,
959 bool show_aniso_atoms_as_ortep_flag,
960 bool draw_hydrogen_atoms_flag,
961 int smoothness_factor);
962
968 coot::instanced_mesh_t get_bonds_mesh_for_selection_instanced(int imol, const std::string &atom_selection_cid,
969 const std::string &mode,
970 bool against_a_dark_background,
971 float bond_width, float atom_radius_to_bond_width_ratio,
972 bool show_atoms_as_aniso_flag,
973 bool show_aniso_atoms_as_ortep_flag,
974 bool draw_hydrogen_atoms_flag,
975 int smoothness_factor);
976
985 coot::instanced_mesh_t get_goodsell_style_mesh_instanced(int imol, float colour_wheel_rotation_step,
986 float saturation, float goodselliness);
987
999 void export_map_molecule_as_gltf(int imol, float pos_x, float pos_y, float pos_z, float radius, float contour_level,
1000 const std::string &file_name);
1001
1010 const std::string &selection_cid,
1011 const std::string &mode,
1012 bool against_a_dark_background,
1013 float bonds_width, float atom_radius_to_bond_width_ratio, int smoothness_factor,
1014 bool draw_hydrogen_atoms_flag, bool draw_missing_residue_loops,
1015 const std::string &file_name);
1016
1027 void export_molecular_representation_as_gltf(int imol, const std::string &atom_selection_cid,
1028 const std::string &colour_scheme, const std::string &style,
1029 int secondary_structure_usage_flag,
1030 const std::string &file_name);
1031
1034 void export_chemical_features_as_gltf(int imol, const std::string &cid,
1035 const std::string &file_name) const;
1036
1041 void set_gltf_pbr_roughness_factor(int imol, float roughness_factor);
1042
1047 void set_gltf_pbr_metalicity_factor(int imol, float metalicity);
1048
1055 std::vector<glm::vec4> get_colour_table(int imol, bool against_a_dark_background) const;
1056
1061 void set_colour_wheel_rotation_base(int imol, float r);
1062
1069 void set_base_colour_for_bonds(int imol, float r, float g, float b);
1070
1075 void add_to_non_drawn_bonds(int imol, const std::string &atom_selection_cid);
1076
1081
1085 void print_non_drawn_bonds(int imol) const;
1086
1088 void set_user_defined_bond_colours(int imol, const std::map<unsigned int, std::array<float, 4> > &colour_map);
1089
1093 void set_user_defined_atom_colour_by_selection(int imol, const std::vector<std::pair<std::string, unsigned int> > &indexed_residues_cids,
1094 bool colour_applies_to_non_carbon_atoms_also);
1095
1097 void add_colour_rule(int imol, const std::string &selection_cid, const std::string &colour);
1098
1104 void add_colour_rules_multi(int imol, const std::string &selections_and_colours_combo_string);
1105
1109 void delete_colour_rules(int imol);
1110
1114 std::vector<std::pair<std::string, std::string> > get_colour_rules(int imol) const;
1115
1119 void print_colour_rules(int imol) const;
1120
1124 void set_use_bespoke_carbon_atom_colour(int imol, bool state);
1125
1130
1132 void M2T_updateFloatParameter(int imol, const std::string &param_name, float value);
1133
1135 void M2T_updateIntParameter(int imol, const std::string &param_name, int value);
1136
1147 coot::simple_mesh_t get_molecular_representation_mesh(int imol, const std::string &cid, const std::string &colour_scheme,
1148 const std::string &style, int secondary_structure_usage_flag);
1149
1160 coot::simple_mesh_t get_gaussian_surface(int imol, float sigma, float contour_level,
1161 float box_radius, float grid_scale, float b_factor) const;
1162
1169 coot::simple_mesh_t get_chemical_features_mesh(int imol, const std::string &cid) const;
1170
1181 mmdb::Atom *get_atom_using_cid(int imol, const std::string &cid) const;
1182
1193 mmdb::Residue *get_residue_using_cid(int imol, const std::string &cid) const;
1194
1195#ifdef DOXYGEN_SHOULD_PARSE_THIS
1196#else
1200 mmdb::Atom *get_atom(int imol, const coot::atom_spec_t &atom_spec) const;
1204 mmdb::Residue *get_residue(int imol, const coot::residue_spec_t &residue_spec) const;
1206 std::pair<bool, coot::Cartesian> get_atom_position(int imol, coot::atom_spec_t &atom_spec);
1207#endif
1208
1217 bool residue_is_nucleic_acid(int imol, const std::string &cid) const;
1218
1225 std::vector<double> get_residue_CA_position(int imol, const std::string &cid) const;
1226
1233 std::vector<double> get_residue_average_position(int imol, const std::string &cid) const;
1234
1241 std::vector<double> get_residue_sidechain_average_position(int imol, const std::string &cid) const;
1242
1248 unsigned int get_number_of_atoms(int imol) const;
1249
1255 float get_molecule_diameter(int imol) const;
1256
1262 int get_number_of_hydrogen_atoms(int imol) const;
1263
1269 std::vector<std::string> get_chains_in_model(int imol) const;
1270
1276 std::vector<std::vector<std::string> > get_ncs_related_chains(int imol) const;
1277
1284 std::vector<std::pair<coot::residue_spec_t, std::string> > get_single_letter_codes_for_chain(int imol, const std::string &chain_id) const;
1285
1291 std::vector<std::string> get_residue_names_with_no_dictionary(int imol) const;
1292
1301 std::string get_residue_name(int imol, const std::string &chain_id, int res_no, const std::string &ins_code) const;
1302
1308 std::string get_residue_type(int imol, const std::string &cid) const;
1309
1317 std::string get_SMILES_for_residue_type(const std::string &residue_name, int imol_enc) const;
1318
1325 std::vector<coot::residue_spec_t> residues_with_missing_atoms(int imol);
1326
1327#ifdef DOXYGEN_SHOULD_PARSE_THIS
1328#else
1330 // (20230117-PE I should fix that)
1336 coot::util::missing_atom_info missing_atoms_info_raw(int imol);
1337#endif
1338
1343 std::vector<coot::residue_range_t> get_missing_residue_ranges(int imol) const;
1344
1352 std::vector<coot::residue_spec_t> get_residues_near_residue(int imol, const std::string &residue_cid, float dist) const;
1353
1360 std::vector<coot::atom_distance_t>
1361 get_distances_between_atoms_of_residues(int imol, const std::string &cid_res_1, const std::string &cid_res_2,
1362 float dist_max) const;
1363
1372 superpose_results_t SSM_superpose(int imol_ref, const std::string &chain_id_ref,
1373 int imol_mov, const std::string &chain_id_mov);
1374
1384 void add_lsq_superpose_match(const std::string &chain_id_ref, int res_no_ref_start, int res_no_ref_end,
1385 const std::string &chain_id_mov, int res_no_mov_start, int res_no_mov_end,
1386 int match_type);
1387
1396 void add_lsq_superpose_atom_match(const std::string &chain_id_ref, int res_no_ref, const std::string &atom_name_ref,
1397 const std::string &chain_id_mov, int res_no_mov, const std::string &atom_name_mov);
1398
1401
1402 std::vector<coot::lsq_range_match_info_t> lsq_matchers;
1403
1409 bool lsq_superpose(int imol_ref, int imol_mov);
1410
1421 int transform_map_using_lsq_matrix(int imol_map, lsq_results_t lsq_matrix, float x, float y, float z, float radius);
1431 lsq_results_t get_lsq_matrix(int imol_ref, int imol_mov, bool summary_to_screen) const;
1432
1436 coot::symmetry_info_t
1437 get_symmetry(int imol, float symmetry_search_radius, float centre_x, float centre_y, float centre_z) const;
1438
1446 ::api::cell_t get_cell(int imol) const;
1447
1454
1460 int undo(int imol);
1461
1467 int redo(int imol);
1468
1476 std::pair<int, double> get_torsion(int imol, const std::string &cid, const std::vector<std::string> &atom_names);
1477
1483 void set_temperature_factors_using_cid(int imol, const std::string &cid, float temp_fact);
1484
1485 // -------------------------------- map utils -------------------------------------------
1487
1488#ifdef DOXYGEN_SHOULD_PARSE_THIS
1489#else
1491 float map_sampling_rate;
1492#endif
1493
1497 float get_map_sampling_rate() { return map_sampling_rate; }
1498
1505 void set_map_sampling_rate(float msr) { map_sampling_rate = msr; }
1506
1517 int read_mtz(const std::string &file_name, const std::string &f, const std::string &phi, const std::string &weight,
1518 bool use_weight, bool is_a_difference_map);
1519
1527 int replace_map_by_mtz_from_file(int imol, const std::string &file_name, const std::string &f, const std::string &phi,
1528 const std::string &weight, bool use_weight);
1529
1531 class auto_read_mtz_info_t {
1532 public:
1534 int idx;
1536 std::string F;
1538 std::string phi;
1540 std::string w;
1544 std::string F_obs;
1546 std::string sigF_obs;
1548 std::string Rfree;
1549 // constructor
1550 auto_read_mtz_info_t() {idx = -1; weights_used = false; }
1551 // constructor
1552 auto_read_mtz_info_t(int index, const std::string &F_in, const std::string &phi_in) :
1553 idx(index), F(F_in), phi(phi_in), weights_used(false) {}
1554 // set Fobs sigFobs column labels
1555 void set_fobs_sigfobs(const std::string &f, const std::string &s) {
1556 F_obs = f;
1557 sigF_obs = s;
1558 }
1559 };
1560
1566 std::vector<auto_read_mtz_info_t> auto_read_mtz(const std::string &file_name);
1567
1576 int read_ccp4_map(const std::string &file_name, bool is_a_difference_map);
1577
1584 int write_map(int imol, const std::string &file_name) const;
1585
1591 float get_map_mean(int imol) const;
1592
1600 float get_map_rmsd_approx(int imol_map) const;
1601
1610 coot::molecule_t::histogram_info_t get_map_histogram(int imol, unsigned int n_bins, float zoom_factor) const;
1611
1612
1617
1623 bool is_EM_map(int imol) const;
1624
1632 int sharpen_blur_map(int imol_map, float b_factor, bool in_place_flag);
1633
1644 int sharpen_blur_map_with_resample(int imol_map, float b_factor, float resample_factor, bool in_place_flag);
1645
1659 int mask_map_by_atom_selection(int imol_coords, int imol_map, const std::string &cid, float atom_radius, bool invert_flag);
1660
1673 std::vector<int> partition_map_by_chain(int imol_map, int imol_model);
1674
1683 int make_mask(int imol_map_ref, int imol_model, const std::string &atom_selection_cid, float radius);
1684
1690 int flip_hand(int imol_map);
1691
1698 std::vector<int> make_masked_maps_split_by_chain(int imol, int imol_map);
1699
1705 int dedust_map(int imol);
1706
1717 void set_map_colour(int imol, float r, float g, float b);
1718
1723
1736 coot::simple_mesh_t get_map_contours_mesh(int imol, double position_x, double position_y, double position_z,
1737 float radius, float contour_level);
1738
1754 double position_x, double position_y, double position_z,
1755 float radius, float contour_level,
1756 float other_map_for_colouring_min_value,
1757 float other_map_for_colouring_max_value,
1758 bool invert_colour_ramp);
1763 void set_map_colour_saturation(int imol, float s);
1764 void set_colour_map_for_map_coloured_by_other_map(std::vector<std::pair<double, std::vector<double> > > colour_table );
1765
1766 user_defined_colour_table_t colour_map_by_other_map_user_defined_table;
1767
1777 double position_x, double position_y, double position_z,
1778 float radius, float contour_level,
1779 unsigned int n_bins);
1780
1781
1782
1786 coot::util::sfcalc_genmap_stats_t get_latest_sfcalc_stats() const { return latest_sfcalc_stats; }
1787
1789 public:
1790 float r_factor; // 0 to 1
1791 float free_r_factor;
1792 int rail_points_total;
1793 int rail_points_new;
1794 };
1795
1800
1806 std::string r_factor_stats_as_string(const r_factor_stats &rfs) const;
1807
1818 int average_map(const std::string &imol_maps, std::vector<float> &scales);
1819
1830 bool regen_map(int imol_map, const std::string &imol_maps, const std::vector<float> &scales);
1831
1832 // -------------------------------- coordinates modelling -------------------------------
1834
1845 int auto_fit_rotamer(int imol, const std::string &chain_id, int res_no, const std::string &ins_code, const std::string &alt_conf,
1846 int imol_map);
1847
1855 coot::molecule_t::rotamer_change_info_t change_to_next_rotamer(int imol, const std::string &residue_cid, const std::string &alt_conf);
1856
1864 coot::molecule_t::rotamer_change_info_t change_to_previous_rotamer(int imol, const std::string &residue_cid, const std::string &alt_conf);
1865
1873 coot::molecule_t::rotamer_change_info_t change_to_first_rotamer(int imol, const std::string &residue_cid, const std::string &alt_conf);
1874
1882 int set_residue_to_rotamer_number(int imol, const std::string &residue_cid, const std::string &alt_conf, int rotamer_number);
1883
1891 std::pair<int, unsigned int> delete_using_cid(int imol, const std::string &cid, const std::string &scope);
1892
1903 std::pair<int, unsigned int> delete_atom(int imol, const std::string &chain_id, int res_no, const std::string &ins_code,
1904 const std::string &atom_name, const std::string &alt_conf);
1905
1912 std::pair<int, unsigned int> delete_atom_using_cid(int imol, const std::string &cid);
1913
1922 std::pair<int, unsigned int> delete_residue(int imol, const std::string &chain_id, int res_no, const std::string &ins_code);
1923
1930 std::pair<int, unsigned int> delete_residue_using_cid(int imol, const std::string &cid);
1931
1941 std::pair<int, unsigned int> delete_residue_atoms_with_alt_conf(int imol, const std::string &chain_id, int res_no,
1942 const std::string &ins_code, const std::string &alt_conf);
1948 std::pair<int, unsigned int> delete_residue_atoms_using_cid(int imol, const std::string &cid);
1949
1958 std::pair<int, unsigned int> delete_side_chain(int imol, const std::string &chain_id, int res_no, const std::string &ins_code);
1959
1966 std::pair<int, unsigned int> delete_side_chain_using_cid(int imol, const std::string &cid);
1967
1974 std::pair<int, unsigned int> delete_chain_using_cid(int imol, const std::string &cid);
1975
1982 std::pair<int, unsigned int> delete_literal_using_cid(int imol, const std::string &cid);
1983
1990
1991 // (I should have) change(d) that stupid (alt) loc (I should have made you leave your key)
1992 //
2004 int change_alt_locs(int imol, const std::string &cid, const std::string &change_mode);
2005
2014 std::pair<int, std::string> add_terminal_residue_directly(int imol, const std::string &chain_id, int res_no, const std::string &ins_code);
2015
2016 // std::pair<int, std::string> add_terminal_residue_directly_using_cid(int imol, const std::string &cid);
2017 //
2023 int add_terminal_residue_directly_using_cid(int imol, const std::string &cid);
2024
2032
2038
2043 ligand_water_to_protein_distance_lim_min = d;
2044 }
2045
2050 ligand_water_to_protein_distance_lim_max = d;
2051 }
2052
2057 ligand_water_variance_limit = d;
2058 }
2059
2064 ligand_water_sigma_cut_off = d;
2065 }
2066
2073 int add_waters(int imol_model, int imol_map);
2074
2082 int flood(int imol_model, int imol_map, float n_rmsd);
2083
2089 int add_hydrogen_atoms(int imol_model);
2090
2096 int delete_hydrogen_atoms(int imol_model);
2097
2104 int add_alternative_conformation(int imol_model, const std::string &cid);
2105
2114 int fill_partial_residue(int imol, const std::string &chain_id, int res_no, const std::string &ins_code);
2115
2122 int fill_partial_residue_using_cid(int imol, const std::string &cid);
2123
2130
2139 void add_named_glyco_tree(int imol_model, int imol_map, const std::string &glycosylation_name,
2140 const std::string &asn_chain_id, int asn_res_no);
2141
2142#if NB_VERSION_MAJOR
2143#else
2151 int flip_peptide(int imol, const coot::atom_spec_t &atom_spec, const std::string &alt_conf);
2152#endif
2153
2161 int flip_peptide_using_cid(int imol, const std::string &atom_cid, const std::string &alt_conf);
2162
2169 void eigen_flip_ligand(int imol, const std::string &chain_id, int res_no, const std::string &ins_code);
2170
2175 void eigen_flip_ligand_using_cid(int imol, const std::string &residue_cid);
2176
2184 int mutate(int imol, const std::string &cid, const std::string &new_residue_type);
2185
2192 int side_chain_180(int imol, const std::string &atom_cid);
2193
2201 std::string jed_flip(int imol, const std::string &atom_cid, bool invert_selection);
2202
2211 int move_molecule_to_new_centre(int imol, float x, float y, float z);
2212
2218 void multiply_residue_temperature_factors(int imol, const std::string &cid, float factor);
2219
2225 coot::Cartesian get_molecule_centre(int imol) const;
2226
2233 double get_radius_of_gyration(int imol) const;
2234
2240 int copy_molecule(int imol);
2241
2248 int copy_fragment_using_cid(int imol, const std::string &multi_cid);
2249
2261 int copy_fragment_for_refinement_using_cid(int imol, const std::string &multi_cid);
2262
2271 int copy_fragment_using_residue_range(int imol, const std::string &chain_id, int res_no_start, int res_no_end);
2272
2276 int apply_transformation_to_atom_selection(int imol, const std::string &atoms_selection_cid,
2277 int n_atoms, // for validation of the atom selection, (int because mmdb atom type)
2278 float m00, float m01, float m02,
2279 float m10, float m11, float m12,
2280 float m20, float m21, float m22,
2281 float c0, float c1, float c2, // the centre of the rotation
2282 float t0, float t1, float t2); // translation
2283
2289 int new_positions_for_residue_atoms(int imol, const std::string &residue_cid, std::vector<coot::api::moved_atom_t> &moved_atoms);
2290
2295 int new_positions_for_atoms_in_residues(int imol, const std::vector<coot::api::moved_residue_t> &moved_residues);
2296
2306 std::pair<int, std::vector<merge_molecule_results_info_t> >
2307 merge_molecules(int imol, const std::string &list_of_other_molecules);
2308
2309 // this is called by the above function and is useful for other non-api functions (such as add_compound()).
2310
2311#ifdef SKIP_FOR_PYTHON_DOXYGEN
2312//#ifdef DOXYGEN_SHOULD_PARSE_THIS
2313#else
2314 std::pair<int, std::vector<merge_molecule_results_info_t> >
2315 merge_molecules(int imol, std::vector<mmdb::Manager *> mols);
2316#endif
2317
2324 int cis_trans_convert(int imol, const std::string &atom_cid);
2325
2340 void replace_residue(int imol, const std::string &residue_cid, const std::string &new_residue_type, int imol_enc);
2341
2349 int replace_fragment(int imol_base, int imol_reference, const std::string &atom_selection);
2350
2356 int rigid_body_fit(int imol, const std::string &multi_cid, int imol_map);
2357
2372 int rotate_around_bond(int imol, const std::string &residue_cid,
2373 const std::string &atom_name_1,
2374 const std::string &atom_name_2,
2375 const std::string &atom_name_3,
2376 const std::string &atom_name_4,
2377 double torsion_angle);
2378
2390 std::pair<int, std::string> change_chain_id(int imol, const std::string &from_chain_id,
2391 const std::string &to_chain_id,
2392 bool use_resno_range,
2393 int start_resno, int end_resno);
2394
2404 int split_residue_using_map(int imol, const std::string &residue_cid, int imol_diff_map);
2405
2411 void associate_sequence(int imol, const std::string &name_or_chain_id, const std::string &sequence);
2412
2421 void assign_sequence(int imol_model, int imol_map);
2422
2427 std::vector<std::pair<std::string, std::string> > get_sequence_info(int imol) const;
2428
2436 coot::chain_mutation_info_container_t get_mutation_info(int imol) const;
2437
2438 // -------------------------------- Coordinates Refinement ------------------------------
2440
2450 int refine_residues_using_atom_cid(int imol, const std::string &cid, const std::string &mode, int n_cycles);
2451
2464 int refine_residues(int imol, const std::string &chain_id, int res_no, const std::string &ins_code,
2465 const std::string &alt_conf, const std::string &mode, int n_cycles);
2466
2476 int refine_residue_range(int imol, const std::string &chain_id, int res_no_start, int res_no_end, int n_cycles);
2477
2493 std::pair<int, coot::instanced_mesh_t>
2494 minimize_energy(int imol, const std::string &atom_selection_cid,
2495 int n_cycles,
2496 bool do_rama_plot_restraints, float rama_plot_weight,
2497 bool do_torsion_restraints, float torsion_weight, bool refinement_is_quiet);
2498
2510 float
2511 minimize(int imol, const std::string &atom_selection_cid,
2512 int n_cycles,
2513 bool do_rama_plot_restraints, float rama_plot_weight,
2514 bool do_torsion_restraints, float torsion_weight, bool refinement_is_quiet);
2515
2522 void fix_atom_selection_during_refinement(int imol, const std::string &atom_selection_cid);
2523
2531 void add_target_position_restraint(int imol, const std::string &atom_cid, float pos_x, float pos_y, float pos_z);
2532
2537 void clear_target_position_restraint(int imol, const std::string &atom_cid);
2538
2543
2547 void set_logging_level(const std::string &level);
2548
2552 void set_logging_file(const std::string &file_name);
2553
2557 void set_use_rama_plot_restraints(bool state) { use_rama_plot_restraints = state; }
2558
2562 bool get_use_rama_plot_restraints() const { return use_rama_plot_restraints; }
2563
2567 void set_rama_plot_restraints_weight(float f) { rama_plot_restraints_weight = f; }
2568
2572 float get_rama_plot_restraints_weight() const { return rama_plot_restraints_weight; }
2573
2577 void set_use_torsion_restraints(bool state) { use_torsion_restraints = state; }
2578
2582 bool get_use_torsion_restraints() const { return use_torsion_restraints; }
2583
2587 void set_torsion_restraints_weight(float f) { torsion_restraints_weight = f; }
2588
2592 float get_torsion_restraints_weight() const { return torsion_restraints_weight; }
2593
2599 void init_refinement_of_molecule_as_fragment_based_on_reference(int imol_frag, int imol_ref, int imol_map);
2600
2611 std::pair<int, coot::instanced_mesh_t> refine(int imol, int n_cycles);
2612
2628 float pos_x, float pos_y, float pos_z,
2629 int n_cycles);
2634
2639 void clear_refinement(int imol);
2640
2646 void set_refinement_is_verbose(bool state) { refinement_is_quiet = !state; }
2647
2651 void set_refinement_geman_mcclure_alpha(float a) { geman_mcclure_alpha = a; }
2652
2656 float get_geman_mcclure_alpha() const { return geman_mcclure_alpha; }
2657
2662 int generate_self_restraints(int imol, float local_dist_max);
2663
2669 void generate_chain_self_restraints(int imol, float local_dist_max,
2670 const std::string &chain_id);
2671
2677 void generate_local_self_restraints(int imol, float local_dist_max,
2678 const std::string &residue_cids);
2679
2686 const std::string &residue_cid_1,
2687 const std::string &residue_cid_2);
2688
2694
2698 int read_extra_restraints(int imol, const std::string &file_name);
2699
2704
2712 int servalcat_refine_xray(int imol, int imol_map, const std::string &output_prefix);
2713
2714#if NB_VERSION_MAJOR
2723 int servalcat_refine_xray_with_keywords(int imol, int imol_map, const std::string &output_prefix,
2724 const nanobind::dict &key_value_pairs);
2725#endif
2726
2727 // -------------------------------- Coordinates validation ------------------------------
2729
2736
2743
2752
2758 std::vector<coot::phi_psi_prob_t> ramachandran_validation(int imol) const;
2759
2767 coot::instanced_mesh_t contact_dots_for_ligand(int imol, const std::string &cid, unsigned int smoothness_factor) const;
2768
2775 coot::instanced_mesh_t all_molecule_contact_dots(int imol, unsigned int smoothness_factor) const;
2776
2784 // Note this function is not const because we pass a pointer to the protein_geometry geom.
2785 coot::simple::molecule_t get_simple_molecule(int imol, const std::string &residue_cid, bool draw_hydrogen_atoms_flag);
2786
2794
2802 std::vector<moorhen::h_bond> get_h_bonds(int imol, const std::string &cid_str, bool mcdonald_and_thornton_mode) const;
2803
2811 // Function is not const because it might change the protein_geometry geom.
2813
2821 std::vector<coot::geometry_distortion_info_container_t>
2822 get_ligand_validation_vs_dictionary(int imol, const std::string &ligand_cid, bool include_non_bonded_contacts);
2823
2831 std::vector<coot::geometry_distortion_info_container_t>
2832 get_validation_vs_dictionary_for_selection(int imol, const std::string &selection_cid, bool include_non_bonded_contacts);
2833
2843 std::pair<int, double> get_ligand_distortion(int imol, const std::string &ligand_cid, bool include_non_bonded_contacts);
2844
2853 bool match_ligand_torsions(int imol_ligand, int imol_ref, const std::string &chain_id_ref, int resno_ref);
2854
2866 bool match_ligand_position(int imol_ligand, int imol_ref, const std::string &chain_id_ref, int resno_ref);
2867
2876 bool match_ligand_torsions_and_position(int imol_ligand, int imol_ref, const std::string &chain_id_ref, int resno_ref);
2877
2883 bool match_ligand_torsions_and_position_using_cid(int imol_ligand, int imol_ref, const std::string &cid);
2884
2885 // not const because it can dynamically add dictionaries
2887 coot::atom_overlaps_dots_container_t get_overlap_dots(int imol);
2888
2893 coot::atom_overlaps_dots_container_t get_overlap_dots_for_ligand(int imol, const std::string &cid_ligand);
2894
2896 // not const because it can dynamically add dictionaries
2901 std::vector<coot::plain_atom_overlap_t> get_atom_overlaps(int imol);
2902
2907 float get_atom_overlap_score(int imol);
2908
2910 // not const because it can dynamically add dictionaries
2914 std::vector<coot::plain_atom_overlap_t> get_overlaps_for_ligand(int imol, const std::string &cid_ligand);
2915
2923 std::vector <positioned_atom_spec_t>
2924 get_atom_differences(int imol1, int imol2);
2925
2930 std::string get_pucker_analysis_info(int imol) const;
2931
2932
2933 // -------------------------------- Coordinates and map validation ----------------------
2935
2944 coot::validation_information_t density_fit_analysis(int imol_model, int imol_map) const;
2945
2948 double get_sum_density_for_atoms_in_residue(int imol, const std::string &cid,
2949 const std::vector<std::string> &atom_names,
2950 int imol_map);
2951
2957 int get_number_of_atoms_in_residue(int imol, const std::string &residue_cid) const;
2958
2966
2973
2980
2989 coot::validation_information_t ramachandran_analysis_for_chain(int imol_model, const std::string &chain_id) const;
2990
2997
3003 float get_median_temperature_factor(int imol) const;
3004
3011 float get_temperature_factor_of_atom(int imol, const std::string &atom_cid) const;
3012
3018 std::vector<coot::molecule_t::interesting_place_t> get_interesting_places(int imol, const std::string &mode) const;
3019
3027 std::vector<coot::molecule_t::interesting_place_t> difference_map_peaks(int imol_map, int imol_protein, float n_rmsd) const;
3028
3036 std::vector<coot::molecule_t::interesting_place_t> pepflips_using_difference_map(int imol_coords, int imol_difference_map, float n_sigma) const;
3037
3046 std::vector<coot::molecule_t::interesting_place_t> unmodelled_blobs(int imol_model, int imol_map,
3047 float rmsd_cut_off) const;
3048
3061 // Use the string_user_data of the spec for the button label
3062 std::vector <coot::atom_spec_t>
3063 find_water_baddies(int imol_model, int imol_map,
3064 float b_factor_lim,
3065 float outlier_sigma_level,
3066 float min_dist, float max_dist,
3067 bool ignore_part_occ_contact_flag,
3068 bool ignore_zero_occ_flag);
3069
3076 float start_pos_x, float start_pos_y, float start_pos_z,
3077 float end_pos_x, float end_pos_y, float end_pos_z) const;
3078
3088#ifdef SWIG
3089#else
3090 std::pair<std::map<coot::residue_spec_t, coot::util::density_correlation_stats_info_t>,
3091 std::map<coot::residue_spec_t, coot::util::density_correlation_stats_info_t> >
3092 get_mmrrcc(int imol, const std::string &chain_id, unsigned int n_residue_per_residue_range, int imol_map) const;
3093
3101 std::pair<std::map<coot::residue_spec_t, coot::util::density_correlation_stats_info_t>,
3102 std::map<coot::residue_spec_t, coot::util::density_correlation_stats_info_t> >
3103 mmrrcc(int imol, const std::string &chain_id, int imol_map) const;
3104#endif
3105
3106 // calculate the MMRRCC for the residues in the chain
3107 // Multi Masked Residue Range Corellation Coefficient
3108#ifdef SWIG
3109#else
3110 std::pair<std::map<coot::residue_spec_t, coot::util::density_correlation_stats_info_t>,
3111 std::map<coot::residue_spec_t, coot::util::density_correlation_stats_info_t> >
3112 mmrrcc_internal(const atom_selection_container_t &asc,
3113 const std::string &chain_id,
3114 unsigned int n_residue_per_residue_range,
3115 const clipper::Xmap<float> &xmap) const;
3116#endif
3117
3126 std::vector<std::pair<double, double> > fourier_shell_correlation(int imol_map_1, int imol_map_2) const;
3127
3134 int make_power_scaled_map(int imol_ref, int imol_map_for_scaling);
3135
3142 coot::validation_information_t get_q_score(int imol_model, int imol_map) const;
3143
3151 coot::validation_information_t get_q_score_for_cid(int imol_model, const std::string &cid, int imol_map) const;
3152
3159 std::pair<float,float> get_mean_and_variance_of_density_for_non_water_atoms(int imol_coords, int imol_map) const;
3160
3167 float get_spherical_variance(int imol_map, int imol_model, const std::string &atom_cid, float mean_density_other_atoms) const;
3168
3169 // -------------------------------- Rail Points ------------------------------------------
3171
3176
3181
3182 // -------------------------------- Updating Maps ---------------------------------------
3184
3194 void associate_data_mtz_file_with_map(int imol, const std::string &data_mtz_file_name,
3195 const std::string &f_col, const std::string &sigf_col,
3196 const std::string &free_r_col);
3197
3209 int connect_updating_maps(int imol_model, int imol_with_data_info_attached, int imol_map_2fofc, int imol_map_fofc);
3210
3218 void sfcalc_genmap(int imol_model,
3219 int imol_map_with_data_attached,
3220 int imol_updating_difference_map);
3221
3238 int imol_2fofc_map,
3239 int imol_updating_difference_map,
3240 int imol_map_with_data_attached);
3241
3252 bool shift_field_b_factor_refinement(int imol, int imol_with_data_attached);
3253
3261 float get_density_at_position(int imol_map, float x, float y, float z) const;
3262
3270 // This is a light-weight fetch, the values have already been computed, here
3271 // were are merely copying them.
3272 std::vector<std::pair<clipper::Coord_orth, float> > get_diff_diff_map_peaks(int imol_diff_map,
3273 float screen_centre_x,
3274 float screen_centre_y,
3275 float screen_centre_z) const;
3276
3277
3281 std::string get_data_set_file_name(int imol) const;
3282
3283 // -------------------------------- Go To Blob ---------------------------------------
3285
3302 std::pair<bool, clipper::Coord_orth> go_to_blob(float x1, float y1, float z1, float x2, float y2, float z2,
3303 float contour_level);
3304
3305
3306 // -------------------------------- Ligand Functions ---------------------------------------
3308
3311 // I am not yet clear what extra cut-offs and flags need to be added here.
3327 std::vector<int> fit_ligand_right_here(int imol_protein, int imol_map, int imol_ligand, float x, float y, float z,
3328 float n_rmsd, bool use_conformers, unsigned int n_conformers);
3329
3333
3334 class fit_ligand_info_t {
3335 public:
3336 int imol; // the imol of the fitted ligand
3337 int cluster_idx; // the index of the cluster
3338 int ligand_idx; // the ligand idx for a given cluster
3339 float fitting_score;
3340 float cluster_volume;
3341 fit_ligand_info_t(int i, int c, int l) : imol(i), cluster_idx(c), ligand_idx(l) { fitting_score = -1.0; cluster_volume = -1.0;}
3342 fit_ligand_info_t() { imol = -1; cluster_idx = -1; ligand_idx = -1; fitting_score = 1.0; cluster_volume = -1.0; }
3344 float get_fitting_score() const { return fitting_score; }
3345 float get_cluster_volume() const { return cluster_volume; }
3346 };
3347
3358 std::vector<fit_ligand_info_t> fit_ligand(int imol_protein, int imol_map, int imol_ligand,
3359 float n_rmsd, bool use_conformers, unsigned int n_conformers);
3360
3371 std::vector<fit_ligand_info_t> fit_ligand_multi_ligand(int imol_protein, int imol_map, const std::string &multi_ligand_molecule_number_list,
3372 float n_rmsd, bool use_conformers, unsigned int n_conformers);
3373
3382 float fit_to_map_by_random_jiggle(int imol, const coot::residue_spec_t &res_spec, int n_trials, float translation_scale_factor);
3383
3392 float fit_to_map_by_random_jiggle_using_cid(int imol, const std::string &cid, int n_trials, float translation_scale_factor);
3393
3403 float fit_to_map_by_random_jiggle_with_blur_using_cid(int imol, int imol_map, const std::string &cid, float b_factor,
3404 int n_trials, float translation_scale_factor);
3405
3418
3419 int add_compound(int imol, const std::string &tlc, int imol_dict, int imol_map, float x, float y, float z);
3420 // This is a ligand function, not really a ligand-fitting function.
3444 std::string get_svg_for_residue_type(int imol, const std::string &comp_id,
3445 bool use_rdkit_svg,
3446 const std::string &background_type);
3447
3462 std::string get_svg_for_2d_ligand_environment_view(int imol, const std::string &residue_cid, bool add_key);
3463
3470 std::vector<coot::residue_spec_t> get_non_standard_residues_in_molecule(int imol) const;
3471
3478
3489 std::vector<int> get_dictionary_conformers(const std::string &comp_id, int imol_enc, bool remove_internal_clash_conformers);
3490
3501 texture_as_floats_t get_map_section_texture(int imol, int section_id, int axis,
3502 float data_value_for_bottom, float data_value_for_top) const;
3503
3508 int get_number_of_map_sections(int imol_map, int axis_id) const;
3509
3510 // -------------------------------- Others -------------------------------------
3512
3516 coot::simple_mesh_t make_mesh_from_gltf_file(const std::string &file_name);
3517
3523 coot::simple_mesh_t get_octahemisphere(unsigned int n_divisions) const;
3524
3525 unsigned int get_max_number_of_simple_mesh_vertices() const;
3526 void set_max_number_of_simple_mesh_vertices(unsigned int n);
3527
3530 std::string pae_png(const std::string &pae_file_name) const;
3531
3532 // -------------------------------- Testing -------------------------------------
3534
3535 class ltj_stats_t {
3536 public:
3537 unsigned int count;
3538 float function_value;
3539 std::chrono::time_point<std::chrono::high_resolution_clock> timer_start;
3540 std::chrono::time_point<std::chrono::high_resolution_clock> timer;
3541 ltj_stats_t() : timer(std::chrono::high_resolution_clock::now()) {
3542 count = 0;
3543 function_value = 0;
3544 timer_start = timer;
3545 }
3548 timer = std::chrono::high_resolution_clock::now();
3549 count += 1;
3550 }
3551
3556 timer = std::chrono::high_resolution_clock::now();
3557 auto d10 = std::chrono::duration_cast<std::chrono::microseconds>(timer - timer_start).count();
3558 return d10;
3559 }
3560 };
3561
3564
3565 // not for user-control
3566 bool interrupt_long_term_job;
3567
3573 void testing_start_long_term_job(unsigned int n_seconds);
3574
3579
3584
3588 double get_contouring_time() const { return contouring_time; }
3589
3595 void set_max_number_of_threads(unsigned int n_threads);
3596
3600 void set_max_number_of_threads_in_thread_pool(unsigned int n_threads);
3601
3607 double test_the_threading(int n_threads);
3608
3615 double test_launching_threads(unsigned int n_threads_per_batch, unsigned int n_batches) const;
3616
3622 double test_thread_pool_threads(unsigned int n_threads);
3623
3633 int mmcif_tests(bool last_test_only);
3634
3635 // I want this function in the C++ documentation, but not the Python API documentation.
3636 // Hmm.
3637#ifdef DOXYGEN_SHOULD_PARSE_THIS
3638#else
3640 coot::protein_geometry & get_geometry() {
3641 return geom;
3642 }
3643#endif
3644
3645 // -------------------------------- Blender Interface ---------------------------------------
3646
3648
3650 void make_mesh_for_map_contours_for_blender(int imol, float x, float y, float z, float level, float radius);
3652 void make_mesh_for_bonds_for_blender(int imol, const std::string &mode, bool against_a_dark_background,
3653 float bond_width, float atom_radius_to_bond_width_ratio,
3654 int smoothness_factor);
3667 const std::string &cid,
3668 const std::string &colour_scheme,
3669 const std::string &style,
3670 int secondary_structure_usage_flag);
3672 void make_mesh_for_gaussian_surface_for_blender(int imol, float sigma, float contour_level, float box_radius, float grid_scale, float b_factor);
3674
3676 void make_mesh_for_goodsell_style_for_blender(int imol, float colour_wheel_rotation_step,
3677 float saturation, float goodselliness);
3678
3680 std::vector<float> get_colour_table_for_blender(int imol);
3682 std::vector<float> get_vertices_for_blender(int imol);
3684 std::vector<int> get_triangles_for_blender(int imol);
3685
3686 // -------------------------------- Other ---------------------------------------
3687
3688 void test_function(const std::string &s);
3689
3690#if NB_VERSION_MAJOR
3691 // skip this (old) block for nanobinds
3692#else
3693#ifdef DOXYGEN_SHOULD_PARSE_THIS
3694
3696
3698 enum mesh_mode_t { UNKNOWN, SINGLE_COLOUR, MULTI_COLOUR };
3700 PyObject *simple_mesh_to_pythonic_mesh(const coot::simple_mesh_t &mesh, int mesh_mode);
3702 PyObject *get_pythonic_bonds_mesh(int imol, const std::string &mode, bool against_a_dark_background,
3703 float bond_width, float atom_radius_to_bond_width_ratio,
3704 int smoothness_factor);
3706 PyObject *get_pythonic_map_mesh(int imol, float x, float y, float z, float radius, float contour_level);
3708 PyObject *get_pythonic_molecular_representation_mesh(int imol, const std::string &atom_selection,
3709 const std::string &colour_sheme,
3710 const std::string &style,
3711 int secondary_structure_usage_flag);
3713 PyObject *get_pythonic_gaussian_surface_mesh(int imol, float sigma, float contour_level,
3714 float box_radius, float grid_scale, float fft_b_factor);
3731 PyObject *get_pythonic_simple_molecule(int imol, const std::string &cid, bool include_hydrogen_atoms_flag);
3732
3733#endif
3734#endif
3735
3736};
3737
3738#endif // MOLECULES_CONTAINER_HH
Definition api-cell.hh:35
Definition residue-and-atom-specs.hh:35
Definition coot-colour.hh:35
Definition instancing.hh:58
map histogram class
Definition coot-molecule.hh:1423
a container class for information about changing rotamers
Definition coot-molecule.hh:1202
Definition coot-molecule.hh:124
Definition residue-and-atom-specs.hh:216
The basic mesh for transfering mesh geometry and colours.
Definition simple-mesh.hh:38
map molecule centre
Definition coot-map-utils.hh:146
Definition sfcalc-genmap.hh:38
Definition validation-information.hh:39
Definition generic-3d-lines.hh:12
class for the information about columns extracted from auto-reading the given mtz file
Definition molecules-container.hh:1531
std::string Rfree
R-Free column. There were not available if the return value is empty.
Definition molecules-container.hh:1548
std::string sigF_obs
sigF_obs column
Definition molecules-container.hh:1546
std::string phi
phi column
Definition molecules-container.hh:1538
std::string w
weights column
Definition molecules-container.hh:1540
int idx
molecule index
Definition molecules-container.hh:1534
std::string F
F column.
Definition molecules-container.hh:1536
std::string F_obs
F_obs column. There were not available if the return value is empty.
Definition molecules-container.hh:1544
bool weights_used
flag for weights usage
Definition molecules-container.hh:1542
float get_fitting_score() const
Definition molecules-container.hh:3344
Definition molecules-container.hh:3535
void update_timer()
This function is called by the long-term job, udating the timer and count.
Definition molecules-container.hh:3547
double time_difference()
Definition molecules-container.hh:3555
Definition molecules-container.hh:1788
std::pair< int, unsigned int > delete_chain_using_cid(int imol, const std::string &cid)
void set_use_rama_plot_restraints(bool state)
Definition molecules-container.hh:2557
int imol_difference_map
Definition molecules-container.hh:404
std::pair< int, coot::instanced_mesh_t > minimize_energy(int imol, const std::string &atom_selection_cid, int n_cycles, bool do_rama_plot_restraints, float rama_plot_weight, bool do_torsion_restraints, float torsion_weight, bool refinement_is_quiet)
void set_max_number_of_threads(unsigned int n_threads)
std::vector< double > get_residue_sidechain_average_position(int imol, const std::string &cid) const
std::map< std::string, std::string > dictionary_atom_name_map(const std::string &comp_id_1, int imol_1, const std::string &comp_id_2, int imol_2)
std::string molecule_to_mmCIF_string(int imol) const
void set_imol_refinement_map(int i)
Definition molecules-container.hh:462
int fill_partial_residue_using_cid(int imol, const std::string &cid)
std::vector< std::pair< clipper::Coord_orth, float > > get_diff_diff_map_peaks(int imol_diff_map, float screen_centre_x, float screen_centre_y, float screen_centre_z) const
coot::instanced_mesh_t get_rotamer_dodecs_instanced(int imol)
coot::simple_mesh_t get_gaussian_surface(int imol, float sigma, float contour_level, float box_radius, float grid_scale, float b_factor) const
void clear_extra_restraints(int imol)
std::vector< positioned_atom_spec_t > get_atom_differences(int imol1, int imol2)
float fit_to_map_by_random_jiggle_using_cid(int imol, const std::string &cid, int n_trials, float translation_scale_factor)
void print_non_drawn_bonds(int imol) const
float fit_to_map_by_random_jiggle(int imol, const coot::residue_spec_t &res_spec, int n_trials, float translation_scale_factor)
bool is_valid_model_molecule(int imol) const
ltj_stats_t testing_interrogate_long_term_job()
Definition molecules-container.hh:3583
int servalcat_refine_xray(int imol, int imol_map, const std::string &output_prefix)
::api::cell_t get_cell(int imol) const
void set_use_torsion_restraints(bool state)
Definition molecules-container.hh:2577
void set_refinement_is_verbose(bool state)
Definition molecules-container.hh:2646
void clear()
Delete all molecules.
int get_monomer_from_dictionary(const std::string &comp_id, int imol, bool idealised_flag)
int generate_self_restraints(int imol, float local_dist_max)
int apply_transformation_to_atom_selection(int imol, const std::string &atoms_selection_cid, int n_atoms, float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22, float c0, float c1, float c2, float t0, float t1, float t2)
coot::acedrg_types_for_residue_t get_acedrg_atom_types_for_ligand(int imol, const std::string &residue_cid) const
int delete_hydrogen_atoms(int imol_model)
int copy_molecule(int imol)
std::vector< int > make_masked_maps_split_by_chain(int imol, int imol_map)
std::pair< int, unsigned int > delete_residue(int imol, const std::string &chain_id, int res_no, const std::string &ins_code)
void set_map_sampling_rate(float msr)
Definition molecules-container.hh:1505
bool is_valid_map_molecule(int imol_map) const
void add_lsq_superpose_match(const std::string &chain_id_ref, int res_no_ref_start, int res_no_ref_end, const std::string &chain_id_mov, int res_no_mov_start, int res_no_mov_end, int match_type)
void set_colour_wheel_rotation_base(int imol, float r)
int import_cif_dictionary(const std::string &cif_file_name, int imol_enc)
void eigen_flip_ligand(int imol, const std::string &chain_id, int res_no, const std::string &ins_code)
coot::util::sfcalc_genmap_stats_t sfcalc_genmaps_using_bulk_solvent(int imol_model, int imol_2fofc_map, int imol_updating_difference_map, int imol_map_with_data_attached)
void associate_sequence(int imol, const std::string &name_or_chain_id, const std::string &sequence)
std::pair< int, coot::instanced_mesh_t > refine(int imol, int n_cycles)
texture_as_floats_t get_map_section_texture(int imol, int section_id, int axis, float data_value_for_bottom, float data_value_for_top) const
std::pair< int, std::vector< merge_molecule_results_info_t > > merge_molecules(int imol, const std::string &list_of_other_molecules)
coot::simple_mesh_t test_origin_cube() const
coot::molecule_t::histogram_info_t get_map_vertices_histogram(int imol, int imol_map_for_sampling, double position_x, double position_y, double position_z, float radius, float contour_level, unsigned int n_bins)
int refine_residues(int imol, const std::string &chain_id, int res_no, const std::string &ins_code, const std::string &alt_conf, const std::string &mode, int n_cycles)
void set_map_colour_saturation(int imol, float s)
bool copy_dictionary(const std::string &monomer_name, int imol_current, int imol_new)
void set_user_defined_atom_colour_by_selection(int imol, const std::vector< std::pair< std::string, unsigned int > > &indexed_residues_cids, bool colour_applies_to_non_carbon_atoms_also)
std::string get_cif_file_name(const std::string &comp_id, int imol_enc) const
void add_target_position_restraint(int imol, const std::string &atom_cid, float pos_x, float pos_y, float pos_z)
std::pair< int, unsigned int > delete_atom(int imol, const std::string &chain_id, int res_no, const std::string &ins_code, const std::string &atom_name, const std::string &alt_conf)
void make_mesh_for_goodsell_style_for_blender(int imol, float colour_wheel_rotation_step, float saturation, float goodselliness)
blender
coot::simple_mesh_t get_mesh_for_ligand_validation_vs_dictionary(int imol, const std::string &ligand_cid)
void set_rama_plot_restraints_weight(float f)
Definition molecules-container.hh:2567
void export_molecular_representation_as_gltf(int imol, const std::string &atom_selection_cid, const std::string &colour_scheme, const std::string &style, int secondary_structure_usage_flag, const std::string &file_name)
std::vector< std::string > get_residue_names_with_no_dictionary(int imol) const
void print_secondary_structure_info(int imol) const
float get_torsion_restraints_weight() const
Definition molecules-container.hh:2592
bool match_ligand_torsions_and_position_using_cid(int imol_ligand, int imol_ref, const std::string &cid)
coot::validation_information_t get_q_score(int imol_model, int imol_map) const
void set_gltf_pbr_metalicity_factor(int imol, float metalicity)
coot::molecule_t::rotamer_change_info_t change_to_previous_rotamer(int imol, const std::string &residue_cid, const std::string &alt_conf)
coot::validation_information_t ramachandran_analysis(int imol_model) const
std::vector< coot::residue_spec_t > residues_with_missing_atoms(int imol)
int get_monomer(const std::string &monomer_name)
int make_mask(int imol_map_ref, int imol_model, const std::string &atom_selection_cid, float radius)
void add_to_non_drawn_bonds(int imol, const std::string &atom_selection_cid)
void replace_residue(int imol, const std::string &residue_cid, const std::string &new_residue_type, int imol_enc)
std::string package_version() const
void M2T_updateFloatParameter(int imol, const std::string &param_name, float value)
Update float parameter for MoleculesToTriangles molecular mesh.
void export_chemical_features_as_gltf(int imol, const std::string &cid, const std::string &file_name) const
std::pair< int, unsigned int > delete_literal_using_cid(int imol, const std::string &cid)
int get_monomer_and_position_at(const std::string &comp_id, int imol, float x, float y, float z)
std::vector< fit_ligand_info_t > fit_ligand_multi_ligand(int imol_protein, int imol_map, const std::string &multi_ligand_molecule_number_list, float n_rmsd, bool use_conformers, unsigned int n_conformers)
bool get_use_gemmi()
Get the state of using GEMMI for coordinates parsing.
Definition molecules-container.hh:423
float get_geman_mcclure_alpha() const
Definition molecules-container.hh:2656
std::string get_group_for_monomer(const std::string &residue_name) const
void set_add_waters_water_to_protein_distance_lim_min(float d)
Definition molecules-container.hh:2042
void clear_non_drawn_bonds(int imol)
std::vector< coot::atom_distance_t > get_distances_between_atoms_of_residues(int imol, const std::string &cid_res_1, const std::string &cid_res_2, float dist_max) const
void set_logging_level(const std::string &level)
bool shift_field_b_factor_refinement(int imol, int imol_with_data_attached)
void set_draw_missing_residue_loops(bool state)
int transform_map_using_lsq_matrix(int imol_map, lsq_results_t lsq_matrix, float x, float y, float z, float radius)
moorhen::header_info_t get_header_info(int imol) const
std::pair< int, std::string > change_chain_id(int imol, const std::string &from_chain_id, const std::string &to_chain_id, bool use_resno_range, int start_resno, int end_resno)
coot::instanced_mesh_t add_target_position_restraint_and_refine(int imol, const std::string &atom_cid, float pos_x, float pos_y, float pos_z, int n_cycles)
int redo(int imol)
int rotate_around_bond(int imol, const std::string &residue_cid, const std::string &atom_name_1, const std::string &atom_name_2, const std::string &atom_name_3, const std::string &atom_name_4, double torsion_angle)
int replace_fragment(int imol_base, int imol_reference, const std::string &atom_selection)
bool make_backups_flag
the backup-enable state (raw public if needed/preferred)
Definition molecules-container.hh:437
ltj_stats_t long_term_job_stats
long term job
Definition molecules-container.hh:3563
std::string r_factor_stats_as_string(const r_factor_stats &rfs) const
void set_use_bespoke_carbon_atom_colour(int imol, bool state)
void testing_start_long_term_job(unsigned int n_seconds)
coot::validation_information_t peptide_omega_analysis(int imol_model) const
superpose_results_t SSM_superpose(int imol_ref, const std::string &chain_id_ref, int imol_mov, const std::string &chain_id_mov)
generic_3d_lines_bonds_box_t make_exportable_environment_bond_box(int imol, coot::residue_spec_t &spec, float max_dist)
float minimize(int imol, const std::string &atom_selection_cid, int n_cycles, bool do_rama_plot_restraints, float rama_plot_weight, bool do_torsion_restraints, float torsion_weight, bool refinement_is_quiet)
coot::simple_mesh_t get_bonds_mesh(int imol, const std::string &mode, bool against_a_dark_background, float bond_width, float atom_radius_to_bond_width_ratio, int smoothness_factor)
void fill_rotamer_probability_tables()
Fill the rotamer probability tables (currently not ARG and LYS)
std::pair< std::map< coot::residue_spec_t, coot::util::density_correlation_stats_info_t >, std::map< coot::residue_spec_t, coot::util::density_correlation_stats_info_t > > get_mmrrcc(int imol, const std::string &chain_id, unsigned int n_residue_per_residue_range, int imol_map) const
void set_base_colour_for_bonds(int imol, float r, float g, float b)
std::vector< float > get_vertices_for_blender(int imol)
Function for Blender interface.
std::pair< int, unsigned int > delete_residue_using_cid(int imol, const std::string &cid)
coot::instanced_mesh_t get_goodsell_style_mesh_instanced(int imol, float colour_wheel_rotation_step, float saturation, float goodselliness)
std::vector< std::pair< coot::residue_spec_t, std::string > > get_single_letter_codes_for_chain(int imol, const std::string &chain_id) const
float get_map_mean(int imol) const
coot::molecule_t::histogram_info_t get_map_histogram(int imol, unsigned int n_bins, float zoom_factor) const
coot::chain_mutation_info_container_t get_mutation_info(int imol) const
std::pair< std::map< coot::residue_spec_t, coot::util::density_correlation_stats_info_t >, std::map< coot::residue_spec_t, coot::util::density_correlation_stats_info_t > > mmrrcc(int imol, const std::string &chain_id, int imol_map) const
void set_user_defined_bond_colours(int imol, const std::map< unsigned int, std::array< float, 4 > > &colour_map)
User-defined colour-index to colour.
std::vector< coot::molecule_t::interesting_place_t > pepflips_using_difference_map(int imol_coords, int imol_difference_map, float n_sigma) const
int copy_fragment_using_residue_range(int imol, const std::string &chain_id, int res_no_start, int res_no_end)
std::string get_cif_restraints_as_string(const std::string &comp_id, int imol_enc) const
void fix_atom_selection_during_refinement(int imol, const std::string &atom_selection_cid)
std::vector< std::pair< std::string, std::string > > get_gphl_chem_comp_info(const std::string &compound_id, int imol_enc)
int add_compound(int imol, const std::string &tlc, int imol_dict, int imol_map, float x, float y, float z)
double get_sum_density_for_atoms_in_residue(int imol, const std::string &cid, const std::vector< std::string > &atom_names, int imol_map)
coot::instanced_mesh_t get_extra_restraints_mesh(int imol, int mode)
int mask_map_by_atom_selection(int imol_coords, int imol_map, const std::string &cid, float atom_radius, bool invert_flag)
coot::simple_mesh_t get_map_contours_mesh_using_other_map_for_colours(int imol_ref, int imol_map_for_colouring, double position_x, double position_y, double position_z, float radius, float contour_level, float other_map_for_colouring_min_value, float other_map_for_colouring_max_value, bool invert_colour_ramp)
float fit_to_map_by_random_jiggle_with_blur_using_cid(int imol, int imol_map, const std::string &cid, float b_factor, int n_trials, float translation_scale_factor)
coot::validation_information_t rotamer_analysis(int imol_model) const
void export_map_molecule_as_gltf(int imol, float pos_x, float pos_y, float pos_z, float radius, float contour_level, const std::string &file_name)
coot::atom_overlaps_dots_container_t get_overlap_dots_for_ligand(int imol, const std::string &cid_ligand)
std::vector< coot::geometry_distortion_info_container_t > get_ligand_validation_vs_dictionary(int imol, const std::string &ligand_cid, bool include_non_bonded_contacts)
void set_temperature_factors_using_cid(int imol, const std::string &cid, float temp_fact)
bool get_use_torsion_restraints() const
Definition molecules-container.hh:2582
int dedust_map(int imol)
std::vector< int > split_multi_model_molecule(int imol)
coot::validation_information_t ramachandran_analysis_for_chain(int imol_model, const std::string &chain_id) const
coot::simple_mesh_t get_rotamer_dodecs(int imol)
coot::util::sfcalc_genmap_stats_t get_latest_sfcalc_stats() const
Definition molecules-container.hh:1786
coot::instanced_mesh_t get_bonds_mesh_instanced(int imol, const std::string &mode, bool against_a_dark_background, float bond_width, float atom_radius_to_bond_width_ratio, bool show_atoms_as_aniso_flag, bool show_aniso_atoms_as_ortep_flag, bool draw_hydrogen_atoms_flag, int smoothness_factor)
int undo(int imol)
void generate_chain_self_restraints(int imol, float local_dist_max, const std::string &chain_id)
coot::atom_spec_t atom_cid_to_atom_spec(int imol, const std::string &cid) const
void assign_sequence(int imol_model, int imol_map)
std::pair< int, double > get_torsion(int imol, const std::string &cid, const std::vector< std::string > &atom_names)
void print_colour_rules(int imol) const
void set_logging_file(const std::string &file_name)
std::string get_molecule_selection_as_json(int imol, const std::string &cid) const
std::pair< int, double > get_ligand_distortion(int imol, const std::string &ligand_cid, bool include_non_bonded_contacts)
int mmcif_tests(bool last_test_only)
std::vector< std::pair< std::string, std::string > > get_sequence_info(int imol) const
std::vector< int > get_dictionary_conformers(const std::string &comp_id, int imol_enc, bool remove_internal_clash_conformers)
void geometry_init_standard()
Read the standard list of residues.
int rail_points_total() const
std::pair< int, unsigned int > delete_residue_atoms_using_cid(int imol, const std::string &cid)
void multiply_residue_temperature_factors(int imol, const std::string &cid, float factor)
std::vector< std::string > get_chains_in_model(int imol) const
std::vector< coot::molecule_t::interesting_place_t > difference_map_peaks(int imol_map, int imol_protein, float n_rmsd) const
int average_map(const std::string &imol_maps, std::vector< float > &scales)
void make_mesh_for_molecular_representation_for_blender(int imol, const std::string &cid, const std::string &colour_scheme, const std::string &style, int secondary_structure_usage_flag)
std::vector< moorhen::h_bond > get_h_bonds(int imol, const std::string &cid_str, bool mcdonald_and_thornton_mode) const
std::vector< coot::residue_spec_t > get_residues_near_residue(int imol, const std::string &residue_cid, float dist) const
float get_suggested_initial_contour_level(int imol) const
int imol_refinement_map
Definition molecules-container.hh:400
int get_number_of_map_sections(int imol_map, int axis_id) const
bool try_read_dictionaries_for_new_residue_types(int imol)
int new_positions_for_residue_atoms(int imol, const std::string &residue_cid, std::vector< coot::api::moved_atom_t > &moved_atoms)
void generate_local_self_restraints(int imol, float local_dist_max, const std::string &residue_cids)
void init_refinement_of_molecule_as_fragment_based_on_reference(int imol_frag, int imol_ref, int imol_map)
std::string molecule_to_PDB_string(int imol) const
int auto_fit_rotamer(int imol, const std::string &chain_id, int res_no, const std::string &ins_code, const std::string &alt_conf, int imol_map)
std::pair< int, unsigned int > delete_residue_atoms_with_alt_conf(int imol, const std::string &chain_id, int res_no, const std::string &ins_code, const std::string &alt_conf)
void set_torsion_restraints_weight(float f)
Definition molecules-container.hh:2587
void add_named_glyco_tree(int imol_model, int imol_map, const std::string &glycosylation_name, const std::string &asn_chain_id, int asn_res_no)
void export_model_molecule_as_gltf(int imol, const std::string &selection_cid, const std::string &mode, bool against_a_dark_background, float bonds_width, float atom_radius_to_bond_width_ratio, int smoothness_factor, bool draw_hydrogen_atoms_flag, bool draw_missing_residue_loops, const std::string &file_name)
std::string file_name_to_string(const std::string &file_name) const
bool match_ligand_torsions_and_position(int imol_ligand, int imol_ref, const std::string &chain_id_ref, int resno_ref)
void eigen_flip_ligand_using_cid(int imol, const std::string &residue_cid)
std::pair< int, std::string > get_active_atom(float x, float y, float z, const std::string &displayed_model_molecules_list) const
int mutate(int imol, const std::string &cid, const std::string &new_residue_type)
void add_parallel_plane_restraint(int imol, const std::string &residue_cid_1, const std::string &residue_cid_2)
void set_show_timings(bool s)
Definition molecules-container.hh:502
void set_bespoke_carbon_atom_colour(int imol, const coot::colour_t &col)
int flood(int imol_model, int imol_map, float n_rmsd)
int make_power_scaled_map(int imol_ref, int imol_map_for_scaling)
void set_add_waters_variance_limit(float d)
Definition molecules-container.hh:2056
void delete_colour_rules(int imol)
coot::simple_mesh_t get_chemical_features_mesh(int imol, const std::string &cid) const
std::string jed_flip(int imol, const std::string &atom_cid, bool invert_selection)
std::vector< std::string > non_standard_residue_types_in_model(int imol) const
float get_density_at_position(int imol_map, float x, float y, float z) const
std::vector< coot::residue_spec_t > get_non_standard_residues_in_molecule(int imol) const
int read_coordinates(const std::string &file_name)
std::string pae_png(const std::string &pae_file_name) const
std::string get_hb_type(const std::string &compound_id, int imol_enc, const std::string &atom_name) const
std::string get_residue_type(int imol, const std::string &cid) const
int flip_hand(int imol_map)
int refine_residues_using_atom_cid(int imol, const std::string &cid, const std::string &mode, int n_cycles)
std::vector< fit_ligand_info_t > fit_ligand(int imol_protein, int imol_map, int imol_ligand, float n_rmsd, bool use_conformers, unsigned int n_conformers)
void associate_data_mtz_file_with_map(int imol, const std::string &data_mtz_file_name, const std::string &f_col, const std::string &sigf_col, const std::string &free_r_col)
std::string get_residue_name(int imol, const std::string &chain_id, int res_no, const std::string &ins_code) const
void make_mesh_for_gaussian_surface_for_blender(int imol, float sigma, float contour_level, float box_radius, float grid_scale, float b_factor)
Function for Blender interface.
void set_max_number_of_threads_in_thread_pool(unsigned int n_threads)
std::string get_rdkit_mol_pickle_base64(const std::string &residue_name, int imol_enc)
bool match_ligand_torsions(int imol_ligand, int imol_ref, const std::string &chain_id_ref, int resno_ref)
coot::molecule_t::rotamer_change_info_t change_to_first_rotamer(int imol, const std::string &residue_cid, const std::string &alt_conf)
void set_refinement_geman_mcclure_alpha(float a)
Definition molecules-container.hh:2651
float get_map_sampling_rate()
Definition molecules-container.hh:1497
std::vector< coot::atom_spec_t > find_water_baddies(int imol_model, int imol_map, float b_factor_lim, float outlier_sigma_level, float min_dist, float max_dist, bool ignore_part_occ_contact_flag, bool ignore_zero_occ_flag)
void set_molecule_name(int imol, const std::string &new_name)
std::vector< auto_read_mtz_info_t > auto_read_mtz(const std::string &file_name)
std::vector< glm::vec4 > get_colour_table(int imol, bool against_a_dark_background) const
int replace_map_by_mtz_from_file(int imol, const std::string &file_name, const std::string &f, const std::string &phi, const std::string &weight, bool use_weight)
void set_map_is_contoured_with_thread_pool(bool state)
mmdb::Residue * get_residue_using_cid(int imol, const std::string &cid) const
double get_radius_of_gyration(int imol) const
int fill_partial_residues(int imol)
bool delete_all_carbohydrate(int imol)
int write_coordinates(int imol, const std::string &file_name) const
bool regen_map(int imol_map, const std::string &imol_maps, const std::vector< float > &scales)
int copy_fragment_using_cid(int imol, const std::string &multi_cid)
void make_mesh_for_bonds_for_blender(int imol, const std::string &mode, bool against_a_dark_background, float bond_width, float atom_radius_to_bond_width_ratio, int smoothness_factor)
Function for Blender interface.
void end_delete_closed_molecules()
int read_small_molecule_cif(const std::string &file_name)
int add_terminal_residue_directly_using_cid(int imol, const std::string &cid)
void display_molecule_names_table() const
Debugging function: display the table of molecule and names.
void add_lsq_superpose_atom_match(const std::string &chain_id_ref, int res_no_ref, const std::string &atom_name_ref, const std::string &chain_id_mov, int res_no_mov, const std::string &atom_name_mov)
float get_map_rmsd_approx(int imol_map) const
coot::simple_mesh_t make_mesh_from_gltf_file(const std::string &file_name)
int get_imol_enc_any() const
int sharpen_blur_map_with_resample(int imol_map, float b_factor, float resample_factor, bool in_place_flag)
std::pair< int, std::string > add_terminal_residue_directly(int imol, const std::string &chain_id, int res_no, const std::string &ins_code)
mmdb::Atom * get_atom_using_cid(int imol, const std::string &cid) const
unsigned int get_number_of_molecules() const
Definition molecules-container.hh:449
coot::validation_information_t get_q_score_for_cid(int imol_model, const std::string &cid, int imol_map) const
std::pair< float, float > get_mean_and_variance_of_density_for_non_water_atoms(int imol_coords, int imol_map) const
std::vector< coot::plain_atom_overlap_t > get_atom_overlaps(int imol)
Get Atom Overlaps.
std::vector< int > fit_ligand_right_here(int imol_protein, int imol_map, int imol_ligand, float x, float y, float z, float n_rmsd, bool use_conformers, unsigned int n_conformers)
bool get_make_backups() const
Definition molecules-container.hh:434
std::vector< int > partition_map_by_chain(int imol_map, int imol_model)
float get_spherical_variance(int imol_map, int imol_model, const std::string &atom_cid, float mean_density_other_atoms) const
int get_number_of_hydrogen_atoms(int imol) const
std::vector< double > get_residue_CA_position(int imol, const std::string &cid) const
int refine_residue_range(int imol, const std::string &chain_id, int res_no_start, int res_no_end, int n_cycles)
int new_molecule(const std::string &name)
coot::molecule_t::rotamer_change_info_t change_to_next_rotamer(int imol, const std::string &residue_cid, const std::string &alt_conf)
std::string get_pucker_analysis_info(int imol) const
double test_thread_pool_threads(unsigned int n_threads)
std::vector< float > get_colour_table_for_blender(int imol)
Function for Blender interface.
int copy_fragment_for_refinement_using_cid(int imol, const std::string &multi_cid)
float get_temperature_factor_of_atom(int imol, const std::string &atom_cid) const
coot::residue_spec_t residue_cid_to_residue_spec(int imol, const std::string &cid) const
r_factor_stats get_r_factor_stats()
coot::simple_mesh_t get_ramachandran_validation_markup_mesh(int imol) const
int read_extra_restraints(int imol, const std::string &file_name)
void set_use_gemmi(bool state)
Definition molecules-container.hh:420
coot::instanced_mesh_t contact_dots_for_ligand(int imol, const std::string &cid, unsigned int smoothness_factor) const
void set_map_colour(int imol, float r, float g, float b)
int cis_trans_convert(int imol, const std::string &atom_cid)
int read_mtz(const std::string &file_name, const std::string &f, const std::string &phi, const std::string &weight, bool use_weight, bool is_a_difference_map)
std::string get_SMILES_for_residue_type(const std::string &residue_name, int imol_enc) const
int get_number_of_atoms_in_residue(int imol, const std::string &residue_cid) const
coot::symmetry_info_t get_symmetry(int imol, float symmetry_search_radius, float centre_x, float centre_y, float centre_z) const
molecules_container_t(bool verbose=true)
the one and only constructor
int close_molecule(int imol)
bool match_ligand_position(int imol_ligand, int imol_ref, const std::string &chain_id_ref, int resno_ref)
void testing_stop_long_term_job()
void clear_target_position_restraints(int imol)
float get_rama_plot_restraints_weight() const
Definition molecules-container.hh:2572
std::vector< std::string > get_types_in_molecule(int imol) const
get types
std::pair< int, unsigned int > delete_atom_using_cid(int imol, const std::string &cid)
coot::validation_information_t density_fit_analysis(int imol_model, int imol_map) const
lsq_results_t get_lsq_matrix(int imol_ref, int imol_mov, bool summary_to_screen) const
int fill_partial_residue(int imol, const std::string &chain_id, int res_no, const std::string &ins_code)
std::string get_molecule_name(int imol) const
void scale_map(int imol_map, float scale_factor)
bool is_EM_map(int imol) const
int set_residue_to_rotamer_number(int imol, const std::string &residue_cid, const std::string &alt_conf, int rotamer_number)
std::string get_svg_for_2d_ligand_environment_view(int imol, const std::string &residue_cid, bool add_key)
void clear_target_position_restraint(int imol, const std::string &atom_cid)
coot::simple_mesh_t get_octahemisphere(unsigned int n_divisions) const
unsigned int get_number_of_atoms(int imol) const
int read_pdb(const std::string &file_name)
int add_hydrogen_atoms(int imol_model)
std::vector< double > get_residue_average_position(int imol, const std::string &cid) const
float get_median_temperature_factor(int imol) const
bool contains_unsaved_models() const
bool lsq_superpose(int imol_ref, int imol_mov)
std::vector< coot::plain_atom_overlap_t > get_overlaps_for_ligand(int imol, const std::string &cid_ligand)
Gat Atom Overlaps for a ligand or residue.
std::vector< std::vector< std::string > > get_ncs_related_chains(int imol) const
float get_map_weight() const
Definition molecules-container.hh:472
void set_add_waters_water_to_protein_distance_lim_max(float d)
Definition molecules-container.hh:2049
double test_launching_threads(unsigned int n_threads_per_batch, unsigned int n_batches) const
void clear_lsq_matches()
Clear any existing lsq matchers.
int sharpen_blur_map(int imol_map, float b_factor, bool in_place_flag)
bool is_a_difference_map(int imol_map) const
void add_colour_rule(int imol, const std::string &selection_cid, const std::string &colour)
Add a colour rule for M2T representations.
std::pair< bool, clipper::Coord_orth > go_to_blob(float x1, float y1, float z1, float x2, float y2, float z2, float contour_level)
int move_molecule_to_new_centre(int imol, float x, float y, float z)
void turn_off_when_close_target_position_restraint(int imol)
int servalcat_refine_xray_with_keywords(int imol, int imol_map, const std::string &output_prefix, const nanobind::dict &key_value_pairs)
void set_make_backups(bool state)
Definition molecules-container.hh:429
double test_the_threading(int n_threads)
std::vector< coot::phi_psi_prob_t > ramachandran_validation(int imol) const
std::pair< int, unsigned int > delete_side_chain(int imol, const std::string &chain_id, int res_no, const std::string &ins_code)
int side_chain_180(int imol, const std::string &atom_cid)
coot::validation_information_t density_correlation_analysis(int imol_model, int imol_map) const
void write_png(const std::string &compound_id, int imol, const std::string &file_name) const
coot::util::map_molecule_centre_info_t get_map_molecule_centre(int imol) const
void sfcalc_genmap(int imol_model, int imol_map_with_data_attached, int imol_updating_difference_map)
std::pair< int, unsigned int > delete_side_chain_using_cid(int imol, const std::string &cid)
coot::simple::molecule_t get_simple_molecule(int imol, const std::string &residue_cid, bool draw_hydrogen_atoms_flag)
int read_ccp4_map(const std::string &file_name, bool is_a_difference_map)
coot::atom_overlaps_dots_container_t get_overlap_dots(int imol)
int change_alt_locs(int imol, const std::string &cid, const std::string &change_mode)
void set_map_weight(float w)
Definition molecules-container.hh:467
coot::simple_mesh_t get_map_contours_mesh(int imol, double position_x, double position_y, double position_z, float radius, float contour_level)
void set_gltf_pbr_roughness_factor(int imol, float roughness_factor)
std::vector< std::pair< double, double > > fourier_shell_correlation(int imol_map_1, int imol_map_2) const
int new_positions_for_atoms_in_residues(int imol, const std::vector< coot::api::moved_residue_t > &moved_residues)
float get_molecule_diameter(int imol) const
std::vector< std::pair< std::string, std::string > > get_acedrg_atom_types(const std::string &compound_id, int imol_enc) const
std::string get_svg_for_residue_type(int imol, const std::string &comp_id, bool use_rdkit_svg, const std::string &background_type)
void accept_rotamer_probability_tables_compressed_data(const std::string &data_stream)
std::vector< coot::molecule_t::interesting_place_t > get_interesting_places(int imol, const std::string &mode) const
std::vector< std::pair< std::string, std::string > > get_colour_rules(int imol) const
int connect_updating_maps(int imol_model, int imol_with_data_info_attached, int imol_map_2fofc, int imol_map_fofc)
coot::instanced_mesh_t get_bonds_mesh_for_selection_instanced(int imol, const std::string &atom_selection_cid, const std::string &mode, bool against_a_dark_background, float bond_width, float atom_radius_to_bond_width_ratio, bool show_atoms_as_aniso_flag, bool show_aniso_atoms_as_ortep_flag, bool draw_hydrogen_atoms_flag, int smoothness_factor)
std::string get_data_set_file_name(int imol) const
coot::instanced_mesh_t get_HOLE(int imol, float start_pos_x, float start_pos_y, float start_pos_z, float end_pos_x, float end_pos_y, float end_pos_z) const
coot::simple_mesh_t get_molecular_representation_mesh(int imol, const std::string &cid, const std::string &colour_scheme, const std::string &style, int secondary_structure_usage_flag)
double get_contouring_time() const
Definition molecules-container.hh:3588
coot::instanced_mesh_t all_molecule_contact_dots(int imol, unsigned int smoothness_factor) const
std::vector< double > get_eigenvalues(int imol, const std::string &chain_id, int res_no, const std::string &ins_code)
int flip_peptide_using_cid(int imol, const std::string &atom_cid, const std::string &alt_conf)
std::vector< coot::molecule_t::interesting_place_t > unmodelled_blobs(int imol_model, int imol_map, float rmsd_cut_off) const
int make_ensemble(const std::string &model_molecules_list)
void clear_refinement(int imol)
void pop_back()
Delete the most recent/last molecule in the molecule vector.
std::vector< coot::residue_range_t > get_missing_residue_ranges(int imol) const
void replace_molecule_by_model_from_file(int imol, const std::string &pdb_file_name)
void make_mesh_for_map_contours_for_blender(int imol, float x, float y, float z, float level, float radius)
Function for Blender interface.
void create_empty_molecules(unsigned int n_empty)
void M2T_updateIntParameter(int imol, const std::string &param_name, int value)
Update int parameter for MoleculesToTriangles molecular mesh.
int split_residue_using_map(int imol, const std::string &residue_cid, int imol_diff_map)
void set_add_waters_sigma_cutoff(float d)
Definition molecules-container.hh:2063
std::vector< std::string > get_groups_for_monomers(const std::vector< std::string > &residue_names) const
std::vector< int > get_triangles_for_blender(int imol)
Function for Blender interface.
bool residue_is_nucleic_acid(int imol, const std::string &cid) const
int write_map(int imol, const std::string &file_name) const
std::vector< coot::geometry_distortion_info_container_t > get_validation_vs_dictionary_for_selection(int imol, const std::string &selection_cid, bool include_non_bonded_contacts)
void set_occupancy(int imol, const std::string &cid, float occ_new)
int add_alternative_conformation(int imol_model, const std::string &cid)
bool get_use_rama_plot_restraints() const
Definition molecules-container.hh:2562
void save_unsaved_model_changes()
Save the unsaved model - this function has not yet been written!
float get_atom_overlap_score(int imol)
std::pair< int, unsigned int > delete_using_cid(int imol, const std::string &cid, const std::string &scope)
int add_terminal_residue_directly_using_bucca_ml_growing_using_cid(int imol, const std::string &cid)
coot::Cartesian get_molecule_centre(int imol) const
int add_waters(int imol_model, int imol_map)
void add_colour_rules_multi(int imol, const std::string &selections_and_colours_combo_string)
int rigid_body_fit(int imol, const std::string &multi_cid, int imol_map)
int add_terminal_residue_directly_using_bucca_ml_growing(int imol, const coot::residue_spec_t &spec)
superposition results
Definition superpose-results.hh:6