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
102 const std::vector<bool> &iceFlag, const std::vector<int> &ionIndices,
103 int waterType, double cutoff);
104
111std::vector<int> shellRingCensus(const std::vector<std::vector<int>> &rings,
112 const std::vector<int> &shell, int maxRingSize);
113
122 std::vector<int> guestsPerCage;
123 std::vector<int> cageOfGuest;
124 std::vector<double> centreDistance;
125 int occupied = 0;
126 int multiply = 0;
127 int free = 0;
128 std::vector<int> occupancyHistogram;
129};
130
134 const std::vector<std::vector<int>> &cages,
135 const std::vector<int> &guestIndices, double radius);
136
139std::array<double, 3>
141 const std::vector<int> &atoms);
142
151 const std::vector<std::vector<int>> &rings,
152 const std::vector<std::vector<int>> &cageFaces,
153 const std::vector<int> &guestIndices);
154
159 std::vector<int> clusterOf;
160 std::vector<int> ionsInCluster;
161 std::vector<int> clusterOfIon;
162 int nClusters = 0;
163};
164
167 const std::vector<bool> &ice,
168 const std::vector<std::vector<int>> &nListByIndex,
169 const std::vector<int> &ionIndices, double cutoff);
170} // namespace site
171
172#endif // SEAMS_SITE_H_
The main molecular system handler.
int lammpsTypeOfKind(const Table &table, Kind kind)
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)
IonEnvironment ionEnvironment(const molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< bool > &iceFlag, const std::vector< int > &ionIndices, int waterType, double cutoff)
iceFlag is indexed like yCloud.pts; waterType selects the water oxygens (0 accepts every atom that is...
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 ray-parity: a guest sits in a cage when a ray from the guest, in the frame that unwraps ...
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...
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:121
std::vector< int > cageOfGuest
per guest in input order, cage index or -1
Definition site.hpp:123
std::vector< double > centreDistance
per guest, distance to its cage centre (-1 when free)
Definition site.hpp:124
int occupied
cages with at least one guest
Definition site.hpp:125
int multiply
cages with more than one guest
Definition site.hpp:126
int free
guests in no cage
Definition site.hpp:127
std::vector< int > guestsPerCage
per cage, guests inside
Definition site.hpp:122
std::vector< int > occupancyHistogram
hist[k] = cages with k guests
Definition site.hpp:128
Connected components of ice atoms on the water graph, and the ion count per component: each ion is as...
Definition site.hpp:158
std::vector< int > clusterOfIon
per ion in input order, or -1
Definition site.hpp:161
std::vector< int > ionsInCluster
per cluster
Definition site.hpp:160
std::vector< int > clusterOf
per atom, cluster id or -1
Definition site.hpp:159
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
labelled 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