2#ifndef STORMM_SYNTHESIS_PERMUTOR_H
3#define STORMM_SYNTHESIS_PERMUTOR_H
7#include "Accelerator/hybrid.h"
8#include "Chemistry/chemical_features.h"
9#include "Chemistry/chemistry_enumerators.h"
10#include "Constants/fixed_precision.h"
11#include "Math/tickcounter.h"
12#include "Namelists/nml_conformer.h"
13#include "Random/random.h"
14#include "Structure/clash_detection.h"
15#include "Structure/isomerization.h"
16#include "Structure/local_arrangement.h"
17#include "Structure/structure_enumerators.h"
18#include "Topology/atomgraph.h"
19#include "atomgraph_synthesis.h"
20#include "phasespace_synthesis.h"
21#include "synthesis_enumerators.h"
27using card::HybridTargetLevel;
28using chemistry::ChemicalFeatures;
29using chemistry::ChiralInversionProtocol;
30using chemistry::ChiralOrientation;
31using chemistry::getChiralOrientation;
32using chemistry::ConformationEdit;
33using chemistry::CoupledEdit;
34using chemistry::IsomerPlan;
35using namelist::ConformerControls;
36using namelist::default_conf_clash_pairs;
37using namelist::default_conf_max_seeding_attempts;
38using numerics::default_globalpos_scale_bits;
39using numerics::default_localpos_scale_bits;
40using numerics::default_velocity_scale_bits;
41using numerics::default_force_scale_bits;
42using random::Xoshiro256ppGenerator;
43using stmath::TickCounter;
44using structure::ClashReport;
45using structure::detectClash;
46using structure::dihedralAngle;
47using structure::flipChiralCenter;
48using structure::rotateAboutBond;
49using structure::SamplingIntensity;
50using topology::AtomGraph;
60 const int* perm_map_idx_in,
const int2* perm_elements_in,
61 const int* perm_element_bounds_in,
const int* system_settings_in,
62 const int* system_settings_limits_in,
const int* rot_grp_atoms_in,
63 const int* rot_grp_bounds_in,
const int* prm_rot_grp_bounds_in,
64 const int* ctx_grp_atoms_in,
const int* ctx_grp_bounds_in,
65 const int* prm_ctx_grp_bounds_in,
const int* inv_grp_atoms_in,
66 const int* inv_grp_bounds_in,
const int* prm_inv_grp_bounds_in,
67 const int* chiral_atoms_in,
const int* chiral_protocols_in,
68 const int4* rot_bond_markers_in,
const int4* ctx_bond_markers_in,
69 const int4* chiral_markers_in,
const T* rot_bond_settings_in,
70 const T* ctx_bond_settings_in,
const int* rot_bond_settings_bounds_in,
71 const int* ctx_bond_settings_bounds_in,
72 const int* chiral_settings_in,
const int* chiral_settings_bounds_in);
176 SynthesisPermutor(
const std::vector<ChemicalFeatures*> &chemfe_in,
bool retain_pointers =
true,
179 SynthesisPermutor(
const std::vector<ChemicalFeatures> &chemfe_in,
bool retain_pointers =
true,
184 const bool retain_pointers =
true,
StopWatch *timer =
nullptr);
188 const bool retain_pointers =
true,
StopWatch *timer =
nullptr);
192 const bool retain_pointers =
true,
StopWatch *timer =
nullptr);
376 llint
getReplicaCount(
int query_index, SamplingIntensity effort)
const;
425 const std::vector<std::vector<double>> &settings);
436 const std::vector<std::vector<double>> &settings);
444 const std::vector<std::vector<int>> &settings);
460 VariableTorsionAdjustment adj = VariableTorsionAdjustment::DO_NOT_CHANGE);
463 VariableTorsionAdjustment adj = VariableTorsionAdjustment::DO_NOT_CHANGE);
478 const std::vector<double> &general_ctx_settings_in,
479 bool sample_cis_trans_states =
false,
bool sample_chiral_states =
false);
511 PrecisionModel prec = PrecisionModel::SINGLE)
const;
514 PrecisionModel prec = PrecisionModel::SINGLE);
544 const CoupledEdit mask_a = { ConformationEdit::BOND_ROTATION, -1 },
545 const CoupledEdit mask_b = { ConformationEdit::BOND_ROTATION, -1 },
546 const CoupledEdit mask_c = { ConformationEdit::BOND_ROTATION, -1 })
const;
549 PrecisionModel prec = PrecisionModel::SINGLE,
550 const CoupledEdit mask_a = { ConformationEdit::BOND_ROTATION, -1 },
551 const CoupledEdit mask_b = { ConformationEdit::BOND_ROTATION, -1 },
552 const CoupledEdit mask_c = { ConformationEdit::BOND_ROTATION, -1 });
590 PhaseSpaceSynthesis
buildSynthesis(SamplingIntensity effort, Xoshiro256ppGenerator *xrs,
591 std::vector<int> *correspondence,
int system_limit,
592 int globalpos_scale_bits = default_globalpos_scale_bits,
593 int localpos_scale_bits = default_localpos_scale_bits,
594 int velocity_scale_bits = default_velocity_scale_bits,
595 int force_scale_bits = default_force_scale_bits,
596 PrecisionModel prec = PrecisionModel::SINGLE,
597 ClashReport *clrep =
nullptr,
598 int iteration_limit = default_conf_max_seeding_attempts,
599 int max_clashes = default_conf_clash_pairs)
const;
601 PhaseSpaceSynthesis
buildSynthesis(SamplingIntensity effort, Xoshiro256ppGenerator *xrs,
602 std::vector<int> *correspondence, PrecisionModel prec,
603 int system_limit, ClashReport *clrep =
nullptr,
604 int iteration_limit = default_conf_max_seeding_attempts,
605 int max_clashes = default_conf_clash_pairs)
const;
607 PhaseSpaceSynthesis
buildSynthesis(SamplingIntensity effort, Xoshiro256ppGenerator *xrs,
609 int globalpos_scale_bits = default_globalpos_scale_bits,
610 int localpos_scale_bits = default_localpos_scale_bits,
611 int velocity_scale_bits = default_velocity_scale_bits,
612 int force_scale_bits = default_force_scale_bits,
613 PrecisionModel prec = PrecisionModel::SINGLE,
614 ClashReport *clrep =
nullptr,
615 int iteration_limit = default_conf_max_seeding_attempts,
616 int max_clashes = default_conf_clash_pairs)
const;
618 PhaseSpaceSynthesis
buildSynthesis(SamplingIntensity effort, Xoshiro256ppGenerator *xrs,
619 PrecisionModel prec,
int system_limit,
620 ClashReport *clrep =
nullptr,
621 int iteration_limit = default_conf_max_seeding_attempts,
622 int max_clashes = default_conf_clash_pairs)
const;
628 int permutor_map_count;
630 int rotatable_bond_samples;
632 int cis_trans_bond_samples;
634 bool features_objects_accessible;
642 double rotation_setting_snap;
646 double cis_trans_setting_snap;
650 int total_rotatable_groups;
652 int total_cis_trans_groups;
655 int total_invertible_groups;
659 Hybrid<int> permutor_map_indices;
661 Hybrid<int2> permutor_elements;
666 Hybrid<int> permutor_element_bounds;
671 Hybrid<int> system_settings;
684 Hybrid<int> system_settings_limits;
688 Hybrid<int> synthesis_data;
691 Hybrid<int> rotatable_group_atoms;
699 Hybrid<int> rotatable_group_bounds;
708 Hybrid<int> permutor_rotatable_group_bounds;
712 Hybrid<int> cis_trans_group_atoms;
717 Hybrid<int> cis_trans_group_bounds;
720 Hybrid<int> permutor_cis_trans_group_bounds;
723 Hybrid<int> invertible_group_atoms;
727 Hybrid<int> invertible_group_bounds;
728 Hybrid<int> permutor_invertible_group_bounds;
729 Hybrid<int> invertible_atom_centers;
734 Hybrid<int> invertible_group_protocols;
738 Hybrid<int4> rotatable_bond_markers;
740 Hybrid<int4> cis_trans_bond_markers;
742 Hybrid<int4> chiral_markers;
747 Hybrid<double> rotatable_bond_settings;
749 Hybrid<double> cis_trans_bond_settings;
751 Hybrid<float> sp_rotatable_bond_settings;
754 Hybrid<float> sp_cis_trans_bond_settings;
757 Hybrid<int> rotatable_bond_settings_bounds;
758 Hybrid<int> cis_trans_bond_settings_bounds;
759 Hybrid<int> chiral_settings_bounds;
762 Hybrid<int> group_data;
764 Hybrid<int4> marker_data;
766 Hybrid<int> chiral_settings;
789 Hybrid<int2> light_sampling_foci;
796 Hybrid<int2> heavy_sampling_foci;
800 Hybrid<int> light_sampling_foci_bounds;
801 Hybrid<int> heavy_sampling_foci_bounds;
802 Hybrid<int2> variables_data;
807 std::vector<double> general_rotation_settings;
809 std::vector<double> general_cis_trans_settings;
811 std::vector<IsomerPlan> rotatable_groups;
815 std::vector<IsomerPlan> cis_trans_groups;
819 std::vector<IsomerPlan> invertible_groups;
826 std::vector<TickCounter<double>> state_trackers;
828 std::vector<int> minimal_sampling_replicas;
830 std::vector<int> light_sampling_replicas;
833 std::vector<int> heavy_sampling_replicas;
836 std::vector<llint> exhaustive_sampling_replicas;
842 std::vector<AtomGraph*> topologies;
845 std::vector<ChemicalFeatures*> features;
850 PhaseSpaceSynthesis *poly_ps_ptr;
854 void rebasePointers();
860 std::vector<ChemicalFeatures> temporaryFeatures(StopWatch *timer =
nullptr)
const;
865 const std::vector<ChemicalFeatures*>
866 temporaryFeaturesPointers(
const std::vector<ChemicalFeatures> &feat_in)
const;
872 void fillPermutorMaps(
const std::vector<ChemicalFeatures*> &chemfe_in, StopWatch *timer);
877 void validateSystemIndex(
int system_index)
const;
882 void validateMapIndex(
int map_index)
const;
893 template <
typename T>
void alterMapSettings(
int map_index, Hybrid<T> *variable_settings,
894 const Hybrid<int> &variable_settings_bounds,
895 const Hybrid<int> &permutor_map_bounds,
896 const std::vector<std::vector<T>> &settings);
905 template <
typename T>
906 void permuteSystem(CoordinateSeries<T> *cs,
int map_index, CoupledEdit ce,
907 int setting_index)
const;
916 template <
typename T>
917 void randomizeSystem(CoordinateSeries<T> *cs,
int map_index, Xoshiro256ppGenerator *xrs,
918 const CoupledEdit mask_a = { ConformationEdit::BOND_ROTATION, -1 },
919 const CoupledEdit mask_b = { ConformationEdit::BOND_ROTATION, -1 },
920 const CoupledEdit mask_c = { ConformationEdit::BOND_ROTATION, -1 })
const;
938 template <
typename T>
939 bool resolveClashes(CoordinateSeries<T> *cs,
int map_index, Xoshiro256ppGenerator *xrs,
940 const StaticExclusionMask &excl, ClashReport *summary,
int iteration_limit,
942 const CoupledEdit mask_a = { ConformationEdit::BOND_ROTATION, -1 },
943 const CoupledEdit mask_b = { ConformationEdit::BOND_ROTATION, -1 },
944 const CoupledEdit mask_c = { ConformationEdit::BOND_ROTATION, -1 })
const;
950#include "synthesis_permutor.tpp"
An object to store information about chemical motifs: participation in rings, planarity,...
Definition chemical_features.h:400
A shorthand form of a conformational degree of freedom, which could be a rotable bond,...
Definition chemical_features.h:155
The "Xoshiro256++" random number generator. While not cryptographically useful, it is a rock-solid ra...
Definition random.h:218
Make an array of integral settings and tick it forward (or backward). The analogy is a series of whee...
Definition tickcounter.h:26
A collection of one or more AtomGraph objects, with similar components arranged in contiguous arrays ...
Definition atomgraph_synthesis.h:55
A fixed-precision representation of coordinates, velocities, and forces to manage a set of simulation...
Definition phasespace_synthesis.h:325
int getElementSampleCount(ConformationEdit element_kind, int index) const
Get the number of settings to be sampled in one element, of a particular kind, from the concatenated ...
Definition synthesis_permutor.cpp:633
const TickCounter< double > & getStateTracker(int system_index) const
Get a const reference to the state tracker for the molecule. Also useable to get a copy of the state ...
Definition synthesis_permutor.cpp:725
int getVariableElementCount(int system_index) const
Get the total number of variable elements in one of the systems: rotatable bonds, cis-trans bonds,...
Definition synthesis_permutor.cpp:621
int getSystemChiralCenterCount(int system_index) const
Get the number of chiral centers in one of the systems of the attached synthesis.
Definition synthesis_permutor.cpp:675
const SyPermutorKit< double > dpData(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the double-precision read-only abstract for the object.
Definition synthesis_permutor.cpp:832
int getSystemCount() const
Get the total number of systems tracked in the synthesis.
Definition synthesis_permutor.cpp:512
const std::vector< int > & getElementSampleCounts(int system_index) const
Get the numbers of options for each mutable element in a specific system.
Definition synthesis_permutor.cpp:595
const SyPermutorKit< float > spData(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the single-precision read-only abstract for the object.
void impartControlData(const ConformerControls &confcon)
Transfer control data from a &conformer namelist to the object. This will include vectors of torsion ...
Definition synthesis_permutor.cpp:1284
SynthesisPermutor()
The constructor accepts an array of pointers to existing chemical features objects,...
Definition synthesis_permutor.cpp:53
int getSystemRotatableBondCount(int system_index) const
Get the number of rotatable groups in one of the systems of the attached synthesis.
Definition synthesis_permutor.cpp:659
int getPermutorMapIndex(const AtomGraph *query_ag) const
Match a topology to the permutor map index, or a system in a synthesis to its permutor map index.
Definition synthesis_permutor.cpp:522
void applySynthesis(const PhaseSpaceSynthesis *poly_ps_in, VariableTorsionAdjustment adj=VariableTorsionAdjustment::DO_NOT_CHANGE)
Apply a synthesis to the permutor maps, which will be used as the starting point for defining new con...
Definition synthesis_permutor.cpp:909
int getCisTransBondSampleCount() const
Get the default number of cis-trans isomeric bond angle samples.
Definition synthesis_permutor.cpp:554
void setVariableRanges(const std::vector< double > &general_rot_settings_in, const std::vector< double > &general_ctx_settings_in, bool sample_cis_trans_states=false, bool sample_chiral_states=false)
Set the ranges of variables (rotatable bonds, cis-trans bonds, chiral centers) for each permutor map.
Definition synthesis_permutor.cpp:1095
llint getReplicaCount(int query_index, SamplingIntensity effort) const
Get the number of replicas needed to fulfill a given level of sampling in one of the permutor maps.
Definition synthesis_permutor.cpp:747
int getPermutorSetCount() const
Get the number of unique permutor sets (the number of unique topologies served by the object).
Definition synthesis_permutor.cpp:517
int getSystemCisTransBondCount(int system_index) const
Get the number of cis-trans isomeric groups in one of the systems of the attached synthesis.
Definition synthesis_permutor.cpp:667
void defineChiralCenterSettings(int system_index, const std::vector< std::vector< int > > &settings)
Load specific settings into the available states of an invertible chiral center for a particular syst...
Definition synthesis_permutor.cpp:902
const PhaseSpaceSynthesis * getSynthesisPointer() const
Get the a pointer to the coordinate synthesis for the collection of permutor maps.
Definition synthesis_permutor.cpp:827
void defineRotatableBondSettings(int map_index, const std::vector< std::vector< double > > &settings)
Load specific settings into the available states of rotatable bonds for a particular system....
Definition synthesis_permutor.cpp:886
int getRotatableBondSampleCount() const
Get the default number of rotatable bond angle samples.
Definition synthesis_permutor.cpp:549
PhaseSpaceSynthesis buildSynthesis(SamplingIntensity effort, Xoshiro256ppGenerator *xrs, std::vector< int > *correspondence, int system_limit, int globalpos_scale_bits=default_globalpos_scale_bits, int localpos_scale_bits=default_localpos_scale_bits, int velocity_scale_bits=default_velocity_scale_bits, int force_scale_bits=default_force_scale_bits, PrecisionModel prec=PrecisionModel::SINGLE, ClashReport *clrep=nullptr, int iteration_limit=default_conf_max_seeding_attempts, int max_clashes=default_conf_clash_pairs) const
Produce a new synthesis containing permutations of each structure in the current synthesis linked to ...
Definition synthesis_permutor.cpp:1383
int getCisTransBondCount(const int permutor_map_index) const
Get the number of relevant cis-trans isomeric bonds.
Definition synthesis_permutor.cpp:571
void permuteSystem(PhaseSpaceSynthesis *psynth, int system_index, int map_index, const CoupledEdit ce, int setting_index, PrecisionModel prec=PrecisionModel::SINGLE) const
Manipulate one of the systems inside a synthesis, based on the internal permutor maps....
Definition synthesis_permutor.cpp:1292
const IsomerPlan & getCisTransGroup(int system_index, int group_index) const
Get one of the cis-trans isomeric groups.
Definition synthesis_permutor.cpp:697
const IsomerPlan & getInvertibleGroup(int system_index, int group_index) const
Get one of the invertible chiral centers.
Definition synthesis_permutor.cpp:711
int getChiralCenterCount(const int permutor_map_index) const
Get the number of relevant chiral centers.
Definition synthesis_permutor.cpp:583
void randomizeSystem(PhaseSpaceSynthesis *psynth, int system_index, int map_index, Xoshiro256ppGenerator *xrs, PrecisionModel prec=PrecisionModel::SINGLE, const CoupledEdit mask_a={ ConformationEdit::BOND_ROTATION, -1 }, const CoupledEdit mask_b={ ConformationEdit::BOND_ROTATION, -1 }, const CoupledEdit mask_c={ ConformationEdit::BOND_ROTATION, -1 }) const
Randomize the system's degrees of freedom. Up to three degrees of freedom can be masked against any c...
Definition synthesis_permutor.cpp:1336
int getRotatableBondCount(const int permutor_map_index) const
Get the number of relevant rotatable bonds.
Definition synthesis_permutor.cpp:559
const IsomerPlan & getRotatableGroup(int system_index, int group_index) const
Get one of the rotatable groups.
Definition synthesis_permutor.cpp:683
const ChemicalFeatures * getChemicalFeaturesPointer(int map_index) const
Get the pointer to the chemical features object for one of the permutor maps, which can in turn revea...
Definition synthesis_permutor.cpp:808
void defineCisTransBondSettings(int system_index, const std::vector< std::vector< double > > &settings)
Load specific settings into the available states of cis-trans bonds for a particular system....
Definition synthesis_permutor.cpp:894
The "Xoshiro256++" random number generator. While not cryptographically useful, it is a rock-solid ra...
Definition random.h:218
Object for managing calls to the C-standard function gettimeofday(), calculating deltas and categoriz...
Definition stopwatch.h:23
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
A pairing of some process (a ConformationEdit, being a rotation about a bond, flipping groups across ...
Definition chemical_features.h:268
Definition stormm_vector_types.h:22
Definition stormm_vector_types.h:33
A pairing of some process (a ConformationEdit, being a rotation about a bond, flipping groups across ...
Definition chemical_features.h:268
Read-only abstract for the SynthesisPermutor. Access to all of the atom groups, critical measurements...
Definition synthesis_permutor.h:54
const int * rot_grp_bounds
Bounds array for rot_grp_atoms.
Definition synthesis_permutor.h:94
const int * system_settings
Definition synthesis_permutor.h:88
const int * system_settings_limits
Definition synthesis_permutor.h:90
const int * prm_inv_grp_bounds
Definition synthesis_permutor.h:103
const int * ctx_bond_settings_bounds
Bounds array for ctx_bond_settings.
Definition synthesis_permutor.h:122
const int4 * chiral_markers
Definition synthesis_permutor.h:113
const int * chiral_settings_bounds
Bounds array for chiral_settings.
Definition synthesis_permutor.h:123
const int * chiral_atoms
Definition synthesis_permutor.h:105
const int * chiral_settings
Specific values that each chiral center can take on.
Definition synthesis_permutor.h:120
const int * chiral_protocols
Definition synthesis_permutor.h:107
const T * ctx_bond_settings
Definition synthesis_permutor.h:118
const int * inv_grp_atoms
Chiral center inversion group atoms.
Definition synthesis_permutor.h:101
const int4 * rot_bond_markers
Definition synthesis_permutor.h:109
const int * perm_map_idx
Definition synthesis_permutor.h:80
const int * inv_grp_bounds
Bounds array for inv_grp_atoms.
Definition synthesis_permutor.h:102
const int * ctx_grp_atoms
Cis-trans isomeric bond group atoms.
Definition synthesis_permutor.h:97
const T * rot_bond_settings
Specific values that each rotatable bond can take on.
Definition synthesis_permutor.h:117
int system_count
Number of systems in the synthesis.
Definition synthesis_permutor.h:77
const int * rot_bond_settings_bounds
Bounds array for rot_bond_settings.
Definition synthesis_permutor.h:121
const int * perm_element_bounds
Bounds array for perm_elements.
Definition synthesis_permutor.h:87
int perm_map_count
Definition synthesis_permutor.h:78
const int * rot_grp_atoms
Rotatable bond group associated atoms.
Definition synthesis_permutor.h:93
const int * ctx_grp_bounds
Bounds array for ctx_grp_atoms.
Definition synthesis_permutor.h:98
SyPermutorKit(int system_count_in, int perm_map_count_in, const int *perm_map_idx_in, const int2 *perm_elements_in, const int *perm_element_bounds_in, const int *system_settings_in, const int *system_settings_limits_in, const int *rot_grp_atoms_in, const int *rot_grp_bounds_in, const int *prm_rot_grp_bounds_in, const int *ctx_grp_atoms_in, const int *ctx_grp_bounds_in, const int *prm_ctx_grp_bounds_in, const int *inv_grp_atoms_in, const int *inv_grp_bounds_in, const int *prm_inv_grp_bounds_in, const int *chiral_atoms_in, const int *chiral_protocols_in, const int4 *rot_bond_markers_in, const int4 *ctx_bond_markers_in, const int4 *chiral_markers_in, const T *rot_bond_settings_in, const T *ctx_bond_settings_in, const int *rot_bond_settings_bounds_in, const int *ctx_bond_settings_bounds_in, const int *chiral_settings_in, const int *chiral_settings_bounds_in)
As with other abstracts, the constructor takes input arguments for every member variable.
const int2 * perm_elements
Definition synthesis_permutor.h:82
const int * prm_ctx_grp_bounds
Definition synthesis_permutor.h:99
const int4 * ctx_bond_markers
Definition synthesis_permutor.h:111
const int * prm_rot_grp_bounds
Definition synthesis_permutor.h:95