seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
site.hpp
Go to the documentation of this file.
1//-----------------------------------------------------------------------------------
2// d-SEAMS - Deferred Structural Elucidation Analysis for Molecular Simulations
3// SPDX-License-Identifier: MIT
4//-----------------------------------------------------------------------------------
5
6#ifndef SEAMS_SITE_H_
7#define SEAMS_SITE_H_
8
9#include <mol_sys.hpp>
10
11#include <array>
12#include <string_view>
13#include <unordered_map>
14#include <vector>
15
24
25namespace site {
26
40
41enum class Family {
42 waterIce, // default; CHILL/TUM allowed
43 ionicLiquid, // CHILL/TUM refused
44 moltenSalt, // CHILL/TUM refused
45 des, // CHILL/TUM refused
46 electrolyte, // CHILL/TUM only if the caller also names a waterIce subset
47 confinedIL, // CHILL/TUM refused
48 confinedWater, // 2D RDF / monolayer rings; bulk CHILL refused
49 networkFormer // silica / BeF2; Franzblau yes, CHILL no
50};
51
52struct Table {
54 std::unordered_map<int, Kind> typeToKind; // LAMMPS type ID
55 std::unordered_map<int, Kind> atomOverride; // atom ID wins over type
56 Kind of(const molSys::Point<double> &p) const;
57 Kind ofType(int typeId) const;
58};
59
60std::vector<int>
62 const Table &table, Kind kind);
63
64int lammpsTypeOfKind(const Table &table, Kind kind); // error if not unique
65
66// One vertex per molID that carries ionKind (cationHead or anion).
67// Coordinates: unweighted geometric COM of atoms of that molID whose
68// kind is ionKind, unwrapped with gen::relDist to the first atom of
69// the group (createMolIDAtomIDMultiMap, mol_sys.hpp:187-190). Copies
70// box / boxLow from src. Point::type is 1 for cationHead molecules
71// and 2 for anion molecules so neighList(merged, 1, 2) is legal.
72// A molecule that is already one tagged site (UA, or one designated
73// type per ion) is a no-op: the COM is that site.
76 const Table &table);
77
78Table parseSiteSpec(std::string_view spec);
79
80
86enum class IonState { liquid = 0, front = 1, ice = 2 };
88 std::vector<int> ion;
89 std::vector<int> shell;
90 std::vector<double> iceFraction;
91 std::vector<IonState> state;
92 std::vector<std::vector<int>> members;
93 int nIce = 0;
94 int nFront = 0;
95 int nLiquid = 0;
96};
97
103 const std::vector<bool> &iceFlag, const std::vector<int> &ionIndices,
104 const std::vector<int> &waterTypes, double cutoff);
105
109 const std::vector<bool> &iceFlag, const std::vector<int> &ionIndices,
110 int waterType, double cutoff);
111
118std::vector<int> shellRingCensus(const std::vector<std::vector<int>> &rings,
119 const std::vector<int> &shell, int maxRingSize);
120
125std::vector<std::vector<int>> cappedRings(const std::vector<std::vector<int>> &rings,
126 const std::vector<int> &shell,
127 int maxRingSize);
128
135std::vector<std::vector<int>> brokenRings(const std::vector<std::vector<int>> &nList,
136 const std::vector<int> &shell,
137 int maxRingSize);
138
147 std::vector<int> guestsPerCage;
148 std::vector<int> cageOfGuest;
149 std::vector<double> centreDistance;
150 int occupied = 0;
151 int multiply = 0;
152 int free = 0;
153 std::vector<int> occupancyHistogram;
154};
155
159 const std::vector<std::vector<int>> &cages,
160 const std::vector<int> &guestIndices, double radius);
161
164std::array<double, 3>
166 const std::vector<int> &atoms);
167
170inline constexpr double kInsideRelTol = 1e-9;
171
173const std::vector<std::array<double, 3>> &insideRayDirections();
174
176 bool inside = false;
177 bool onFace = false;
178 int rays = 0;
179 int crossings = 0;
180};
181
193 const std::vector<std::vector<int>> &rings,
194 const std::vector<int> &faces, const std::array<double, 3> &guest,
195 const std::array<double, 3> *center = nullptr);
196
198 const std::vector<std::vector<int>> &rings,
199 const std::vector<int> &faces, const std::array<double, 3> &guest,
200 const std::array<double, 3> *center = nullptr);
201
208 const std::vector<std::vector<int>> &rings,
209 const std::vector<std::vector<int>> &cageFaces,
210 const std::vector<int> &guestIndices);
211
216 std::vector<int> clusterOf;
217 std::vector<int> ionsInCluster;
218 std::vector<int> clusterOfIon;
219 int nClusters = 0;
220};
221
224 const std::vector<bool> &ice,
225 const std::vector<std::vector<int>> &nListByIndex,
226 const std::vector<int> &ionIndices, double cutoff);
227} // namespace site
228
229#endif // SEAMS_SITE_H_
The main molecular system handler.
constexpr double kInsideRelTol
Relative tolerance of the inside test, in units of the largest distance from c_F to a cage vertex.
Definition site.hpp:170
int lammpsTypeOfKind(const Table &table, Kind kind)
std::vector< std::vector< int > > brokenRings(const std::vector< std::vector< int > > &nList, const std::vector< int > &shell, int maxRingSize)
Broken rings: the primitive rings, of at most maxRingSize members, of the water graph nList (by index...
std::array< double, 3 > periodicCentroid(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< int > &atoms)
Periodic centroid of a set of atoms: every atom is unwrapped to its minimum image about the first,...
IceClusterIons iceClusterIonCensus(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< bool > &ice, const std::vector< std::vector< int > > &nListByIndex, const std::vector< int > &ionIndices, double cutoff)
std::vector< int > shellRingCensus(const std::vector< std::vector< int > > &rings, const std::vector< int > &shell, int maxRingSize)
Rings of the water network that pass through a first shell: the census by size of every ring with at ...
molSys::PointCloud< molSys::Point< double >, double > ionCloud(const molSys::PointCloud< molSys::Point< double >, double > &src, const Table &table)
bool pointInFaces(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &rings, const std::vector< int > &faces, const std::array< double, 3 > &guest, const std::array< double, 3 > *center=nullptr)
std::vector< int > indicesOf(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const Table &table, Kind kind)
IonState
Ions read against a per-atom ice assignment.
Definition site.hpp:86
GuestOccupancy guestOccupancyInside(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &rings, const std::vector< std::vector< int > > &cageFaces, const std::vector< int > &guestIndices)
Occupancy by the inside predicate (pointInFaces) on every cage.
const std::vector< std::array< double, 3 > > & insideRayDirections()
The fixed, ordered unit directions the inside test casts rays along.
std::vector< std::vector< int > > cappedRings(const std::vector< std::vector< int > > &rings, const std::vector< int > &shell, int maxRingSize)
Capped rings: the water-only primitive rings of rings (the ring network of the water graph,...
Family
Definition site.hpp:41
@ electrolyte
Definition site.hpp:46
@ confinedWater
Definition site.hpp:48
@ ionicLiquid
Definition site.hpp:43
@ networkFormer
Definition site.hpp:49
Table parseSiteSpec(std::string_view spec)
Kind
Definition site.hpp:27
@ cationHead
Definition site.hpp:29
@ acceptor
Definition site.hpp:33
@ solvent
Definition site.hpp:38
@ unspecified
Definition site.hpp:28
GuestOccupancy guestOccupancy(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &cages, const std::vector< int > &guestIndices, double radius)
cages are vertex index lists into yCloud.pts; radius in the cloud's length unit (half the cage diamet...
InsideTrace pointInFacesTrace(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &rings, const std::vector< int > &faces, const std::array< double, 3 > &guest, const std::array< double, 3 > *center=nullptr)
The inside predicate for one cage.
IonEnvironment ionEnvironment(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< bool > &iceFlag, const std::vector< int > &ionIndices, const std::vector< int > &waterTypes, double cutoff)
iceFlag is indexed like yCloud.pts.
This contains a collection of points; contains information for a particular frame.
Definition mol_sys.hpp:173
This contains per-particle information.
Definition mol_sys.hpp:152
Guests read against enumerated cages.
Definition site.hpp:146
std::vector< int > cageOfGuest
per guest in input order, cage index or -1
Definition site.hpp:148
std::vector< double > centreDistance
per guest, distance to its cage center (-1 when free)
Definition site.hpp:149
int occupied
cages with at least one guest
Definition site.hpp:150
int multiply
cages with more than one guest
Definition site.hpp:151
int free
guests in no cage
Definition site.hpp:152
std::vector< int > guestsPerCage
per cage, guests inside
Definition site.hpp:147
std::vector< int > occupancyHistogram
hist[k] = cages with k guests
Definition site.hpp:153
Connected components of ice atoms on the water graph, and the ion count per component: each ion is as...
Definition site.hpp:215
std::vector< int > clusterOfIon
per ion in input order, or -1
Definition site.hpp:218
std::vector< int > ionsInCluster
per cluster
Definition site.hpp:217
std::vector< int > clusterOf
per atom, cluster id or -1
Definition site.hpp:216
bool onFace
the guest lies on a triangle within tolerance
Definition site.hpp:177
int rays
directions tried, grazing ones included
Definition site.hpp:178
int crossings
triangles met by the ray that decided
Definition site.hpp:179
std::vector< int > ion
cloud indices of the ions, in input order
Definition site.hpp:88
std::vector< int > shell
water molecules within the cutoff
Definition site.hpp:89
std::vector< std::vector< int > > members
per ion, the shell molecules (cloud indices)
Definition site.hpp:92
std::vector< double > iceFraction
labeled share of that shell
Definition site.hpp:90
std::vector< IonState > state
Definition site.hpp:91
Family family
Definition site.hpp:53
std::unordered_map< int, Kind > typeToKind
Definition site.hpp:54
Kind ofType(int typeId) const
Kind of(const molSys::Point< double > &p) const
std::unordered_map< int, Kind > atomOverride
Definition site.hpp:55