2#ifndef STORMM_CLASH_DETECTION_H
3#define STORMM_CLASH_DETECTION_H
6#include "Constants/behavior.h"
7#include "Constants/fixed_precision.h"
8#include "Constants/scaling.h"
9#include "DataTypes/common_types.h"
10#include "DataTypes/stormm_vector_types.h"
11#include "Math/rounding.h"
12#include "Math/series_ops.h"
13#include "Namelists/nml_minimize.h"
14#include "Potential/static_exclusionmask.h"
15#include "Reporting/error_format.h"
16#include "Synthesis/condensate.h"
17#include "Topology/atomgraph.h"
18#include "Topology/atomgraph_abstracts.h"
19#include "Trajectory/coordinateframe.h"
20#include "Trajectory/coordinate_series.h"
21#include "Trajectory/phasespace.h"
22#include "structure_enumerators.h"
27using constants::PrecisionModel;
28using data_types::getStormmScalarTypeName;
29using data_types::isFloatingPointScalarType;
30using energy::StaticExclusionMask;
31using energy::StaticExclusionMaskReader;
32using energy::supertile_length;
33using energy::tile_length;
34using energy::tile_lengths_per_supertile;
36using stmath::indexingArray;
37using namelist::default_minimize_clash_ratio;
38using namelist::default_minimize_clash_r0;
39using numerics::globalpos_scale_nonoverflow_bits;
40using synthesis::Condensate;
41using synthesis::CondensateReader;
42using synthesis::PhaseSpaceSynthesis;
43using synthesis::PsSynthesisReader;
44using topology::AtomGraph;
45using topology::NonbondedKit;
46using topology::ValenceKit;
47using trajectory::CoordinateFrame;
48using trajectory::CoordinateFrameReader;
49using trajectory::CoordinateSeries;
50using trajectory::CoordinateSeriesReader;
51using trajectory::PhaseSpace;
52using trajectory::PhaseSpaceReader;
55constexpr int clash_direct_calculation_size_limit = 32;
64 ClashReport(
double clash_distance_in = default_minimize_clash_r0,
65 double clash_ratio_in = default_minimize_clash_ratio,
66 const AtomGraph *ag_pointer_in =
nullptr);
138 template <
typename T>
142 template <
typename T>
146 template <
typename T>
151 int system_index)
const;
154 int system_index)
const;
157 int system_index)
const;
160 int system_index)
const;
163 int system_index)
const;
166 int system_index)
const;
174 void addClash(
int atom_i,
int atom_j,
double distance_in);
206 double clash_distance;
208 std::vector<int2> pairs;
209 std::vector<double> distances;
210 std::vector<ClashKind> kinds;
217 void validateClashIndex(
int index)
const;
220 void validateSystemIndex(
int system_index,
int system_count)
const;
230 std::string atomPairCoordinates(
double x_i,
double y_i,
double z_i,
double x_j,
double y_j,
242template <
typename Tcalc>
244 const Tcalc vdw_ratio);
260template <
typename Tcoord,
typename Tcalc>
261bool trivialClashCheck(
const std::vector<Tcalc> &cachi_xcrd,
const std::vector<Tcalc> &cachj_xcrd,
262 const std::vector<Tcalc> &cachi_ycrd,
const std::vector<Tcalc> &cachj_ycrd,
263 const std::vector<Tcalc> &cachi_zcrd,
const std::vector<Tcalc> &cachj_zcrd,
264 int ni_atoms,
int nj_atoms, Tcalc max_clash);
279template <
typename Tcoord,
typename Tcalc>
280bool directClashTesting(
const Tcoord* xcrd,
const Tcoord* ycrd,
const Tcoord* zcrd,
282 Tcalc elec_limit = default_minimize_clash_r0,
283 Tcalc vdw_ratio = default_minimize_clash_ratio, Tcalc inv_scale = 1.0,
296template <
typename Tcoord>
297int3 clashGridDecomposition(
const Tcoord* xcrd,
const Tcoord* ycrd,
const Tcoord* zcrd,
323template <
typename Tcoord,
typename Tcalc>
324bool detectClash(
const Tcoord* xcrd,
const Tcoord* ycrd,
const Tcoord* zcrd,
327 Tcalc vdw_ratio = default_minimize_clash_ratio, Tcalc inv_scale = 1.0,
332 double elec_limit = default_minimize_clash_r0,
333 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
336 double elec_limit = default_minimize_clash_r0,
337 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
340 double elec_limit = default_minimize_clash_r0,
341 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
351 double elec_limit = default_minimize_clash_r0,
352 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
355 double elec_limit = default_minimize_clash_r0,
356 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
359 double elec_limit = default_minimize_clash_r0,
360 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
368template <
typename Tcoord,
typename Tcalc>
372 Tcalc vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
374template <
typename Tcoord,
typename Tcalc>
377 Tcalc vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
379template <
typename Tcoord,
typename Tcalc>
382 Tcalc vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
384template <
typename Tcoord,
typename Tcalc>
388template <
typename Tcoord,
typename Tcalc>
392template <
typename Tcalc>
398template <
typename Tcalc>
403template <
typename Tcalc>
408template <
typename Tcalc>
412template <
typename Tcalc>
416template <
typename Tcalc>
420 Tcalc vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
422template <
typename Tcalc>
425 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
427template <
typename Tcalc>
430 double vdw_ratio = default_minimize_clash_ratio,
ClashReport *summary =
nullptr);
432template <
typename Tcalc>
436template <
typename Tcalc>
444#include "clash_detection.tpp"
A simple pair list for an all-to-all calculation with exclusion masks. The list stores masks for 16 x...
Definition static_exclusionmask.h:81
An object for listing the clashes between atoms of a system.
Definition clash_detection.h:58
int getClashCount() const
Get the number of detected clashes.
Definition clash_detection.cpp:28
int2 getClashingPair(int index) const
Get one of the clashing pairs of atoms.
Definition clash_detection.cpp:48
double getClashDistance(int index) const
Get the distance at which two particles clash.
Definition clash_detection.cpp:54
ClashKind getClashKind(int index) const
Get the type of clash made by two particles.
Definition clash_detection.cpp:60
void addClash(int atom_i, int atom_j, double distance_in)
Add notes about a clash between two particles.
Definition clash_detection.cpp:205
double getMinimumSigmaRatio() const
Get the minimum ratio of inter-particle distance to the pairwise sigma parameter.
Definition clash_detection.cpp:38
const AtomGraph * getTopologyPointer() const
Get a const pointer to the topology describing the system.
Definition clash_detection.cpp:43
ClashReport(const ClashReport &original)=default
Copy and move constructors, as well as copy and move assignment operators, can all take their default...
double getMinimumDistance() const
Get the minimum clash distance.
Definition clash_detection.cpp:33
void setMinimumSigmaRatio(double clash_ratio_in)
Set the minimum ratio of interparticle distance to the pairwise sigma value, below which a clash is d...
Definition clash_detection.cpp:249
void clear()
Clear the clashes to recompile the report.
Definition clash_detection.cpp:226
std::string getClashDescription(int clash_index) const
Produce a string describing the atoms, indices, and relevant names of one of the clashes catalogged i...
Definition clash_detection.cpp:66
ClashReport(double clash_distance_in=default_minimize_clash_r0, double clash_ratio_in=default_minimize_clash_ratio, const AtomGraph *ag_pointer_in=nullptr)
The constructor accepts optional parameters for the clash parameters, or just a pointer to the desire...
Definition clash_detection.cpp:16
void setMinimumDistance(double clash_distance_in)
Set the minimum absolute distance for two particles' separation before a clash is declared.
Definition clash_detection.cpp:244
void setTopologyPointer(const AtomGraph *ag_pointer_in)
Set the topology that the clash report shall use.
Definition clash_detection.cpp:234
Condense the data format, and possibly offer a reduced representation of coordinates,...
Definition condensate.h:146
A fixed-precision representation of coordinates, velocities, and forces to manage a set of simulation...
Definition phasespace_synthesis.h:325
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
Store the coordinates and box information for a frame, only. This abridged struct can serve when the ...
Definition coordinateframe.h:111
Store the coordinates and box information for a series of frames, in one of several levels of precisi...
Definition coordinate_series.h:137
An object to complement a topology and hold positions, velocities, and forces of all particles in a s...
Definition phasespace.h:141
Definition stormm_vector_types.h:117
Definition stormm_vector_types.h:22
Definition stormm_vector_types.h:27
The abstract for a StaticExclusionMask object, read-only due to the const-ness of the data() member f...
Definition static_exclusionmask.h:45
Read-only abstract for the Condensate class. In most cases, the read-only abstract will be preferred ...
Definition condensate.h:102
The reader for a PhaseSpaceSynthesis object, containing all of the data relevant for propagating dyna...
Definition phasespace_synthesis.h:199
Information needed for non-bonded real-space calculations. Templating is used as above,...
Definition atomgraph_abstracts.h:287
Information need for bonded calculations. Templating is used to serve either of two levels of precisi...
Definition atomgraph_abstracts.h:88
Collect C-style pointers for the elements of a read-only CoordinateFrame object.
Definition coordinateframe.h:65
Collect C-style pointers and critical constants for a read-only CoordinateSeries object.
Definition coordinate_series.h:96
Collect constants and pointers to the components of a read-only PhaseSpace object.
Definition phasespace.h:81