2#ifndef STORMM_ATOMGRAPH_SYNTHESIS_H
3#define STORMM_ATOMGRAPH_SYNTHESIS_H
6#include "Accelerator/hybrid.h"
7#include "Accelerator/gpu_details.h"
8#include "Constants/behavior.h"
9#include "Constants/generalized_born.h"
10#include "DataTypes/stormm_vector_types.h"
11#include "Math/reduction_enumerators.h"
12#include "Math/reduction_workunit.h"
13#include "Potential/energy_enumerators.h"
14#include "Restraints/restraint_apparatus.h"
15#include "Structure/structure_enumerators.h"
16#include "Topology/atomgraph.h"
17#include "Topology/atomgraph_enumerators.h"
18#include "Topology/topology_util.h"
19#include "UnitTesting/stopwatch.h"
20#include "static_mask_synthesis.h"
21#include "synthesis_abstracts.h"
22#include "valence_workunit.h"
27using card::GpuDetails;
29using card::HybridTargetLevel;
30using constants::ExceptionResponse;
31using energy::ValenceKernelSize;
32using stmath::RdwuPerSystem;
33using stmath::ReductionWorkUnit;
34using restraints::RestraintApparatus;
35using restraints::RestraintKit;
36using structure::ApplyConstraints;
37using topology::AtomGraph;
38using topology::AtomicRadiusSet;
39using topology::ChemicalDetailsKit;
40using topology::getRealParameters;
41using topology::ImplicitSolventModel;
42using topology::MassForm;
43using topology::UnitCellType;
44using testing::StopWatch;
45using namespace generalized_born_defaults;
85 const std::vector<RestraintApparatus*> &restraints_in,
86 const std::vector<int> &topology_indices_in,
87 const std::vector<int> &restraint_indices_in,
88 ExceptionResponse policy_in = ExceptionResponse::WARN,
89 const GpuDetails &gpu = null_gpu, StopWatch *timer_in =
nullptr);
92 const std::vector<RestraintApparatus*> &restraints_in,
93 ExceptionResponse policy_in = ExceptionResponse::WARN,
95 StopWatch *timer_in =
nullptr);
98 const std::vector<int> &topology_indices_in,
99 ExceptionResponse policy_in = ExceptionResponse::WARN,
100 const GpuDetails &gpu = null_gpu, StopWatch *timer_in =
nullptr);
103 ExceptionResponse policy_in = ExceptionResponse::WARN,
105 StopWatch *timer_in =
nullptr);
259 std::vector<AtomicRadiusSet>
getPBRadiiSet(
int low_limit,
int high_limit)
const;
275 template <
typename T>
278 template <
typename T>
280 HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
282 template <
typename T>
283 std::vector<T>
getPartialCharges(
int system_index,
int low_index,
int high_index,
284 HybridTargetLevel tier = HybridTargetLevel::HOST)
const;
300 template <
typename T> std::vector<T>
getAtomicMasses(HybridTargetLevel tier,
301 int system_index)
const;
302 template <
typename T> std::vector<T>
getAtomicMasses(HybridTargetLevel tier,
int system_index,
303 int low_index,
int high_index)
const;
430 InitializationTask init_request = InitializationTask::NONE,
431 int random_cache_depth = 0,
const GpuDetails &gpu = null_gpu);
457 const std::vector<AtomicRadiusSet> &radii_sets_in,
458 double dielectric_in = 80.0,
double saltcon_in = 0.0,
459 ExceptionResponse policy = ExceptionResponse::WARN);
463 AtomicRadiusSet radii_set = AtomicRadiusSet::NONE,
464 double dielectric_in = 80.0,
double saltcon_in = 0.0,
465 ExceptionResponse policy = ExceptionResponse::WARN);
469 const std::vector<AtomicRadiusSet> &radii_sets_in,
470 double dielectric_in = 80.0,
double saltcon_in = 0.0,
471 ExceptionResponse policy = ExceptionResponse::WARN);
475 AtomicRadiusSet radii_set = AtomicRadiusSet::NONE,
476 double dielectric_in = 80.0,
double saltcon_in = 0.0,
477 ExceptionResponse policy = ExceptionResponse::WARN);
484 ExceptionResponse policy;
486 int restraint_network_count;
490 int total_virtual_sites;
491 int total_bond_terms;
492 int total_angl_terms;
493 int total_dihe_terms;
494 int total_ubrd_terms;
495 int total_cimp_terms;
496 int total_cmap_terms;
499 int total_charge_types;
501 int total_bond_params;
502 int total_angl_params;
503 int total_dihe_params;
504 int total_ubrd_params;
505 int total_cimp_params;
506 int total_cmap_surfaces;
507 int total_attn14_params;
509 int total_vste_params;
511 int total_position_restraints;
512 int total_distance_restraints;
513 int total_angle_restraints;
514 int total_dihedral_restraints;
521 UnitCellType periodic_box_class;
525 ImplicitSolventModel gb_style;
530 double dielectric_constant;
534 double salt_concentration;
538 double coulomb_constant;
541 ApplyConstraints use_shake;
542 ApplyConstraints use_settle;
543 int largest_constraint_group;
545 char4 water_residue_name;
551 std::vector<AtomicRadiusSet> pb_radii_sets;
556 std::vector<AtomGraph*> topologies;
561 std::vector<RestraintApparatus*> restraint_networks;
566 std::vector<RestraintApparatus> restraint_dummies;
1191 int total_valence_work_units;
1192 int2 valence_work_unit_size;
1199 ValenceKernelSize valence_thread_block_size;
1352 int total_nonbonded_work_units;
1355 NbwuKind nonbonded_work_type;
1393 int total_reduction_work_units;
1394 RdwuPerSystem rdwu_per_system;
1407 void rebasePointers();
1417 std::vector<int> createDummyRestraints(
const std::vector<int> &restraint_indices_in,
1418 const std::vector<int> &topology_indices_in);
1427 std::vector<int> checkTopologyList(
const std::vector<int> &topology_indices_in);
1439 std::vector<int> checkRestraintList(
const std::vector<int> &restraint_indices_in,
1440 const std::vector<int> &topology_indices_in,
1441 const std::vector<int> &topology_index_rebase);
1444 void checkCommonSettings();
1461 void buildAtomAndTermArrays(
const std::vector<int> &topology_indices_in,
1462 const std::vector<int> &topology_index_rebase,
1463 const std::vector<int> &new_restraint_indices,
1464 const std::vector<int> &restraint_index_rebase);
1470 void condenseParameterTables();
1477 void extendLJMatrices();
1504 int mapUniqueRestraintKRSeries(
int order,
const std::vector<int> &network_table_offsets,
1505 std::vector<int> *synthesis_index,
1506 std::vector<int2> *filtered_step_bounds,
1507 std::vector<double2> *filtered_init_keq,
1508 std::vector<double2> *filtered_finl_keq,
1509 std::vector<double4> *filtered_init_r,
1510 std::vector<double4> *filtered_finl_r);
1515 void condenseRestraintNetworks();
1527 int setVwuAbstractLimits(
int item_counter,
int vwu_counter, VwuAbstractMap slot,
1538 void loadValenceWorkUnits(
int2 vwu_atom_limits = { maximum_valence_work_unit_atoms,
1539 maximum_valence_work_unit_atoms });
1544 void loadReductionWorkUnits(
const GpuDetails &gpu = null_gpu);
1551 void importImplicitSolventAtomParameters(
int system_index);
1562 void setImplicitSolventNeckParameters();
1569#include "atomgraph_synthesis.tpp"
AtomGraphSynthesis(const std::vector< AtomGraph * > &topologies_in, const std::vector< RestraintApparatus * > &restraints_in, const std::vector< int > &topology_indices_in, const std::vector< int > &restraint_indices_in, ExceptionResponse policy_in=ExceptionResponse::WARN, const GpuDetails &gpu=null_gpu, StopWatch *timer_in=nullptr)
The constructor takes a series of topologies and NMR restraints. The NMR restraints point to specific...
Definition ag_synthesis_constructors.cpp:11
const AtomGraph * getSystemTopologyPointer(int system_index) const
Get a topology pointer for a specific system contained within the synthesis.
Definition ag_synthesis_mechanics.cpp:2768
Pertinent aspects of one particular GPU. Condensing the data for each GPU in this manner helps to ens...
Definition gpu_details.h:27
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
Object to hold a complex array of constants referenced by various GB calculations using the "neck" fo...
Definition generalized_born.h:151
int getBondParameterCount() const
Get the number of unique harmonic bond parameter sets.
Definition ag_synthesis_mechanics.cpp:2889
int getBondTermCount() const
Get the total number of bond terms across all systems, including replicas.
Definition ag_synthesis_mechanics.cpp:2849
std::vector< int > getTopologyIndices() const
Get a const reference to the list of all topology indices, indicating the topologies describing each ...
Definition ag_synthesis_mechanics.cpp:2793
int getLJTypeCount() const
Get the number of unique atom types (a parameter, not an extensive quantity dependent on the number o...
Definition ag_synthesis_mechanics.cpp:2879
std::vector< AtomicRadiusSet > getPBRadiiSet() const
Get the name of the PB radii set for one or more systems.
Definition ag_synthesis_mechanics.cpp:2964
SyRestraintKit< double, double2, double4 > getDoublePrecisionRestraintKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with double-precision parameter detail for computing valence interactions for all s...
Definition ag_synthesis_mechanics.cpp:3109
UnitCellType getUnitCellType() const
Get the unit cell type that will be taken for all systems (TRICLINIC subsumes ORTHORHOMBIC in a sort ...
Definition ag_synthesis_mechanics.cpp:2939
int getRandomCacheDepth() const
Get the depth of the random numbers cache that the non-bonded work units of this topology synthesis w...
Definition ag_synthesis_mechanics.cpp:3024
SyNonbondedKit< double, double2 > getDoublePrecisionNonbondedKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with double-precision real numbers for computing non-bonded interactions for all sy...
Definition ag_synthesis_mechanics.cpp:3159
double getSaltConcentration() const
Get the salt concentration (supporting the implicit solvent model) for all systems.
Definition ag_synthesis_mechanics.cpp:2954
int getAtomCount() const
Get the number of atoms in one or more systems.
Definition ag_synthesis_mechanics.cpp:2813
const std::vector< AtomGraph * > & getUniqueTopologies() const
Get a const reference to the list of all pointers for unique topologies making up this synthesis.
Definition ag_synthesis_mechanics.cpp:2788
int getValenceWorkUnitCount() const
Get the overall number of valence work units needed to account for interactions in all systems.
Definition ag_synthesis_mechanics.cpp:2994
const Hybrid< int > & getSystemAtomCounts() const
Get the sizes of all individual systems as a const reference to the Hybrid array member variable.
Definition ag_synthesis_mechanics.cpp:2919
int getDihedralParameterCount() const
Get the number of unique cosine-based dihedral parameter sets.
Definition ag_synthesis_mechanics.cpp:2899
void setImplicitSolventModel()
Apply an implicit solvent model to the synthesis. Any mode of operation other than taking the origina...
Definition ag_synthesis_mechanics.cpp:3419
AtomGraphSynthesis(const std::vector< AtomGraph * > &topologies_in, const std::vector< RestraintApparatus * > &restraints_in, const std::vector< int > &topology_indices_in, const std::vector< int > &restraint_indices_in, ExceptionResponse policy_in=ExceptionResponse::WARN, const GpuDetails &gpu=null_gpu, StopWatch *timer_in=nullptr)
The constructor takes a series of topologies and NMR restraints. The NMR restraints point to specific...
Definition ag_synthesis_constructors.cpp:11
const Hybrid< int > & getConstrainedDegreesOfFreedom() const
Get the numbers of constrained degrees of freedom for all individual systems in the.
Definition ag_synthesis_mechanics.cpp:2934
int getUniqueTopologyCount() const
Get the number of unique topologies described by the synthesis.
Definition ag_synthesis_mechanics.cpp:2763
ImplicitSolventModel getImplicitSolventModel() const
Get the implicit solvent model in use across all systems.
Definition ag_synthesis_mechanics.cpp:2944
int getAtomOffset(int system_index) const
Get the starting point for atoms of a specific system in the lineup of all topologies.
Definition ag_synthesis_mechanics.cpp:2834
NbwuKind getNonbondedWorkType() const
Get the type of non-bonded work required by systems in this synthesis.
Definition ag_synthesis_mechanics.cpp:3014
SyValenceKit< float > getSinglePrecisionValenceKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with single-precision parameter detail for computing valence interactions for all s...
Definition ag_synthesis_mechanics.cpp:3082
const AtomGraphSynthesis * getSelfPointer() const
Get a const pointer to the object itself, useful for retrieving a valid pointer when the object is av...
Definition ag_synthesis_mechanics.cpp:3230
int getDihedralTermCount() const
Get the total number of cosine-based dihedral terms across all systems and replicas.
Definition ag_synthesis_mechanics.cpp:2859
int getCmapSurfaceCount() const
Get the number of unique CMAP surfaces.
Definition ag_synthesis_mechanics.cpp:2914
SyAtomUpdateKit< double, double2, double4 > getDoublePrecisionAtomUpdateKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with double-precision real numbers for updating atom and virtual site positions bas...
Definition ag_synthesis_mechanics.cpp:3201
int getChargeTypeCount() const
Get the number of unique charge parameters.
Definition ag_synthesis_mechanics.cpp:2884
double getCoulombConstant() const
Get the fundamental Coulomb constant defining the electrostatics of all systems.
Definition ag_synthesis_mechanics.cpp:2959
const Hybrid< int > & getSystemAtomOffsets() const
Get the starting locations of all individual systems as a const reference to the Hybrid array member ...
Definition ag_synthesis_mechanics.cpp:2924
std::vector< T > getAtomicMasses(HybridTargetLevel tier) const
Get the masses (or inverse masses) of atoms in the synthesis.
std::vector< T > getPartialCharges(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get partial charges stored within the synthesis.
int getUreyBradleyTermCount() const
Get the total number of Urey-Bradley terms across all systems and replicas.
Definition ag_synthesis_mechanics.cpp:2864
int getNonbondedWorkUnitCount() const
Get the number of non-bonded work units serving systems in this synthesis.
Definition ag_synthesis_mechanics.cpp:3019
SyNonbondedKit< float, float2 > getSinglePrecisionNonbondedKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with single-precision real numbers for computing non-bonded interactions for all sy...
Definition ag_synthesis_mechanics.cpp:3179
int getPaddedAtomCount() const
Get the entire padded number of atoms covering all systems.
Definition ag_synthesis_mechanics.cpp:2828
int getSystemCount() const
Get the number of systems that this synthesis describes.
Definition ag_synthesis_mechanics.cpp:2808
SyAtomUpdateKit< float, float2, float4 > getSinglePrecisionAtomUpdateKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with single-precision real numbers for updating atom and virtual site positions bas...
Definition ag_synthesis_mechanics.cpp:3215
RestraintApparatus * getSystemRestraintPointer(int system_index) const
Get a restraint apparatus pointer for a sepcific system contained within the synthesis.
Definition ag_synthesis_mechanics.cpp:2798
double getDielectricConstant() const
Get the dielectric constant (supporting the implicit solvent model) for all systems.
Definition ag_synthesis_mechanics.cpp:2949
const Hybrid< int > & getDegreesOfFreedom() const
Get the numbers of unconstrained degrees of freedom for all individual systems in the.
Definition ag_synthesis_mechanics.cpp:2929
int getAngleParameterCount() const
Get the number of unique harmonic bond angle parameter sets.
Definition ag_synthesis_mechanics.cpp:2894
int getCharmmImproperTermCount() const
Get the total number of CHARMM improper terms across all systems and replicas.
Definition ag_synthesis_mechanics.cpp:2869
ValenceKernelSize getValenceThreadBlockSize() const
Get the necessary thread block size for evaluating the valence work units.
Definition ag_synthesis_mechanics.cpp:3004
int getCharmmImproperParameterCount() const
Get the number of unique CHARMM improper parameter sets.
Definition ag_synthesis_mechanics.cpp:2909
int getUreyBradleyParameterCount() const
Get the number of unique Urey-Bradley harmonic angle parameter sets.
Definition ag_synthesis_mechanics.cpp:2904
const Hybrid< int > & getReductionWorkUnitAbstracts() const
Get the reduction work unit abstracts (this is not required for valence or non-bonded work units as t...
Definition ag_synthesis_mechanics.cpp:3049
SyValenceKit< double > getDoublePrecisionValenceKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with double-precision parameter detail for computing valence interactions for all s...
Definition ag_synthesis_mechanics.cpp:3055
SyRestraintKit< float, float2, float4 > getSinglePrecisionRestraintKit(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a minimal kit with single-precision parameter detail for computing valence interactions for all s...
Definition ag_synthesis_mechanics.cpp:3134
void loadNonbondedWorkUnits(const StaticExclusionMaskSynthesis &poly_se, InitializationTask init_request=InitializationTask::NONE, int random_cache_depth=0, const GpuDetails &gpu=null_gpu)
Construct non-bonded work units for all unique topologies (there are no restraints for non-bonded int...
Definition ag_synthesis_mechanics.cpp:2668
int getCmapTermCount() const
Get the total number of CMAP terms across all systems and replicas.
Definition ag_synthesis_mechanics.cpp:2874
RdwuPerSystem getRdwuPerSystem() const
Get a qualitative assessment of the number of reduction work units assigned to any one system.
Definition ag_synthesis_mechanics.cpp:3044
int2 getValenceWorkUnitSize() const
Get the maximum size of valence work units, whether for organic molecules or solvent (rigid water) re...
Definition ag_synthesis_mechanics.cpp:2999
int getVirtualSiteCount() const
Get the total number of virtual sites across all systems, including replicas.
Definition ag_synthesis_mechanics.cpp:2844
int getReductionWorkUnitCount() const
Get the number of reduction work units spanning all systems.
Definition ag_synthesis_mechanics.cpp:3039
const Hybrid< int2 > & getValenceWorkUnitAbstracts() const
Get the abstracts (condensed lists of import and instruction set limits) for the valence work units s...
Definition ag_synthesis_mechanics.cpp:3009
int getAngleTermCount() const
Get the total number of bond angle terms across all systems, including replicas.
Definition ag_synthesis_mechanics.cpp:2854
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
A collection of all restraints pertaining to a specific topology for the purposes of one simulation,...
Definition restraint_apparatus.h:109
An exclusion mask object for a compilation of systems. All systems are represented in full detail,...
Definition static_mask_synthesis.h:54
Object for managing calls to the C-standard function gettimeofday(), calculating deltas and categoriz...
Definition stopwatch.h:23
Definition stormm_vector_types.h:141
Definition stormm_vector_types.h:22
Abstract for the NeckGeneralizedBornTable object, in single- or double-precision.
Definition generalized_born.h:130
Collect the virtual site details and constraint parameters of the topology synthesis into a single ab...
Definition synthesis_abstracts.h:257
Collect the critical non-bonded parameters and masking information for work unit-based evaluation of ...
Definition synthesis_abstracts.h:181
Collect the critical restraint parameters and masking information for work unit-based evaluation of t...
Definition synthesis_abstracts.h:100
Collect the critical valence parameters and indexing information for work unit-based evaluation of th...
Definition synthesis_abstracts.h:19