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_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 int get_molecule_index()
const {
return imol_no; }
603 bool is_valid_model_molecule()
const;
604 bool is_valid_map_molecule()
const;
605 unsigned int get_number_of_atoms()
const;
606 int get_number_of_hydrogen_atoms()
const;
607 float get_molecule_diameter()
const;
618 mmdb::Residue *cid_to_residue(
const std::string &cid)
const;
619 std::vector<mmdb::Residue *> cid_to_residues(
const std::string &cid)
const;
620 mmdb::Atom *cid_to_atom(
const std::string &cid)
const;
621 std::pair<bool, residue_spec_t> cid_to_residue_spec(
const std::string &cid)
const;
622 std::pair<bool, atom_spec_t> cid_to_atom_spec(
const std::string &cid)
const;
623 std::vector<std::string> get_residue_names_with_no_dictionary(
const protein_geometry &geom)
const;
625 int insert_waters_into_molecule(
const minimol::molecule &water_mol,
const std::string &res_name);
627 std::string get_molecule_selection_as_json(
const std::string &cid)
const;
638 void make_bonds(protein_geometry *geom, rotamer_probability_tables *rot_prob_tables_p,
639 bool draw_hydrogen_atoms_flag,
bool draw_missing_loops_flag);
643 std::vector<glm::vec4> make_colour_table_for_goodsell_style(
float colour_wheel_rotation_step,
644 float saturation,
float goodselliness)
const;
647 void print_colour_table(
const std::string &debugging_label)
const;
650 void print_secondary_structure_info()
const;
653 mmdb::Atom *get_atom(
const atom_spec_t &atom_spec)
const;
655 mmdb::Residue *get_residue(
const residue_spec_t &residue_spec)
const;
658 mmdb::Residue *get_residue(
const std::string &residue_cid)
const;
660 std::string get_residue_name(
const residue_spec_t &residue_spec)
const;
662 bool have_unsaved_changes()
const {
return modification_info.have_unsaved_changes(); }
666 int write_coordinates(
const std::string &file_name)
const;
674 std::vector<atom_spec_t> get_fixed_atoms()
const;
676 std::vector<std::string> chains_in_model()
const;
677 std::vector<std::pair<residue_spec_t, std::string> > get_single_letter_codes_for_chain(
const std::string &chain_id)
const;
679 residue_spec_t get_residue_closest_to(mmdb::Manager *mol,
const clipper::Coord_orth &co)
const;
681 std::vector<std::string> get_chain_ids()
const;
687 bool copy_ncs_chain(
const std::string &from_chain_id,
const std::string &to_chain_id);
714 simple_mesh_t get_bonds_mesh(
const std::string &mode, protein_geometry *geom,
715 bool against_a_dark_background,
716 float bonds_width,
float atom_radius_to_bond_width_ratio,
717 int smoothness_factor,
718 bool draw_hydrogen_atoms_flag,
719 bool draw_missing_residue_loops);
721 simple_mesh_t get_goodsell_style_mesh(protein_geometry *geom_p,
float colour_wheel_rotation_step,
722 float saturation,
float goodselliness);
724 instanced_mesh_t get_bonds_mesh_instanced(
const std::string &mode, protein_geometry *geom,
725 bool against_a_dark_background,
726 float bonds_width,
float atom_radius_to_bond_width_ratio,
727 bool render_atoms_as_aniso,
728 float aniso_probability,
729 bool render_aniso_atoms_as_ortep,
730 int smoothness_factor,
731 bool draw_hydrogen_atoms_flag,
732 bool draw_missing_residue_loops);
734 instanced_mesh_t get_bonds_mesh_for_selection_instanced(
const std::string &mode,
const std::string &selection_cid,
735 protein_geometry *geom,
736 bool against_a_dark_background,
737 float bonds_width,
float atom_radius_to_bond_width_ratio,
738 bool render_atoms_as_aniso,
739 bool render_aniso_atoms_as_ortep,
740 int smoothness_factor,
741 bool draw_hydrogen_atoms_flag,
742 bool draw_missing_residue_loops);
744 instanced_mesh_t get_goodsell_style_mesh_instanced(protein_geometry *geom_p,
float colour_wheel_rotation_step,
745 float saturation,
float goodselliness);
749 std::map<unsigned int, colour_holder> user_defined_bond_colours;
753 std::vector<std::pair<std::string, unsigned int> > indexed_user_defined_colour_selection_cids;
754 bool indexed_user_defined_colour_selection_cids_apply_to_non_carbon_atoms_also;
764 bool colour_applies_to_non_carbon_atoms_also,
768 void store_user_defined_atom_colour_selections(
const std::vector<std::pair<std::string, unsigned int> > &indexed_residues_cids,
769 bool colour_applies_to_non_carbon_atoms_also);
771 void apply_user_defined_atom_colour_selections(
const std::vector<std::pair<std::string, unsigned int> > &indexed_residues_cids,
772 bool colour_applies_to_non_carbon_atoms_also,
778 colour_holder base_colour_for_bonds;
783 std::set<int> no_bonds_to_these_atom_indices;
785 void add_to_non_drawn_bonds(
const std::string &atom_selection_cid);
787 void clear_non_drawn_bonds() { no_bonds_to_these_atom_indices.clear(); }
789 void print_non_drawn_bonds()
const;
791 void fill_default_colour_rules();
805 void print_colour_rules()
const;
811 std::vector<std::pair<std::string, float> > M2T_float_params;
812 std::vector<std::pair<std::string, int> > M2T_int_params;
820 void print_M2T_FloatParameters()
const;
822 void print_M2T_IntParameters()
const;
827 simple_mesh_t get_molecular_representation_mesh(
const std::string &cid,
828 const std::string &colour_scheme,
829 const std::string &style,
830 int secondaryStructureUsageFlag)
const;
832 simple_mesh_t get_gaussian_surface(
float sigma,
float contour_level,
833 float box_radius,
float grid_scale,
float fft_b_factor)
const;
835 simple_mesh_t get_chemical_features_mesh(
const std::string &cid,
const protein_geometry &geom)
const;
837 bool hydrogen_atom_should_be_drawn()
const {
return false; }
838 void set_use_bespoke_carbon_atom_colour(
bool state) {
839 use_bespoke_grey_colour_for_carbon_atoms = state;
842 void set_bespoke_carbon_atom_colour(
const colour_t &col) {
843 bespoke_carbon_atoms_colour = col;
849 float radius,
float contour_level,
850 const std::string &file_name);
854 const std::string &selection_cid,
855 protein_geometry *geom,
856 bool against_a_dark_background,
857 float bonds_width,
float atom_radius_to_bond_width_ratio,
int smoothness_factor,
858 bool draw_hydrogen_atoms_flag,
bool draw_missing_residue_loops,
859 const std::string &file_name);
862 void export_molecular_representation_as_gltf(
const std::string &atom_selection_cid,
863 const std::string &colour_scheme,
864 const std::string &style,
865 int secondary_structure_usage_flag,
866 const std::string &file_name);
868 void export_chemical_features_as_gltf(
const std::string &cid,
869 const protein_geometry &geom,
870 const std::string &file_name)
const;
872 float gltf_pbr_roughness;
873 float gltf_pbr_metalicity;
875 void set_show_symmetry(
bool f) { show_symmetry = f;}
876 bool get_show_symmetry() {
return show_symmetry;}
877 void transform_by(mmdb::mat44 SSMAlign_TMatrix);
878 void transform_by(
const clipper::RTop_orth &rtop, mmdb::Residue *res);
879 void transform_by(
const clipper::RTop_orth &rtop);
881 symmetry_info_t get_symmetry(
float symmetry_search_radius,
const Cartesian &symm_centre)
const;
885 std::vector<std::string> non_standard_residue_types_in_model()
const;
886 std::vector<phi_psi_prob_t> ramachandran_validation(
const ramachandrans_container_t &rc)
const;
888 simple_mesh_t get_rotamer_dodecs(protein_geometry *geom_p, rotamer_probability_tables *rpt);
890 instanced_mesh_t get_rotamer_dodecs_instanced(protein_geometry *geom_p, rotamer_probability_tables *rpt);
892 omega_distortion_info_container_t peptide_omega_analysis(
const protein_geometry &geom,
893 const std::string &chain_id,
894 bool mark_cis_peptides_as_bad_flag)
const;
896 std::vector<residue_spec_t> get_non_standard_residues_in_molecule()
const;
898 std::vector<std::string> get_residue_types_without_dictionaries(
const protein_geometry &geom)
const;
902 unsigned int num_subdivisions)
const;
906 unsigned int num_subdivisions)
const;
909 make_exportable_environment_bond_box(
coot::residue_spec_t &spec,
float max_dist, coot::protein_geometry &geom)
const;
915 const bool draw_hydrogen_atoms_flag,
916 coot::protein_geometry *geom_p);
919 bool draw_hydrogen_atoms_flag,
920 coot::protein_geometry *geom_p);
927 coot::protein_geometry &geom,
928 ctpl::thread_pool &static_thread_pool);
934 std::vector<coot::geometry_distortion_info_container_t>
936 coot::protein_geometry &geom,
937 ctpl::thread_pool &static_thread_pool);
943 std::vector<coot::geometry_distortion_info_container_t>
945 coot::protein_geometry &geom,
946 ctpl::thread_pool &static_thread_pool);
952 std::pair<int, double>
953 simple_geometric_distortions_from_mol(
const std::string &ligand_cid,
bool with_nbcs,
954 coot::protein_geometry &geom,
955 ctpl::thread_pool &static_thread_pool);
964 std::vector<coot::atom_distance_t>
966 const std::string &cid_res_2,
967 float dist_max)
const;
977 protein_geometry *geom_p);
984 protein_geometry *geom_p);
987 const clipper::Coord_orth &end_pos,
988 const protein_geometry &geom)
const;
1004 protein_geometry *geom,
1005 bool add_key)
const;
1008#ifdef MAKE_ENHANCED_LIGAND_TOOLS
1016 int move_molecule_to_new_centre(
const coot::Cartesian &new_centre);
1017 coot::Cartesian get_molecule_centre()
const;
1019 int flip_peptide(
const atom_spec_t &rs,
const std::string &alt_conf);
1020 int auto_fit_rotamer(
const std::string &chain_id,
int res_no,
const std::string &ins_code,
1021 const std::string &alt_conf,
1022 const clipper::Xmap<float> &xmap,
const coot::protein_geometry &pg);
1024 std::pair<bool,float> backrub_rotamer(mmdb::Residue *residue_p,
1025 const clipper::Xmap<float> &xmap,
1026 const coot::protein_geometry &pg);
1028 std::pair<bool,float> backrub_rotamer(
const std::string &chain_id,
int res_no,
1029 const std::string &ins_code,
const std::string &alt_conf,
1030 const clipper::Xmap<float> &xmap,
1031 const coot::protein_geometry &pg);
1034 int delete_atoms(
const std::vector<atom_spec_t> &atoms);
1037 int delete_residue_atoms_with_alt_conf(
coot::residue_spec_t &residue_spec,
const std::string &alt_conf);
1038 int delete_chain_using_atom_cid(
const std::string &cid);
1039 int delete_literal_using_cid(
const std::string &cid);
1041 int change_alt_locs(
const std::string &cid,
const std::string &change_mode);
1043 std::pair<int, std::string> add_terminal_residue_directly(
const residue_spec_t &spec,
1044 const std::string &new_res_type,
1045 const protein_geometry &geom,
1046 const clipper::Xmap<float> &xmap,
1047 mmdb::Manager *standard_residues_asc_mol,
1048 ctpl::thread_pool &static_thread_pool);
1050 void execute_simple_nucleotide_addition(
const std::string &term_type,
1051 mmdb::Residue *res_p,
const std::string &chain_id,
1052 mmdb::Manager *standard_residues_asc_mol);
1053 void execute_simple_nucleotide_addition(mmdb::Residue *residue_p,
1054 mmdb::Manager *standard_residues_asc_mol);
1055 void execute_simple_nucleotide_addition(
const std::string &cid,
1056 mmdb::Manager *standard_residues_asc_mol);
1058 int add_compound(
const dictionary_residue_restraints_t &monomer_restraints,
const Cartesian &position,
1059 const clipper::Xmap<float> &xmap,
float map_rmsd);
1067 const clipper::Xmap<float> &xmap,
const protein_geometry &geom);
1072 int mutate(
const residue_spec_t &spec,
const std::string &new_res_type);
1074 void add_named_glyco_tree(
const std::string &glycosylation_name,
const std::string &chain_id,
int res_no,
1075 const clipper::Xmap<float> &xmap, protein_geometry *geom);
1077 int side_chain_180(
const residue_spec_t &residue_spec,
const std::string &alt_conf,
1078 coot::protein_geometry *geom_p);
1082 std::string jed_flip(
coot::residue_spec_t &spec,
const std::string &atom_name,
const std::string &alt_conf,
1083 bool invert_selection, protein_geometry *geom);
1086 std::string jed_flip_internal(coot::atom_tree_t &tree,
1087 const std::vector<coot::dict_torsion_restraint_t> &interesting_torsions,
1088 const std::string &atom_name,
1089 bool invert_selection);
1092 std::string jed_flip_internal(coot::atom_tree_t &tree,
1093 const dict_torsion_restraint_t &torsion,
1094 const std::string &atom_name,
1095 bool invert_selection);
1102 int match_torsions(mmdb::Residue *res_ref,
1103 const std::vector <coot::dict_torsion_restraint_t> &tr_ligand,
1104 const coot::protein_geometry &geom);
1106 coot::minimol::molecule eigen_flip_residue(
const residue_spec_t &residue_spec);
1108 int apply_transformation_to_atom_selection(
const std::string &atom_selection_cid,
1109 int n_atoms_in_selection,
1110 clipper::Coord_orth &rotation_centre,
1111 clipper::RTop_orth &rtop);
1143 std::pair<int, std::string> change_chain_id(
const std::string &from_chain_id,
1144 const std::string &to_chain_id,
1145 bool use_resno_range,
1146 int start_resno,
int end_resno);
1150 std::pair<int, std::string>
1151 change_chain_id_with_residue_range(
const std::string &from_chain_id,
1152 const std::string &to_chain_id,
1155 void change_chain_id_with_residue_range_helper_insert_or_add(mmdb::Chain *to_chain_p, mmdb::Residue *new_residue);
1176 float fit_to_map_by_random_jiggle(
const residue_spec_t &res_spec,
const clipper::Xmap<float> &xmap,
float map_rmsd,
1177 int n_trials,
float translation_scale_factor);
1183 int n_trials,
float translation_scale_factor);
1185 int cis_trans_conversion(
const std::string &atom_cid, mmdb::Manager *standard_residues_mol);
1187 int replace_residue(
const std::string &residue_cid,
const std::string &new_residue_type,
int imol_enc,
1188 const protein_geometry &geom);
1192 int mutate_by_overlap(mmdb::Residue *residue_p,
const dictionary_residue_restraints_t &restraints);
1199 int replace_fragment(mmdb::Manager *mol_ref,
int old_atom_index_handle,
int SelHnd);
1202 class rotamer_change_info_t {
1229 int rotamer_change_direction,
1230 const coot::protein_geometry &pg);
1233 const std::string &alt_conf_in,
1235 const coot::protein_geometry &pg);
1237 void associate_sequence_with_molecule(
const std::string &chain_id,
const std::string &sequence);
1240 void assign_sequence(
const clipper::Xmap<float> &xmap,
const coot::protein_geometry &geom);
1252 bool is_het_residue(mmdb::Residue *residue_p)
const;
1255 std::pair<short int, int> next_residue_number_in_chain(mmdb::Chain *w,
1256 bool new_res_no_by_hundreds=
false)
const;
1258 mmdb::Residue *copy_and_add_residue_to_chain(mmdb::Chain *this_model_chain,
1259 mmdb::Residue *add_model_residue,
1260 bool new_resno_by_hundreds_flag=
true);
1261 void copy_and_add_chain_residues_to_chain(mmdb::Chain *new_chain, mmdb::Chain *this_molecule_chain);
1262 std::vector<std::string> map_chains_to_new_chains(
const std::vector<std::string> &adding_model_chains,
1263 const std::vector<std::string> &this_model_chains)
const;
1265 std::string suggest_new_chain_id(
const std::string ¤t_chain_id)
const;
1266 std::pair<bool, std::vector<std::string> > try_add_by_consolidation(mmdb::Manager *adding_mol);
1267 bool merge_molecules_just_one_residue_homogeneous(atom_selection_container_t molecule_to_add);
1268 bool merge_molecules_just_one_residue_at_given_spec(atom_selection_container_t molecule_to_add,
1272 std::pair<bool, coot::residue_spec_t> merge_ligand_to_near_chain(mmdb::Manager *mol);
1275 std::pair<int, std::vector<merge_molecule_results_info_t> >
1276 merge_molecules(
const std::vector<atom_selection_container_t> &add_molecules);
1279 std::pair<int, double>
1280 get_torsion(
const std::string &cid,
const std::vector<std::string> &atom_names)
const;
1284 set_temperature_factors_using_cid(
const std::string &cid,
float temp_fact);
1288 coot::extra_restraints_t extra_restraints;
1295 std::vector<mmdb::Residue *>
select_residues(
const std::string &chain_id,
int resno_start,
int resno_end)
const;
1297 std::vector<mmdb::Residue *>
select_residues(
const std::string &multi_cid,
const std::string &mode)
const;
1300 int refine_direct(std::vector<mmdb::Residue *> rv,
const std::string &alt_loc,
const clipper::Xmap<float> &xmap,
1301 unsigned int max_number_of_threads,
1302 float map_weight,
int n_cycles,
const coot::protein_geometry &geom,
1303 bool do_rama_plot_restraints,
float rama_plot_weight,
1304 bool do_torsion_restraints,
float torsion_weight,
1305 bool refinement_is_quiet);
1307 int minimize(
const std::string &atom_selection_cid,
1309 bool do_rama_plot_restraints,
float rama_plot_weight,
1310 bool do_torsion_restraints,
float torsion_weight,
bool refinement_is_quiet,
1311 coot::protein_geometry *geom_p);
1313 bool shiftfield_b_factor_refinement(
const clipper::HKL_data<clipper::data32::F_sigF> &F_sigF,
1314 const clipper::HKL_data<clipper::data32::Flag> &free_flag);
1316 void fix_atom_selection_during_refinement(
const std::string &atom_selection_cid);
1319 void init_all_molecule_refinement(
int imol_ref_mol, coot::protein_geometry &geom,
1320 const clipper::Xmap<float> &xmap,
float map_weight,
1321 ctpl::thread_pool *thread_pool);
1324 void add_target_position_restraint(
const std::string &atom_cid,
float pos_x,
float pos_y,
float pos_z);
1327 void turn_off_when_close_target_position_restraint();
1329 std::vector<std::pair<mmdb::Atom *, clipper::Coord_orth> > atoms_with_position_restraints;
1331 instanced_mesh_t add_target_position_restraint_and_refine(
const std::string &atom_cid,
float pos_x,
float pos_y,
float pos_z,
1333 coot::protein_geometry *geom_p);
1343 restraints_container_t *get_last_restraints() {
return last_restraints; }
1353 void generate_self_restraints(
float local_dist_max,
1354 const coot::protein_geometry &geom);
1355 void generate_chain_self_restraints(
float local_dist_max,
1356 const std::string &chain_id,
1357 const coot::protein_geometry &geom);
1358 void generate_local_self_restraints(
float local_dist_max,
1359 const std::vector<coot::residue_spec_t> &residue_specs,
1360 const coot::protein_geometry &geom);
1361 void generate_local_self_restraints(
float local_dist_max,
1362 const std::string &multi_selection_cid,
1363 const coot::protein_geometry &geom);
1364 void generate_local_self_restraints(
int selHnd,
float local_dist_max,
1365 const coot::protein_geometry &geom);
1371 std::vector<std::string> nucelotide_residue_name_to_base_atom_names(
const std::string &rn)
const;
1373 std::vector<std::string> residue_name_to_plane_atom_names(
const std::string &rn)
const;
1375 void clear_extra_restraints();
1378 int rigid_body_fit(
const std::string &mult_cids,
const clipper::Xmap<float> &xmap);
1380 int rotate_around_bond(
const std::string &residue_cid,
1381 const std::string &alt_conf,
1382 coot::atom_name_quad quad,
1383 double torsion_angle, protein_geometry &geom);
1387 void scale_map(
float scale_factor);
1389 bool is_EM_map()
const;
1391 float get_density_at_position(
const clipper::Coord_orth &pos)
const;
1394 float get_map_mean()
const;
1396 float get_map_rmsd_approx()
const;
1397 int write_map(
const std::string &file_name)
const;
1398 void set_map_is_difference_map(
bool flag);
1399 bool is_difference_map_p()
const;
1402 clipper::Xmap<float> updating_maps_previous_difference_map;
1404 std::vector<std::pair<clipper::Coord_orth, float> > updating_maps_diff_diff_map_peaks;
1405 void set_updating_maps_diff_diff_map_peaks(
const std::vector<std::pair<clipper::Coord_orth, float> > &v) {
1406 updating_maps_diff_diff_map_peaks = v; }
1414 simple_mesh_t get_map_contours_mesh(clipper::Coord_orth position,
float radius,
float contour_level,
1415 bool use_thread_pool, ctpl::thread_pool *thread_pool_p);
1416 simple_mesh_t get_map_contours_mesh_using_other_map_for_colours(
const clipper::Coord_orth &position,
float radius,
float contour_level,
1417 const clipper::Xmap<float> &xmap);
1418 simple_mesh_t get_map_contours_mesh_using_other_map_for_colours(
const clipper::Coord_orth &position,
float radius,
float contour_level,
1419 const user_defined_colour_table_t &udct,
1420 const clipper::Xmap<float> &xmap);
1423 class histogram_info_t {
1449 get_map_vertices_histogram(
const clipper::Xmap<float> &other_xmap,
1450 const clipper::Coord_orth &pt,
1451 float radius,
float contour_level,
1452 bool use_thread_pool, ctpl::thread_pool *thread_pool_p,
1453 unsigned int n_bins);
1455 void set_map_colour(colour_holder holder);
1456 void set_map_colour_saturation(
float s) { radial_map_colour_saturation = s; }
1462 void set_other_map_for_colouring_invert_colour_ramp(
bool state) {
1463 radial_map_colour_invert_flag = state;
1466 double sum_density_for_atoms_in_residue(
const std::string &cid,
1467 const std::vector<std::string> &atom_names,
1468 const clipper::Xmap<float> &xmap)
const;
1492 x = pt.x(); y = pt.y(); z = pt.z();
1499 x = pt.x(); y = pt.y(); z = pt.z();
1505 void set_badness_value(
const float &b) {
badness = b; }
1509 class difference_map_peaks_info_t {
1511 clipper::Coord_orth pos;
1514 difference_map_peaks_info_t(
const clipper::Coord_orth &p,
float ph) : pos(p), peak_height(ph) {}
1518 std::vector<interesting_place_t> difference_map_peaks(mmdb::Manager *mol,
float n_rmsd)
const;
1520 texture_as_floats_t get_map_section_texture(
int section_index,
int axis,
1521 float data_value_for_bottom,
float data_value_for_top)
const;
1530 blender_mesh_t blender_mesh;
1531 std::vector<float> get_vertices_for_blender()
const;
1532 std::vector<int> get_triangles_for_blender()
const;
1533 std::vector<float> get_colour_table_for_blender()
const;
1536 void make_mesh_for_bonds_for_blender(
const std::string &mode, protein_geometry *geom,
bool against_a_dark_background,
1537 float bond_width,
float atom_radius_to_bond_width_ratio,
1538 int smoothness_factor);
1547 const std::string &colour_scheme,
1548 const std::string &style,
1549 int secondary_structure_usage_flag);
1551 void make_mesh_for_goodsell_style_for_blender(protein_geometry *geom_p,
1552 float colour_wheel_rotation_step,
1554 float goodselliness);
1556 void make_mesh_for_map_contours_for_blender(Cartesian position,
float contour_level,
float radius);
1557 void make_mesh_for_gaussian_surface_for_blender(
float sigma,
float contour_level,
float box_radius,
float grid_scale,
float b_factor);