126 class molecule_save_info_t {
129 std::pair<time_t, int> last_saved;
130 int modification_index;
131 int max_modification_index;
132 molecule_save_info_t() : last_saved(std::make_pair(0,0)), modification_index(0),
133 max_modification_index(0) {}
134 void new_modification(
const std::string &mod_string) {
135 modification_index++;
137 std::cout <<
"new_modification: moved on to " << modification_index
138 <<
" by " << mod_string << std::endl;
139 if (modification_index > max_modification_index)
140 max_modification_index = modification_index;
144 last_saved.first = time(
nullptr);
145 last_saved.second = modification_index;
147 bool have_unsaved_changes()
const {
148 return modification_index > last_saved.second;
150 std::string index_string(
int idx)
const {
151 return std::to_string(idx);
153 void set_modification_index(
int idx) {
157 modification_index = idx;
159 int get_previous_modification_index()
const {
160 return modification_index - 1;
162 int get_next_modification_index()
const {
163 return modification_index + 1;
170 class modification_info_t {
174 save_info_t(
const std::string &file_name,
const std::string &mis) : file_name(file_name), modification_info_string(mis) {}
175 std::string file_name;
176 std::string modification_info_string;
177 mmdb::Manager *get_mol();
181 void print_save_info()
const;
183 modification_info_t() : backup_dir(
"coot-backup"), mol_name(
"placeholder"), is_mmcif_flag(false),
184 modification_index(0), max_modification_index(0) {}
185 modification_info_t(
const std::string &mol_name_for_backup,
bool is_mmcif) :
186 backup_dir(
"coot-backup"), mol_name(mol_name_for_backup), is_mmcif_flag(is_mmcif),
187 modification_index(0), max_modification_index(0) {}
188 std::string backup_dir;
189 std::string mol_name;
191 std::vector<save_info_t> save_info;
192 int modification_index;
193 int max_modification_index;
194 bool have_unsaved_changes()
const;
195 void set_molecule_name(
const std::string &molecule_name,
bool is_mmcif) { mol_name = molecule_name; is_mmcif_flag = is_mmcif; }
196 std::string get_index_string(
int idx)
const {
return std::to_string(idx); }
197 std::string get_backup_file_name_from_index(
int idx)
const;
199 std::string make_backup(mmdb::Manager *mol,
const std::string &modification_info_string);
201 mmdb::Manager *undo(mmdb::Manager *mol);
203 mmdb::Manager *redo();
207 modification_info_t modification_info;
212 int ligand_flip_number;
214 bool is_from_shelx_ins_flag;
217 std::map<residue_spec_t, int> current_rotamer_map;
218 bool really_do_backups;
221 void makebonds(protein_geometry *geom, rotamer_probability_tables *rotamer_tables_p,
222 const std::set<int> &no_bonds_to_these_atoms,
223 bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag);
225#if defined __has_builtin
226#if __has_builtin (__builtin_FUNCTION)
227 void make_bonds_type_checked(protein_geometry *geom, rotamer_probability_tables *rot_prob_tables_p,
bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag,
const char *s = __builtin_FUNCTION());
228 void make_bonds_type_checked(protein_geometry *geom,
const std::set<int> &no_bonds_to_these_atom_indices,
bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag,
const char *s = __builtin_FUNCTION());
230 void make_bonds_type_checked(protein_geometry *geom,
const char *s = 0);
231 void make_bonds_type_checked(protein_geometry *geom, rotamer_probability_tables *rot_prob_tables_p,
bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag,
const char *s = 0);
234 void make_bonds_type_checked(protein_geometry *geom,
const char *s = 0);
235 void make_bonds_type_checked(protein_geometry *geom, rotamer_probability_tables *rot_prob_tables_p,
bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag,
const char *s = 0);
238 api_bond_colour_t bonds_box_type;
239 graphical_bonds_container bonds_box;
240 api_bond_colour_t get_bonds_box_type()
const {
return bonds_box_type; }
244 void make_colour_by_chain_bonds(protein_geometry *geom,
245 const std::set<int> &no_bonds_to_these_atoms,
246 bool change_c_only_flag,
248 bool draw_hydrogen_atoms_flag,
249 bool draw_missing_loops_flag,
250 bool do_rota_markup=
false,
251 rotamer_probability_tables *rotamer_tables_p =
nullptr,
252 bool force_rebonding=
true);
253 void make_ca_bonds();
255 float bonds_colour_map_rotation;
257 glm::vec4 get_bond_colour_by_colour_wheel_position(
int icol, api_bond_colour_t bonds_box_type)
const;
258 colour_t get_bond_colour_by_mol_no(
int colour_index,
bool against_a_dark_background)
const;
259 colour_t get_bond_colour_basic(
int colour_index,
bool against_a_dark_background)
const;
260 bool use_bespoke_grey_colour_for_carbon_atoms;
261 colour_t bespoke_carbon_atoms_colour;
263 void update_map_triangles(
float radius, Cartesian centre,
float contour_level);
264 void update_map_triangles_using_thread_pool(
float radius, Cartesian centre,
float contour_level, ctpl::thread_pool *thread_pool_p);
266 short int is_em_map_cached_flag;
267 short int is_em_map_cached_state();
268 ghost_molecule_display_t map_ghost_info;
270 bool xmap_is_diff_map;
271 bool has_xmap()
const {
return is_valid_map_molecule(); }
273 colour_holder map_colour;
274 glm::vec4 position_to_colour_using_other_map(
const clipper::Coord_orth &position,
275 const clipper::Xmap<float> &other_map_for_colouring)
const;
276 float other_map_for_colouring_min_value;
277 float other_map_for_colouring_max_value;
278 glm::vec4 fraction_to_colour(
float f)
const;
279 bool radial_map_colour_invert_flag;
280 float radial_map_colour_saturation;
286 bool original_fphis_filled;
287 bool original_fobs_sigfobs_filled;
288 bool original_fobs_sigfobs_fill_tried_and_failed;
289 clipper::HKL_data< clipper::datatypes::F_phi<float> > *original_fphis_p;
290 clipper::HKL_data< clipper::datatypes::F_sigF<float> > *original_fobs_sigfobs_p;
291 clipper::HKL_data< clipper::data32::Flag> *original_r_free_flags_p;
293 void clear_draw_vecs();
294 void clear_diff_map_draw_vecs();
295 std::vector<density_contour_triangles_container_t> draw_vector_sets;
296 std::vector<density_contour_triangles_container_t> draw_diff_map_vector_sets;
297 std::vector<std::pair<int, TRIANGLE> > map_triangle_centres;
300 void insert_coords_internal(
const atom_selection_container_t &asc);
304 void replace_coords(
const atom_selection_container_t &asc,
305 bool change_altconf_occs_flag,
306 bool replace_coords_with_zero_occ_flag);
308 bool movable_atom(mmdb::Atom *mol_atom,
bool replace_coords_with_zero_occ_flag)
const;
309 bool moving_atom_matches(mmdb::Atom *at,
int this_mol_index_maybe)
const;
310 void adjust_occupancy_other_residue_atoms(mmdb::Atom *at,
311 mmdb::Residue *residue,
312 short int force_sum_1_flag);
315 int full_atom_spec_to_atom_index(
const atom_spec_t &atom_spec)
const;
317 int full_atom_spec_to_atom_index(
const std::string &chain,
319 const std::string &insertion_code,
320 const std::string &atom_name,
321 const std::string &alt_conf)
const;
323 std::string name_for_display_manager()
const;
324 std::string dotted_chopped_name()
const;
326 std::string make_backup(
const std::string &modification_type);
327 void save_history_file_name(
const std::string &file);
328 std::vector<std::string> history_filename_vec;
329 std::string save_time_string;
330 void restore_from_backup(
int mod_index,
const std::string &cwd);
332 std::vector<atom_spec_t> fixed_atom_specs;
334 std::pair<int, mmdb::Residue *>
335 find_serial_number_for_insert(
int seqnum_for_new,
336 const std::string &ins_code_for_new,
337 const std::string &chain_id)
const;
341 void remove_TER_internal(mmdb::Residue *res_p);
342 void remove_TER_on_last_residue(mmdb::Chain *chain_p);
343 std::pair<bool, std::string> unused_chain_id()
const;
344 int append_to_molecule(
const minimol::molecule &water_mol);
346 glm::vec4 colour_holder_to_glm(
const colour_holder &ch)
const;
348 std::pair<bool, Cartesian> get_HA_unit_vector(mmdb::Residue *r)
const;
351 void setup_cylinder_clashes(instanced_mesh_t &im,
const atom_overlaps_dots_container_t &c,
352 float ball_size,
unsigned int num_subdivisions,
353 const std::string &molecule_name_stub)
const;
356 void setup_dots(instanced_mesh_t &im,
357 const atom_overlaps_dots_container_t &c,
358 float ball_size,
unsigned int num_subdivisions,
359 const std::string &molecule_name_stub)
const;
363 std::pair<int, std::string> write_shelx_ins_file(
const std::string &filename)
const;
364 int read_shelx_ins_file(
const std::string &filename);
366 int add_shelx_string_to_molecule(
const std::string &str);
367 bool is_from_shelx_ins()
const {
return is_from_shelx_ins_flag; }
369 void trim_atom_label_table();
370 void delete_ghost_selections();
371 void update_symmetry();
375 void delete_any_link_containing_residue(
const residue_spec_t &res_spec);
377 void delete_link(mmdb::Link *link, mmdb::Model *model_p);
379 bool sanity_check_atoms(mmdb::Manager *mol)
const;
384 int set_residue_to_rotamer_move_atoms(mmdb::Residue *res, mmdb::Residue *moving_res);
388 float fit_to_map_by_random_jiggle(mmdb::PPAtom atom_selection,
390 const clipper::Xmap<float> &xmap,
393 float jiggle_scale_factor,
394 bool use_biased_density_scoring,
395 std::vector<mmdb::Chain *> chains_for_moving);
397 minimol::molecule rigid_body_fit(
const minimol::molecule &mol_in,
398 const clipper::Xmap<float> &xmap,
399 float map_sigma)
const;
403 std::vector<coot::geometry_distortion_info_pod_container_t>
404 geometric_distortions_from_mol(
const atom_selection_container_t &asc,
bool with_nbcs,
405 coot::protein_geometry &geom,
406 ctpl::thread_pool &static_thread_pool);
411 coot::restraints_container_t *last_restraints;
416 is_closed_flag =
false;
421 ligand_flip_number = 0;
422 bonds_box_type = api_bond_colour_t::UNSET_TYPE;
423 is_em_map_cached_flag =
false;
424 xmap_is_diff_map =
false;
425 is_from_shelx_ins_flag =
false;
426 show_symmetry =
false;
427 default_temperature_factor_for_new_atoms = 20.0;
428 original_fphis_filled =
false;
429 original_fobs_sigfobs_filled =
false;
430 original_fobs_sigfobs_fill_tried_and_failed =
false;
431 original_fphis_p =
nullptr;
432 original_fobs_sigfobs_p =
nullptr;
433 original_r_free_flags_p =
nullptr;
434 refmac_r_free_flag_sensible =
false;
435 use_bespoke_grey_colour_for_carbon_atoms =
false;
436 really_do_backups =
true;
438 radial_map_colour_saturation = 0.5;
439 radial_map_colour_invert_flag =
false;
441 other_map_for_colouring_min_value = 0.0;
442 other_map_for_colouring_max_value = 1.0;
444 map_colour = colour_holder(0.3, 0.3, 0.7);
445 last_restraints =
nullptr;
447 float rotate_colour_map_on_read_pdb = 0.24;
448 bonds_colour_map_rotation = (imol_no + 1) * rotate_colour_map_on_read_pdb;
449 while (bonds_colour_map_rotation > 360.0)
450 bonds_colour_map_rotation -= 360.0;
452 base_colour_for_bonds = colour_holder(0.43, 0.33, 0.2);
454 fill_default_colour_rules();
457 std::cout <<
"colour rules: " << std::endl;
458 std::cout <<
"-------------" << std::endl;
459 for (
unsigned int i=0; i<v.size(); i++) {
460 std::cout << i <<
" " << v[i].first <<
" " << v[i].second << std::endl;
462 std::cout <<
"-------------" << std::endl;
465 indexed_user_defined_colour_selection_cids_apply_to_non_carbon_atoms_also =
true;
467 gltf_pbr_roughness = 0.2;
468 gltf_pbr_metalicity = 0.0;
473 coot::fasta_multi multi_fasta_seq;
475 static std::string file_to_string(
const std::string &fn);
487 atom_selection_container_t atom_sel;
489 float default_temperature_factor_for_new_atoms;
492 std::vector<std::pair<bool, mmdb::Residue *> > neighbouring_residues;
495 molecule_t(
const std::string &name_in,
int mol_no_in) : name(name_in) {imol_no = mol_no_in; init(); }
497 molecule_t(
const std::string &name_in,
int mol_no_in,
short int is_em_map) : name(name_in) {
498 imol_no = mol_no_in; init(); is_em_map_cached_flag = is_em_map; }
500 molecule_t(
const std::string &name_in,
int mol_no_in,
const clipper::Xmap<float> &xmap_in,
bool is_em_map_flag)
501 : name(name_in), xmap(xmap_in) {imol_no = mol_no_in; init(); is_em_map_cached_flag = is_em_map_flag; }
503 explicit molecule_t(atom_selection_container_t asc,
int imol_no_in,
const std::string &name_in) : name(name_in), atom_sel(asc) {
504 imol_no = imol_no_in;
506 default_temperature_factor_for_new_atoms =
507 util::median_temperature_factor(atom_sel.atom_selection,
508 atom_sel.n_selected_atoms,
509 99999.9, 0.0,
false,
false);
512 float get_median_temperature_factor()
const;
514 float get_temperature_factor_of_atom(
const std::string &atom_cid)
const;
518 int close_yourself();
520 bool is_closed()
const {
return is_closed_flag; }
524 void set_really_do_backups(
bool state) { really_do_backups = state; }
529 void add_neighbor_residues_for_refinement_help(mmdb::Manager *mol);
533 void fill_fobs_sigfobs();
541 clipper::HKL_data<clipper::data32::F_sigF> *get_original_fobs_sigfobs()
const {
542 if (!original_fobs_sigfobs_filled) {
543 std::string m(
"Original Fobs/sigFobs is not filled");
544 throw(std::runtime_error(m));
546 return original_fobs_sigfobs_p;
549 clipper::HKL_data<clipper::data32::Flag> *get_original_rfree_flags()
const {
550 if (!original_fobs_sigfobs_filled) {
551 std::string m(
"Original Fobs/sigFobs is not filled - so no RFree flags");
552 throw(std::runtime_error(m));
554 return original_r_free_flags_p;
558 int sfcalc_genmap(
const clipper::HKL_data<clipper::data32::F_sigF> &fobs,
559 const clipper::HKL_data<clipper::data32::Flag> &free,
560 clipper::Xmap<float> *xmap_p);
561 util::sfcalc_genmap_stats_t
562 sfcalc_genmaps_using_bulk_solvent(
const clipper::HKL_data<clipper::data32::F_sigF> &fobs,
563 const clipper::HKL_data<clipper::data32::Flag> &free,
564 clipper::Xmap<float> *xmap_2fofc_p,
565 clipper::Xmap<float> *xmap_fofc_p);
568 std::pair<std::string, std::string> make_import_datanames(
const std::string &fcol,
569 const std::string &phi_col,
570 const std::string &weight_col,
571 int use_weights)
const;
573 std::string refmac_fobs_col;
574 std::string refmac_sigfobs_col;
575 std::string refmac_mtz_filename;
576 std::string refmac_r_free_col;
577 std::string Refmac_fobs_col()
const {
return refmac_fobs_col; }
578 std::string Refmac_sigfobs_col()
const {
return refmac_sigfobs_col; }
579 std::string Refmac_mtz_filename()
const {
return refmac_mtz_filename; }
580 bool refmac_r_free_flag_sensible;
582 void associate_data_mtz_file_with_map(
const std::string &data_mtz_file_name,
583 const std::string &f_col,
const std::string &sigf_col,
584 const std::string &r_free_col);
588 clipper::Xmap<float> xmap;
591 static std::atomic<bool> draw_vector_sets_lock;
593 util::map_molecule_centre_info_t get_map_molecule_centre()
const;
597 void replace_molecule_by_model_from_file(
const std::string &pdb_file_name);
599 std::string get_name()
const {
return name; }
600 void set_molecule_name(
const std::string &n) { name = n; };
601 mmdb::Manager *get_mol();
602 int get_molecule_index()
const {
return imol_no; }
604 bool is_valid_model_molecule()
const;
605 bool is_valid_map_molecule()
const;
606 unsigned int get_number_of_atoms()
const;
607 int get_number_of_hydrogen_atoms()
const;
608 float get_molecule_diameter()
const;
619 mmdb::Residue *cid_to_residue(
const std::string &cid)
const;
620 std::vector<mmdb::Residue *> cid_to_residues(
const std::string &cid)
const;
621 mmdb::Atom *cid_to_atom(
const std::string &cid)
const;
622 std::pair<bool, residue_spec_t> cid_to_residue_spec(
const std::string &cid)
const;
623 std::pair<bool, atom_spec_t> cid_to_atom_spec(
const std::string &cid)
const;
624 std::vector<std::string> get_residue_names_with_no_dictionary(
const protein_geometry &geom)
const;
626 int insert_waters_into_molecule(
const minimol::molecule &water_mol,
const std::string &res_name);
628 std::string get_molecule_selection_as_json(
const std::string &cid)
const;
629 std::string get_torsions_for_residues_in_chain_as_json(
const std::string &chain_id)
const;
640 void make_bonds(protein_geometry *geom, rotamer_probability_tables *rot_prob_tables_p,
641 bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag);
645 std::vector<glm::vec4> make_colour_table_for_goodsell_style(
float colour_wheel_rotation_step,
646 float saturation,
float goodselliness)
const;
649 void print_colour_table(
const std::string &debugging_label)
const;
652 void print_secondary_structure_info()
const;
655 mmdb::Atom *get_atom(
const atom_spec_t &atom_spec)
const;
657 mmdb::Residue *get_residue(
const residue_spec_t &residue_spec)
const;
660 mmdb::Residue *get_residue(
const std::string &residue_cid)
const;
662 std::string get_residue_name(
const residue_spec_t &residue_spec)
const;
664 bool have_unsaved_changes()
const {
return modification_info.have_unsaved_changes(); }
668 int write_coordinates(
const std::string &file_name)
const;
676 std::vector<atom_spec_t> get_fixed_atoms()
const;
678 std::vector<std::string> chains_in_model()
const;
679 std::vector<std::pair<residue_spec_t, std::string> > get_single_letter_codes_for_chain(
const std::string &chain_id)
const;
681 residue_spec_t get_residue_closest_to(mmdb::Manager *mol,
const clipper::Coord_orth &co)
const;
683 std::vector<std::string> get_chain_ids()
const;
689 bool copy_ncs_chain(
const std::string &from_chain_id,
const std::string &to_chain_id);
716 simple_mesh_t get_bonds_mesh(
const std::string &mode, protein_geometry *geom,
717 bool against_a_dark_background,
718 float bonds_width,
float atom_radius_to_bond_width_ratio,
719 int smoothness_factor,
720 bool draw_hydrogen_atoms_flag,
721 bool draw_missing_residue_loops);
723 simple_mesh_t get_goodsell_style_mesh(protein_geometry *geom_p,
float colour_wheel_rotation_step,
724 float saturation,
float goodselliness);
726 instanced_mesh_t get_bonds_mesh_instanced(
const std::string &mode, protein_geometry *geom,
727 bool against_a_dark_background,
728 float bonds_width,
float atom_radius_to_bond_width_ratio,
729 bool render_atoms_as_aniso,
730 float aniso_probability,
731 bool render_aniso_atoms_as_ortep,
732 bool render_aniso_atoms_as_empty,
733 int smoothness_factor,
734 bool draw_hydrogen_atoms_flag,
735 bool draw_missing_residue_loops);
737 instanced_mesh_t get_bonds_mesh_for_selection_instanced(
const std::string &mode,
const std::string &selection_cid,
738 protein_geometry *geom,
739 bool against_a_dark_background,
740 float bonds_width,
float atom_radius_to_bond_width_ratio,
741 bool render_atoms_as_aniso,
742 bool render_aniso_atoms_as_ortep,
743 bool render_aniso_atoms_as_empty,
744 int smoothness_factor,
745 bool draw_hydrogen_atoms_flag,
746 bool draw_missing_residue_loops);
748 instanced_mesh_t get_goodsell_style_mesh_instanced(protein_geometry *geom_p,
float colour_wheel_rotation_step,
749 float saturation,
float goodselliness);
753 std::map<unsigned int, colour_holder> user_defined_bond_colours;
757 std::vector<std::pair<std::string, unsigned int> > indexed_user_defined_colour_selection_cids;
758 bool indexed_user_defined_colour_selection_cids_apply_to_non_carbon_atoms_also;
768 bool colour_applies_to_non_carbon_atoms_also,
772 void store_user_defined_atom_colour_selections(
const std::vector<std::pair<std::string, unsigned int> > &indexed_residues_cids,
773 bool colour_applies_to_non_carbon_atoms_also);
775 void apply_user_defined_atom_colour_selections(
const std::vector<std::pair<std::string, unsigned int> > &indexed_residues_cids,
776 bool colour_applies_to_non_carbon_atoms_also,
782 colour_holder base_colour_for_bonds;
787 std::set<int> no_bonds_to_these_atom_indices;
789 void add_to_non_drawn_bonds(
const std::string &atom_selection_cid);
791 void clear_non_drawn_bonds() { no_bonds_to_these_atom_indices.clear(); }
793 void print_non_drawn_bonds()
const;
795 void fill_default_colour_rules();
809 void print_colour_rules()
const;
815 std::vector<std::pair<std::string, float> > M2T_float_params;
816 std::vector<std::pair<std::string, int> > M2T_int_params;
824 void print_M2T_FloatParameters()
const;
826 void print_M2T_IntParameters()
const;
831 simple_mesh_t get_molecular_representation_mesh(
const std::string &cid,
832 const std::string &colour_scheme,
833 const std::string &style,
834 int secondaryStructureUsageFlag)
const;
842 res_prop_t() : value(-1.1f), value_x(-1.1f), value_y(-1.1f), value_z(-1.1f) {}
843 bool filled_aniso()
const {
return value_x > 0.0f && value_y > 0.0f && value_z > 0.0f; }
845 std::map<coot::residue_spec_t, res_prop_t> residue_properties_map;
855 void clear_residue_properties();
857 simple_mesh_t get_gaussian_surface(
float sigma,
float contour_level,
858 float box_radius,
float grid_scale,
float fft_b_factor)
const;
860 simple_mesh_t get_gaussian_surface_for_atom_selection(
const std::string &cid,
float sigma,
float contour_level,
861 float box_radius,
float grid_scale,
float fft_b_factor)
const;
863 simple_mesh_t get_chemical_features_mesh(
const std::string &cid,
const protein_geometry &geom)
const;
865 bool hydrogen_atom_should_be_drawn()
const {
return false; }
866 void set_use_bespoke_carbon_atom_colour(
bool state) {
867 use_bespoke_grey_colour_for_carbon_atoms = state;
870 void set_bespoke_carbon_atom_colour(
const colour_t &col) {
871 bespoke_carbon_atoms_colour = col;
877 float radius,
float contour_level,
878 const std::string &file_name);
882 const std::string &selection_cid,
883 protein_geometry *geom,
884 bool against_a_dark_background,
885 float bonds_width,
float atom_radius_to_bond_width_ratio,
int smoothness_factor,
886 bool draw_hydrogen_atoms_flag,
bool draw_missing_residue_loops,
887 const std::string &file_name);
890 void export_molecular_representation_as_gltf(
const std::string &atom_selection_cid,
891 const std::string &colour_scheme,
892 const std::string &style,
893 int secondary_structure_usage_flag,
894 const std::string &file_name);
896 void export_chemical_features_as_gltf(
const std::string &cid,
897 const protein_geometry &geom,
898 const std::string &file_name)
const;
900 float gltf_pbr_roughness;
901 float gltf_pbr_metalicity;
903 void set_show_symmetry(
bool f) { show_symmetry = f;}
904 bool get_show_symmetry() {
return show_symmetry;}
905 void transform_by(mmdb::mat44 SSMAlign_TMatrix);
906 void transform_by(
const clipper::RTop_orth &rtop, mmdb::Residue *res);
907 void transform_by(
const clipper::RTop_orth &rtop);
909 symmetry_info_t get_symmetry(
float symmetry_search_radius,
const Cartesian &symm_centre)
const;
913 std::vector<std::string> non_standard_residue_types_in_model()
const;
914 std::vector<phi_psi_prob_t> ramachandran_validation(
const ramachandrans_container_t &rc)
const;
916 simple_mesh_t get_rotamer_dodecs(protein_geometry *geom_p, rotamer_probability_tables *rpt);
918 instanced_mesh_t get_rotamer_dodecs_instanced(protein_geometry *geom_p, rotamer_probability_tables *rpt);
920 omega_distortion_info_container_t peptide_omega_analysis(
const protein_geometry &geom,
921 const std::string &chain_id,
922 bool mark_cis_peptides_as_bad_flag)
const;
924 std::vector<residue_spec_t> get_non_standard_residues_in_molecule()
const;
926 std::vector<std::string> get_residue_types_without_dictionaries(
const protein_geometry &geom)
const;
930 unsigned int num_subdivisions)
const;
934 unsigned int num_subdivisions)
const;
937 make_exportable_environment_bond_box(
coot::residue_spec_t &spec,
float max_dist, coot::protein_geometry &geom)
const;
943 const bool draw_hydrogen_atoms_flag,
944 coot::protein_geometry *geom_p);
947 bool draw_hydrogen_atoms_flag,
948 coot::protein_geometry *geom_p);
955 coot::protein_geometry &geom,
956 ctpl::thread_pool &static_thread_pool);
962 std::vector<coot::geometry_distortion_info_pod_container_t>
964 coot::protein_geometry &geom,
965 ctpl::thread_pool &static_thread_pool);
971 std::vector<coot::geometry_distortion_info_pod_container_t>
973 coot::protein_geometry &geom,
974 ctpl::thread_pool &static_thread_pool);
980 std::pair<int, double>
981 simple_geometric_distortions_from_mol(
const std::string &ligand_cid,
bool with_nbcs,
982 coot::protein_geometry &geom,
983 ctpl::thread_pool &static_thread_pool);
992 std::vector<coot::atom_distance_t>
994 const std::string &cid_res_2,
995 float dist_max)
const;
1005 protein_geometry *geom_p);
1012 protein_geometry *geom_p);
1015 const clipper::Coord_orth &end_pos,
1016 const protein_geometry &geom)
const;
1032 protein_geometry *geom,
1033 bool add_key)
const;
1036#ifdef MAKE_ENHANCED_LIGAND_TOOLS
1044 int move_molecule_to_new_centre(
const coot::Cartesian &new_centre);
1045 coot::Cartesian get_molecule_centre()
const;
1047 int flip_peptide(
const atom_spec_t &rs,
const std::string &alt_conf);
1048 int auto_fit_rotamer(
const std::string &chain_id,
int res_no,
const std::string &ins_code,
1049 const std::string &alt_conf,
1050 const clipper::Xmap<float> &xmap,
const coot::protein_geometry &pg);
1052 std::pair<bool,float> backrub_rotamer(mmdb::Residue *residue_p,
1053 const clipper::Xmap<float> &xmap,
1054 const coot::protein_geometry &pg);
1056 std::pair<bool,float> backrub_rotamer(
const std::string &chain_id,
int res_no,
1057 const std::string &ins_code,
const std::string &alt_conf,
1058 const clipper::Xmap<float> &xmap,
1059 const coot::protein_geometry &pg);
1062 int delete_atoms(
const std::vector<atom_spec_t> &atoms);
1065 int delete_residue_atoms_with_alt_conf(
coot::residue_spec_t &residue_spec,
const std::string &alt_conf);
1066 int delete_chain_using_atom_cid(
const std::string &cid);
1067 int delete_literal_using_cid(
const std::string &cid);
1069 int change_alt_locs(
const std::string &cid,
const std::string &change_mode);
1071 std::pair<int, std::string> add_terminal_residue_directly(
const residue_spec_t &spec,
1072 const std::string &new_res_type,
1073 const protein_geometry &geom,
1074 const clipper::Xmap<float> &xmap,
1075 mmdb::Manager *standard_residues_asc_mol,
1076 ctpl::thread_pool &static_thread_pool);
1078 void execute_simple_nucleotide_addition(
const std::string &term_type,
1079 mmdb::Residue *res_p,
const std::string &chain_id,
1080 mmdb::Manager *standard_residues_asc_mol);
1081 void execute_simple_nucleotide_addition(mmdb::Residue *residue_p,
1082 mmdb::Manager *standard_residues_asc_mol);
1083 void execute_simple_nucleotide_addition(
const std::string &cid,
1084 mmdb::Manager *standard_residues_asc_mol);
1086 int add_compound(
const dictionary_residue_restraints_t &monomer_restraints,
const Cartesian &position,
1087 const clipper::Xmap<float> &xmap,
float map_rmsd);
1095 const clipper::Xmap<float> &xmap,
const protein_geometry &geom);
1100 int mutate(
const residue_spec_t &spec,
const std::string &new_res_type);
1102 void add_named_glyco_tree(
const std::string &glycosylation_name,
const std::string &chain_id,
int res_no,
1103 const clipper::Xmap<float> &xmap, protein_geometry *geom);
1105 int side_chain_180(
const residue_spec_t &residue_spec,
const std::string &alt_conf,
1106 coot::protein_geometry *geom_p);
1110 std::string jed_flip(
coot::residue_spec_t &spec,
const std::string &atom_name,
const std::string &alt_conf,
1111 bool invert_selection, protein_geometry *geom);
1114 std::string jed_flip_internal(coot::atom_tree_t &tree,
1115 const std::vector<coot::dict_torsion_restraint_t> &interesting_torsions,
1116 const std::string &atom_name,
1117 bool invert_selection);
1120 std::string jed_flip_internal(coot::atom_tree_t &tree,
1121 const dict_torsion_restraint_t &torsion,
1122 const std::string &atom_name,
1123 bool invert_selection);
1130 int match_torsions(mmdb::Residue *res_ref,
1131 const std::vector <coot::dict_torsion_restraint_t> &tr_ligand,
1132 const coot::protein_geometry &geom);
1134 coot::minimol::molecule eigen_flip_residue(
const residue_spec_t &residue_spec);
1136 int apply_transformation_to_atom_selection(
const std::string &atom_selection_cid,
1137 int n_atoms_in_selection,
1138 clipper::Coord_orth &rotation_centre,
1139 clipper::RTop_orth &rtop);
1171 std::pair<int, std::string> change_chain_id(
const std::string &from_chain_id,
1172 const std::string &to_chain_id,
1173 bool use_resno_range,
1174 int start_resno,
int end_resno);
1178 std::pair<int, std::string>
1179 change_chain_id_with_residue_range(
const std::string &from_chain_id,
1180 const std::string &to_chain_id,
1183 void change_chain_id_with_residue_range_helper_insert_or_add(mmdb::Chain *to_chain_p, mmdb::Residue *new_residue);
1204 float fit_to_map_by_random_jiggle(
const residue_spec_t &res_spec,
const clipper::Xmap<float> &xmap,
float map_rmsd,
1205 int n_trials,
float translation_scale_factor);
1211 int n_trials,
float translation_scale_factor);
1213 int cis_trans_conversion(
const std::string &atom_cid, mmdb::Manager *standard_residues_mol);
1215 int replace_residue(
const std::string &residue_cid,
const std::string &new_residue_type,
int imol_enc,
1216 const protein_geometry &geom);
1220 int mutate_by_overlap(mmdb::Residue *residue_p,
const dictionary_residue_restraints_t &restraints);
1227 int replace_fragment(mmdb::Manager *mol_ref,
int old_atom_index_handle,
int SelHnd);
1230 class rotamer_change_info_t {
1257 int rotamer_change_direction,
1258 const coot::protein_geometry &pg);
1261 const std::string &alt_conf_in,
1263 const coot::protein_geometry &pg);
1265 void associate_sequence_with_molecule(
const std::string &chain_id,
const std::string &sequence);
1268 void assign_sequence(
const clipper::Xmap<float> &xmap,
const coot::protein_geometry &geom);
1280 bool is_het_residue(mmdb::Residue *residue_p)
const;
1283 std::pair<short int, int> next_residue_number_in_chain(mmdb::Chain *w,
1284 bool new_res_no_by_hundreds=
false)
const;
1286 mmdb::Residue *copy_and_add_residue_to_chain(mmdb::Chain *this_model_chain,
1287 mmdb::Residue *add_model_residue,
1288 bool new_resno_by_hundreds_flag=
true);
1289 void copy_and_add_chain_residues_to_chain(mmdb::Chain *new_chain, mmdb::Chain *this_molecule_chain);
1290 std::vector<std::string> map_chains_to_new_chains(
const std::vector<std::string> &adding_model_chains,
1291 const std::vector<std::string> &this_model_chains)
const;
1293 std::string suggest_new_chain_id(
const std::string ¤t_chain_id)
const;
1294 std::pair<bool, std::vector<std::string> > try_add_by_consolidation(mmdb::Manager *adding_mol);
1295 bool merge_molecules_just_one_residue_homogeneous(atom_selection_container_t molecule_to_add);
1296 bool merge_molecules_just_one_residue_at_given_spec(atom_selection_container_t molecule_to_add,
1300 std::pair<bool, coot::residue_spec_t> merge_ligand_to_near_chain(mmdb::Manager *mol);
1303 std::pair<int, std::vector<merge_molecule_results_info_t> >
1304 merge_molecules(
const std::vector<atom_selection_container_t> &add_molecules);
1307 std::pair<int, double>
1308 get_torsion(
const std::string &cid,
const std::vector<std::string> &atom_names)
const;
1312 set_temperature_factors_using_cid(
const std::string &cid,
float temp_fact);
1316 coot::extra_restraints_t extra_restraints;
1323 std::vector<mmdb::Residue *>
select_residues(
const std::string &chain_id,
int resno_start,
int resno_end)
const;
1325 std::vector<mmdb::Residue *>
select_residues(
const std::string &multi_cid,
const std::string &mode)
const;
1328 int refine_direct(std::vector<mmdb::Residue *> rv,
const std::string &alt_loc,
const clipper::Xmap<float> &xmap,
1329 unsigned int max_number_of_threads,
1330 float map_weight,
int n_cycles,
const coot::protein_geometry &geom,
1331 bool do_rama_plot_restraints,
float rama_plot_weight,
1332 bool do_torsion_restraints,
float torsion_weight,
1333 bool refinement_is_quiet);
1335 int minimize(
const std::string &atom_selection_cid,
1337 bool do_rama_plot_restraints,
float rama_plot_weight,
1338 bool do_torsion_restraints,
float torsion_weight,
bool refinement_is_quiet,
1339 coot::protein_geometry *geom_p);
1341 bool shiftfield_b_factor_refinement(
const clipper::HKL_data<clipper::data32::F_sigF> &F_sigF,
1342 const clipper::HKL_data<clipper::data32::Flag> &free_flag);
1344 void fix_atom_selection_during_refinement(
const std::string &atom_selection_cid);
1347 void init_all_molecule_refinement(
int imol_ref_mol, coot::protein_geometry &geom,
1348 const clipper::Xmap<float> &xmap,
float map_weight,
1349 ctpl::thread_pool *thread_pool);
1352 void add_target_position_restraint(
const std::string &atom_cid,
float pos_x,
float pos_y,
float pos_z);
1355 void turn_off_when_close_target_position_restraint();
1357 std::vector<std::pair<mmdb::Atom *, clipper::Coord_orth> > atoms_with_position_restraints;
1359 instanced_mesh_t add_target_position_restraint_and_refine(
const std::string &atom_cid,
float pos_x,
float pos_y,
float pos_z,
1361 coot::protein_geometry *geom_p);
1371 restraints_container_t *get_last_restraints() {
return last_restraints; }
1381 void generate_self_restraints(
float local_dist_max,
1382 const coot::protein_geometry &geom);
1383 void generate_chain_self_restraints(
float local_dist_max,
1384 const std::string &chain_id,
1385 const coot::protein_geometry &geom);
1386 void generate_local_self_restraints(
float local_dist_max,
1387 const std::vector<coot::residue_spec_t> &residue_specs,
1388 const coot::protein_geometry &geom);
1389 void generate_local_self_restraints(
float local_dist_max,
1390 const std::string &multi_selection_cid,
1391 const coot::protein_geometry &geom);
1392 void generate_local_self_restraints(
int selHnd,
float local_dist_max,
1393 const coot::protein_geometry &geom);
1399 std::vector<std::string> nucelotide_residue_name_to_base_atom_names(
const std::string &rn)
const;
1401 std::vector<std::string> residue_name_to_plane_atom_names(
const std::string &rn)
const;
1403 void clear_extra_restraints();
1406 int rigid_body_fit(
const std::string &mult_cids,
const clipper::Xmap<float> &xmap);
1408 int rotate_around_bond(
const std::string &residue_cid,
1409 const std::string &alt_conf,
1410 coot::atom_name_quad quad,
1411 double torsion_angle, protein_geometry &geom);
1415 void scale_map(
float scale_factor);
1417 bool is_EM_map()
const;
1419 float get_density_at_position(
const clipper::Coord_orth &pos)
const;
1422 float get_map_mean()
const;
1424 float get_map_rmsd_approx()
const;
1425 int write_map(
const std::string &file_name)
const;
1426 void set_map_is_difference_map(
bool flag);
1427 bool is_difference_map_p()
const;
1430 clipper::Xmap<float> updating_maps_previous_difference_map;
1432 std::vector<std::pair<clipper::Coord_orth, float> > updating_maps_diff_diff_map_peaks;
1433 void set_updating_maps_diff_diff_map_peaks(
const std::vector<std::pair<clipper::Coord_orth, float> > &v) {
1434 updating_maps_diff_diff_map_peaks = v; }
1442 simple_mesh_t get_map_contours_mesh(clipper::Coord_orth position,
float radius,
float contour_level,
1443 bool use_thread_pool, ctpl::thread_pool *thread_pool_p);
1444 simple_mesh_t get_map_contours_mesh_using_other_map_for_colours(
const clipper::Coord_orth &position,
float radius,
float contour_level,
1445 const clipper::Xmap<float> &xmap);
1446 simple_mesh_t get_map_contours_mesh_using_other_map_for_colours(
const clipper::Coord_orth &position,
float radius,
float contour_level,
1447 const user_defined_colour_table_t &udct,
1448 const clipper::Xmap<float> &xmap);
1451 class histogram_info_t {
1477 get_map_vertices_histogram(
const clipper::Xmap<float> &other_xmap,
1478 const clipper::Coord_orth &pt,
1479 float radius,
float contour_level,
1480 bool use_thread_pool, ctpl::thread_pool *thread_pool_p,
1481 unsigned int n_bins);
1483 void set_map_colour(colour_holder holder);
1484 void set_map_colour_saturation(
float s) { radial_map_colour_saturation = s; }
1490 void set_other_map_for_colouring_invert_colour_ramp(
bool state) {
1491 radial_map_colour_invert_flag = state;
1494 double sum_density_for_atoms_in_residue(
const std::string &cid,
1495 const std::vector<std::string> &atom_names,
1496 const clipper::Xmap<float> &xmap)
const;
1520 x = pt.x(); y = pt.y(); z = pt.z();
1527 x = pt.x(); y = pt.y(); z = pt.z();
1533 void set_badness_value(
const float &b) {
badness = b; }
1537 class difference_map_peaks_info_t {
1539 clipper::Coord_orth pos;
1542 difference_map_peaks_info_t(
const clipper::Coord_orth &p,
float ph) : pos(p), peak_height(ph) {}
1546 std::vector<interesting_place_t> difference_map_peaks(mmdb::Manager *mol,
float n_rmsd)
const;
1548 texture_as_floats_t get_map_section_texture(
int section_index,
int axis,
1549 float data_value_for_bottom,
float data_value_for_top)
const;
1558 blender_mesh_t blender_mesh;
1559 std::vector<float> get_vertices_for_blender()
const;
1560 std::vector<int> get_triangles_for_blender()
const;
1561 std::vector<float> get_colour_table_for_blender()
const;
1564 void make_mesh_for_bonds_for_blender(
const std::string &mode, protein_geometry *geom,
bool against_a_dark_background,
1565 float bond_width,
float atom_radius_to_bond_width_ratio,
1566 int smoothness_factor);
1575 const std::string &colour_scheme,
1576 const std::string &style,
1577 int secondary_structure_usage_flag);
1579 void make_mesh_for_goodsell_style_for_blender(protein_geometry *geom_p,
1580 float colour_wheel_rotation_step,
1582 float goodselliness);
1584 void make_mesh_for_map_contours_for_blender(Cartesian position,
float contour_level,
float radius);
1585 void make_mesh_for_gaussian_surface_for_blender(
float sigma,
float contour_level,
float box_radius,
float grid_scale,
float b_factor);