seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
seams.hpp
Go to the documentation of this file.
1/* Copyright (c) d-SEAMS developers */
2#ifndef SEAMS_HPP_
3#define SEAMS_HPP_
4
22
23#include "seams.h"
24
25#include <algorithm>
26#include <array>
27#include <cstddef>
28#include <span>
29#include <stdexcept>
30#include <string>
31#include <string_view>
32#include <utility>
33#include <vector>
34
39
40namespace seams {
41
58
73
84
102
121
132
150
155enum class Axis : int {
156 X = 0,
157 Y = 1,
158 Z = 2
159};
160
165enum class DomainSubset : int {
166 Apolar = 0,
167 Polar = 1
168};
169
177class Error : public std::runtime_error {
178 public:
184 Error(int status, std::string message)
185 : std::runtime_error(std::move(message)), code_(status) {}
186
191 [[nodiscard]] Status status() const noexcept {
192 return static_cast<Status>(code_);
193 }
194
199 [[nodiscard]] int code() const noexcept { return code_; }
200
201 private:
202 int code_;
203};
204
213 std::vector<int> labels;
214 std::array<int, 9> counts{};
215};
216
224 std::vector<double> local;
225 std::vector<double> average;
226};
227
232struct Q4Q6 {
233 std::vector<double> q4;
234 std::vector<double> q6;
235};
236
241struct Q6Bar {
242 std::vector<double> values;
243 double mean = 0;
244 double median = 0;
245 int n_ice = 0;
246};
247
253 std::vector<double> radius;
254 std::vector<double> g;
255 std::vector<int> count;
256 double volume = 0;
257};
258
264 std::vector<double> radius;
265 std::vector<double> coordination;
266};
267
273 int hexagonal = 0;
274 int cubic = 0;
275 int water = 0;
276 int both = 0;
277};
278
284 std::size_t cages = 0;
285 std::size_t atoms = 0;
286};
287
292struct Contacts {
293 std::size_t pairs = 0;
294 int cations = 0;
295 int anions = 0;
296};
297
303 int subset = 0;
304 int largest = 0;
305 double percolation = 0;
306};
307
315 std::array<int, 7> perfect{};
316 std::array<int, 7> imperfect{};
317};
318
324 std::vector<double> coordinate;
325 std::vector<double> density;
326};
327
333 double enter = 0;
334 double exit = 0;
335 double thickness = 0;
336 bool found = false;
337};
338
343struct Rejection {
344 double ice = 0;
345 double liquid = 0;
346 double k = 0;
347 bool defined = false;
348};
349
355 std::vector<double> coordinate;
356 std::vector<double> molality;
357 std::vector<double> ice_fraction;
358};
359
364struct Pockets {
365 int pockets = 0;
367};
368
379
385 double cutoff = 3.5;
386 int species = 0;
387 int order = 6;
388 bool average = false;
389};
390
396 double cutoff = 3.5;
397 int species = 0;
398 int order = 6;
400 bool average = false;
401};
402
408 double cutoff = 3.5;
409 int species = 0;
410 double ice_cut = 0.36;
411};
412
418 double cutoff = 3.5;
419 int species = 0;
421};
422
428 int k = 4;
429 double cutoff = 3.5;
430 int species = 0;
431 bool mutual = false;
432};
433
439 double cutoff = 3.5;
440 int species = 0;
442 int max_size = 6;
443};
444
450 double cutoff = 3.5;
451 int species = 0;
453 int k = 4;
454 bool complete = false;
455};
456
462 double cutoff = 3.5;
463 int species = 0;
465 std::string spec = "512";
466};
467
473 double rmax = 6;
474 int bins = 0;
475 int type_i = 0;
476 int type_j = 0;
477};
478
484 double cutoff = 3.5;
485 int oxygen = 1;
486 int hydrogen = 2;
487 double distance = 2.42;
488 double angle = 30;
489};
490
496 int species = 0;
497 int bins = 0;
499};
500
506 double cutoff = 3.5;
507 int species = 0;
508 int k = 4;
510 int hops = 2;
511 bool color_types = false;
512};
513
523
529 double cutoff = 3.5;
530 int species = 0;
531};
532
538 double cutoff = 3.5;
539 int species = 0;
540 int max_size = 6;
541 double sheet_area = 0;
542};
543
549 int water_type = 0;
550 int ion_type = 0;
551 int bins = 0;
553};
554
555namespace detail {
556
557inline void check(int status, const void *handle) {
558 if (status == SEAMS_OK) {
559 return;
560 }
561 const char *text = seams_handle_error(handle);
562 throw Error(status, text == nullptr ? std::string() : std::string(text));
563}
564
565template <class T, void (*Destroy)(T *)>
566class Handle {
567 public:
568 Handle() = default;
569 explicit Handle(T *ptr) noexcept : ptr_(ptr) {}
570 Handle(const Handle &) = delete;
571 Handle &operator=(const Handle &) = delete;
572 Handle(Handle &&other) noexcept : ptr_(std::exchange(other.ptr_, nullptr)) {}
573 Handle &operator=(Handle &&other) noexcept {
574 if (this != &other) {
575 reset();
576 ptr_ = std::exchange(other.ptr_, nullptr);
577 }
578 return *this;
579 }
580 ~Handle() { reset(); }
581
582 [[nodiscard]] explicit operator bool() const noexcept { return ptr_ != nullptr; }
583
584 protected:
585 [[nodiscard]] T *get() const noexcept { return ptr_; }
586
587 void reset() noexcept {
588 if (ptr_ != nullptr) {
589 Destroy(ptr_);
590 ptr_ = nullptr;
591 }
592 }
593 T *ptr_ = nullptr;
594};
595
596template <class Call>
597inline std::string copy_text(Call call, const void *handle) {
598 std::size_t n_out = 0;
599 check(call(handle, nullptr, 0, &n_out), handle);
600 std::string text(n_out + 1, '\0');
601 check(call(handle, text.data(), text.size(), &n_out), handle);
602 text.resize(n_out);
603 return text;
604}
605
606} // namespace detail
607
617 int size = 0;
618 std::vector<int> atoms;
619 std::vector<int> per_atom;
620
622 [[nodiscard]] std::size_t count() const {
623 return size > 0 ? atoms.size() / static_cast<std::size_t>(size) : 0;
624 }
625
626 [[nodiscard]] std::vector<int> cycle(std::size_t index) const {
627 const auto first =
628 atoms.begin() + static_cast<std::ptrdiff_t>(index * static_cast<std::size_t>(size));
629 return std::vector<int>(first, first + size);
630 }
631};
632
640class Neighbours : public detail::Handle<seams_neighbours, seams_neighbours_destroy> {
641 public:
643
648 [[nodiscard]] std::size_t nnz() const {
649 std::size_t n_offsets = 0;
650 std::size_t count = 0;
651 detail::check(seams_neighbours_copy(get(), nullptr, 0, &n_offsets, nullptr, 0, &count), get());
652 return count;
653 }
654
659 [[nodiscard]] std::vector<int> degrees() const {
660 std::size_t n_offsets = 0;
661 std::size_t count = 0;
662 detail::check(seams_neighbours_copy(get(), nullptr, 0, &n_offsets, nullptr, 0, &count), get());
663 std::vector<int> offsets(n_offsets);
664 std::vector<int> cols(count);
665 detail::check(seams_neighbours_copy(get(), offsets.data(), offsets.size(), &n_offsets,
666 cols.data(), cols.size(), &count),
667 get());
668 std::vector<int> degree;
669 if (n_offsets > 0) {
670 degree.reserve(n_offsets - 1);
671 for (std::size_t i = 0; i + 1 < n_offsets; ++i) {
672 degree.push_back(offsets[i + 1] - offsets[i]);
673 }
674 }
675 return degree;
676 }
677
682 [[nodiscard]] std::vector<std::pair<int, int>> pairs() const {
683 std::size_t n_offsets = 0;
684 std::size_t count = 0;
685 detail::check(seams_neighbours_copy(get(), nullptr, 0, &n_offsets, nullptr, 0, &count), get());
686 std::vector<int> offsets(n_offsets);
687 std::vector<int> cols(count);
688 detail::check(seams_neighbours_copy(get(), offsets.data(), offsets.size(), &n_offsets,
689 cols.data(), cols.size(), &count),
690 get());
691 std::vector<std::pair<int, int>> out;
692 out.reserve(count);
693 for (std::size_t atom = 0; atom + 1 < n_offsets; ++atom) {
694 for (int cursor = offsets[atom]; cursor < offsets[atom + 1]; ++cursor) {
695 const int neighbour = cols[static_cast<std::size_t>(cursor)];
696 if (neighbour != static_cast<int>(atom)) {
697 out.emplace_back(static_cast<int>(atom), neighbour);
698 }
699 }
700 }
701 return out;
702 }
703
709 [[nodiscard]] ChordlessCycles chordless(int size) const {
710 ChordlessCycles out;
711 out.size = size;
712 out.per_atom.resize(static_cast<std::size_t>(seams_neighbours_count(get())));
713 std::size_t count = 0;
714 detail::check(seams_rings_chordless(get(), size, nullptr, 0, &count, out.per_atom.data(),
715 out.per_atom.size()),
716 get());
717 out.atoms.resize(count * static_cast<std::size_t>(size));
718 detail::check(seams_rings_chordless(get(), size, out.atoms.data(), out.atoms.size(), &count,
719 nullptr, 0),
720 get());
721 return out;
722 }
723};
724
731class Rings : public detail::Handle<seams_rings, seams_rings_destroy> {
732 public:
734
739 [[nodiscard]] int size() const { return seams_rings_count(get()); }
740
746 [[nodiscard]] std::vector<int> vertices(int index) const {
747 std::size_t n_out = 0;
748 detail::check(seams_rings_vertices(get(), index, nullptr, 0, &n_out), get());
749 std::vector<int> atoms(n_out);
750 detail::check(seams_rings_vertices(get(), index, atoms.data(), n_out, &n_out), get());
751 atoms.resize(n_out);
752 return atoms;
753 }
754
760 [[nodiscard]] std::vector<int> histogram(int up_to) const {
761 std::vector<int> counts(static_cast<std::size_t>(up_to + 1));
762 detail::check(seams_rings_histogram(get(), counts.data(), up_to + 1), get());
763 return counts;
764 }
765
771 [[nodiscard]] double fraction(int ring_size) const {
772 double value = 0;
773 detail::check(seams_rings_fraction(get(), ring_size, &value), get());
774 return value;
775 }
776
778 class iterator {
779 public:
780 using value_type = std::vector<int>;
781 using difference_type = std::ptrdiff_t;
782 iterator(const Rings *owner, int index) : owner_(owner), index_(index) {}
783 [[nodiscard]] value_type operator*() const { return owner_->vertices(index_); }
785 ++index_;
786 return *this;
787 }
788 [[nodiscard]] bool operator==(const iterator &other) const { return index_ == other.index_; }
789 [[nodiscard]] bool operator!=(const iterator &other) const { return !(*this == other); }
790
791 private:
792 const Rings *owner_ = nullptr;
793 int index_ = 0;
794 };
795
797 [[nodiscard]] iterator begin() const { return iterator(this, 0); }
799 [[nodiscard]] iterator end() const { return iterator(this, size()); }
800};
801
806class Cages : public detail::Handle<seams_cage_set, seams_cages_destroy> {
807 public:
809
814 [[nodiscard]] CageCounts counts() const {
815 CageCounts out;
816 detail::check(seams_cages_counts(get(), &out.hexagonal, &out.cubic, &out.water, &out.both),
817 get());
818 return out;
819 }
820
826 [[nodiscard]] std::vector<int> labels(std::size_t n_atoms) const {
827 std::vector<int> per_atom(n_atoms);
828 detail::check(seams_cages_labels(get(), per_atom.data(), per_atom.size()), get());
829 return per_atom;
830 }
831};
832
837class Fingerprint : public detail::Handle<seams_topo, seams_fingerprint_destroy> {
838 public:
840
845 [[nodiscard]] std::string key() const {
846 return detail::copy_text(
847 [](const void *handle, char *buf, std::size_t cap, std::size_t *n_out) {
848 return seams_fingerprint_key(static_cast<const seams_topo *>(handle), buf, cap, n_out);
849 },
850 get());
851 }
852
858 [[nodiscard]] std::string atom(int index) const {
859 std::size_t n_out = 0;
860 detail::check(seams_fingerprint_atom(get(), index, nullptr, 0, &n_out), get());
861 std::string text(n_out + 1, '\0');
862 detail::check(seams_fingerprint_atom(get(), index, text.data(), text.size(), &n_out), get());
863 text.resize(n_out);
864 return text;
865 }
866
871 [[nodiscard]] std::vector<int> rings() const {
872 std::vector<int> counts(13);
873 detail::check(seams_fingerprint_rings(get(), counts.data(), counts.size()), get());
874 return counts;
875 }
876};
877
882class Brine : public detail::Handle<seams_brine, seams_brine_destroy> {
883 public:
885
887 [[nodiscard]] BrineFronts fronts() const {
888 BrineFronts out;
889 int found = 0;
890 detail::check(seams_brine_fronts(get(), &out.enter, &out.exit, &out.thickness, &found), get());
891 out.found = found != 0;
892 return out;
893 }
894
896 [[nodiscard]] Rejection rejection() const {
897 Rejection out;
898 int defined = 0;
899 detail::check(seams_brine_rejection(get(), &out.ice, &out.liquid, &out.k, &defined), get());
900 out.defined = defined != 0;
901 return out;
902 }
903
905 [[nodiscard]] BrineProfile profile() const {
906 std::size_t n_out = 0;
907 detail::check(seams_brine_profile(get(), nullptr, nullptr, nullptr, 0, &n_out), get());
908 BrineProfile out;
909 out.coordinate.resize(n_out);
910 out.molality.resize(n_out);
911 out.ice_fraction.resize(n_out);
912 detail::check(seams_brine_profile(get(), out.coordinate.data(), out.molality.data(),
913 out.ice_fraction.data(), n_out, &n_out),
914 get());
915 out.coordinate.resize(n_out);
916 out.molality.resize(n_out);
917 out.ice_fraction.resize(n_out);
918 return out;
919 }
920
922 [[nodiscard]] Pockets pockets() const {
923 Pockets out;
925 return out;
926 }
927};
928
939class System : public detail::Handle<seams_system, seams_system_destroy> {
940 public:
946 if (get() == nullptr) {
948 }
949 }
950
958 void set_ortho(std::span<const double> xyz, double lx, double ly, double lz) {
959 const double origin[3] = {0, 0, 0};
960 const double lengths[3] = {lx, ly, lz};
961 set_ortho(xyz, origin, lengths);
962 }
963
972 void set_ortho(std::span<const double> xyz, std::span<const double, 3> origin,
973 std::span<const double, 3> lengths, std::span<const int> types = {},
974 std::span<const int> ids = {}) {
975 if (xyz.size() % 3 != 0) {
976 throw Error(SEAMS_ERR_ARG, "coordinates are not a multiple of 3");
977 }
978 const auto n = static_cast<int>(xyz.size() / 3);
979 detail::check(seams_system_set_ortho(get(), xyz.data(), n, origin[0], origin[1], origin[2],
980 lengths[0], lengths[1], lengths[2],
981 types.empty() ? nullptr : types.data(),
982 ids.empty() ? nullptr : ids.data()),
983 get());
984 }
985
993 void set_frame(std::span<const double> xyz, std::span<const double, 9> box9,
994 std::span<const int> types = {}, std::span<const int> ids = {}) {
995 if (xyz.size() % 3 != 0) {
996 throw Error(SEAMS_ERR_ARG, "coordinates are not a multiple of 3");
997 }
998 const auto n = static_cast<int>(xyz.size() / 3);
999 detail::check(seams_system_set_frame(get(), xyz.data(), n, box9.data(),
1000 types.empty() ? nullptr : types.data(),
1001 ids.empty() ? nullptr : ids.data()),
1002 get());
1003 }
1004
1005 std::pair<std::vector<int>, std::vector<int>> chill(double cutoff, int type, int graph,
1006 int rule) {
1007 const int n = count();
1008 std::vector<int> labels(static_cast<std::size_t>(std::max(n, 0)));
1009 int counts[9] = {};
1010 detail::check(seams_chill(get(), cutoff, type, graph, rule, labels.data(),
1011 static_cast<std::size_t>(std::max(n, 0)), counts),
1012 get());
1013 return {labels, std::vector<int>(counts, counts + 9)};
1014 }
1015
1016 std::pair<std::vector<double>, std::vector<double>> steinhardt(double cutoff, int order,
1017 bool average) {
1018 const int n = count();
1019 std::vector<double> ql(static_cast<std::size_t>(std::max(n, 0)));
1020 std::vector<double> bar;
1021 double *bar_ptr = nullptr;
1022 if (average) {
1023 bar.resize(static_cast<std::size_t>(std::max(n, 0)));
1024 bar_ptr = bar.data();
1025 }
1026 detail::check(seams_steinhardt(get(), cutoff, 0, order, ql.data(),
1027 static_cast<std::size_t>(std::max(n, 0)), bar_ptr,
1028 average ? static_cast<std::size_t>(std::max(n, 0)) : 0),
1029 get());
1030 return {ql, bar};
1031 }
1032
1039 void read(std::string_view path, int frame, int type_filter) {
1040 const std::string text(path);
1041 detail::check(seams_system_read(get(), text.c_str(), frame, type_filter), get());
1042 }
1043
1048 [[nodiscard]] int count() const { return seams_system_count(get()); }
1049
1051 [[nodiscard]] Classification chill(const ChillOptions &options) {
1052 return classify(false, options);
1053 }
1054
1056 [[nodiscard]] Classification chill_plus(const ChillOptions &options) {
1057 return classify(true, options);
1058 }
1059
1064 [[nodiscard]] Steinhardt steinhardt(const SteinhardtOptions &options) {
1065 const auto n = static_cast<std::size_t>(count());
1066 Steinhardt out;
1067 out.local.resize(n);
1068 if (options.average) {
1069 out.average.resize(n);
1070 }
1071 detail::check(seams_steinhardt(get(), options.cutoff, options.species, options.order,
1072 out.local.data(), n,
1073 options.average ? out.average.data() : nullptr, n),
1074 get());
1075 return out;
1076 }
1077
1079 [[nodiscard]] Steinhardt ql(const OrderOptions &options) {
1080 const auto n = static_cast<std::size_t>(count());
1081 Steinhardt out;
1082 out.local.resize(n);
1083 if (options.average) {
1084 out.average.resize(n);
1085 }
1086 detail::check(seams_ql(get(), options.cutoff, options.species, options.order,
1087 static_cast<int>(options.graph), out.local.data(), n,
1088 options.average ? out.average.data() : nullptr, n),
1089 get());
1090 return out;
1091 }
1092
1094 [[nodiscard]] Q4Q6 q4q6(double cutoff, int species = 0) {
1095 const auto n = static_cast<std::size_t>(count());
1096 Q4Q6 out;
1097 out.q4.resize(n);
1098 out.q6.resize(n);
1099 detail::check(seams_q4q6(get(), cutoff, species, out.q4.data(), out.q6.data()), get());
1100 return out;
1101 }
1102
1104 [[nodiscard]] Q6Bar q6bar(const Q6BarOptions &options) {
1105 const auto n = static_cast<std::size_t>(count());
1106 Q6Bar out;
1107 out.values.resize(n);
1108 detail::check(seams_q6bar(get(), options.cutoff, options.species, options.ice_cut,
1109 out.values.data(), n, &out.mean, &out.median, &out.n_ice),
1110 get());
1111 return out;
1112 }
1113
1115 [[nodiscard]] Neighbours neighbours(const NeighbourOptions &options) {
1116 seams_neighbours *out = nullptr;
1118 static_cast<int>(options.graph), &out),
1119 get());
1120 return Neighbours(out);
1121 }
1122
1129 [[nodiscard]] ChordlessCycles rings_chordless(const NeighbourOptions &options, int size) {
1130 return neighbours(options).chordless(size);
1131 }
1132
1134 [[nodiscard]] Neighbours knn(const KnnOptions &options) {
1135 seams_neighbours *out = nullptr;
1136 detail::check(seams_neighbours_knn(get(), options.k, options.cutoff, options.species,
1137 options.mutual ? 1 : 0, &out),
1138 get());
1139 return Neighbours(out);
1140 }
1141
1147 [[nodiscard]] std::vector<int> neighbour_degree(double cutoff, int species = 0) {
1148 return neighbours(NeighbourOptions{cutoff, species, Graph::Cutoff}).degrees();
1149 }
1150
1152 [[nodiscard]] Rings rings(const RingOptions &options) {
1153 seams_rings *out = nullptr;
1154 detail::check(seams_rings_find(get(), options.cutoff, options.species,
1155 static_cast<int>(options.graph), options.max_size, &out),
1156 get());
1157 return Rings(out);
1158 }
1159
1161 [[nodiscard]] Cages cages(const CageOptions &options) {
1162 seams_cage_set *out = nullptr;
1163 detail::check(seams_cages(get(), options.cutoff, options.species,
1164 static_cast<int>(options.graph), options.k, options.complete ? 1 : 0,
1165 &out),
1166 get());
1167 return Cages(out);
1168 }
1169
1171 [[nodiscard]] SignatureMatch signature_cages(const SignatureOptions &options) {
1172 SignatureMatch out;
1174 static_cast<int>(options.graph), options.spec.c_str(),
1175 &out.cages, &out.atoms),
1176 get());
1177 return out;
1178 }
1179
1181 [[nodiscard]] Distribution rdf(const DistributionOptions &options) {
1182 std::size_t n_out = 0;
1183 Distribution out;
1184 detail::check(seams_rdf(get(), options.rmax, options.bins, options.type_i, options.type_j,
1185 nullptr, nullptr, nullptr, 0, &n_out, &out.volume),
1186 get());
1187 out.radius.resize(n_out);
1188 out.g.resize(n_out);
1189 out.count.resize(n_out);
1190 detail::check(seams_rdf(get(), options.rmax, options.bins, options.type_i, options.type_j,
1191 out.radius.data(), out.g.data(), out.count.data(), n_out, &n_out,
1192 nullptr),
1193 get());
1194 out.radius.resize(n_out);
1195 out.g.resize(n_out);
1196 out.count.resize(n_out);
1197 return out;
1198 }
1199
1202 std::size_t n_out = 0;
1203 detail::check(seams_running_cn(get(), options.rmax, options.bins, options.type_i,
1204 options.type_j, nullptr, nullptr, 0, &n_out),
1205 get());
1207 out.radius.resize(n_out);
1208 out.coordination.resize(n_out);
1209 detail::check(seams_running_cn(get(), options.rmax, options.bins, options.type_i,
1210 options.type_j, out.radius.data(), out.coordination.data(),
1211 n_out, &n_out),
1212 get());
1213 out.radius.resize(n_out);
1214 out.coordination.resize(n_out);
1215 return out;
1216 }
1217
1219 [[nodiscard]] double coordination(const DistributionOptions &options) {
1220 double cn = 0;
1221 detail::check(seams_coordination(get(), options.rmax, options.bins, options.type_i,
1222 options.type_j, &cn),
1223 get());
1224 return cn;
1225 }
1226
1228 [[nodiscard]] int hbonds(const BondOptions &options) {
1229 int n_bonds = 0;
1230 detail::check(seams_hbonds(get(), options.cutoff, options.oxygen, options.hydrogen,
1231 options.distance, options.angle, &n_bonds),
1232 get());
1233 return n_bonds;
1234 }
1235
1237 [[nodiscard]] DensityProfile density(const DensityOptions &options) {
1238 std::size_t n_out = 0;
1239 detail::check(seams_density_axis(get(), options.species, options.bins,
1240 static_cast<int>(options.axis), nullptr, nullptr, 0, &n_out),
1241 get());
1242 DensityProfile out;
1243 out.coordinate.resize(n_out);
1244 out.density.resize(n_out);
1245 detail::check(seams_density_axis(get(), options.species, options.bins,
1246 static_cast<int>(options.axis), out.coordinate.data(),
1247 out.density.data(), n_out, &n_out),
1248 get());
1249 out.coordinate.resize(n_out);
1250 out.density.resize(n_out);
1251 return out;
1252 }
1253
1255 [[nodiscard]] Fingerprint fingerprint(const FingerprintOptions &options) {
1256 seams_topo *out = nullptr;
1257 detail::check(seams_fingerprint(get(), options.cutoff, options.species, options.k,
1258 static_cast<int>(options.graph), options.hops,
1259 options.color_types ? 1 : 0, &out),
1260 get());
1261 return Fingerprint(out);
1262 }
1263
1265 [[nodiscard]] Contacts contact_pairs(std::string_view spec) {
1266 const std::string text(spec);
1267 Contacts out;
1268 detail::check(seams_contact_pairs(get(), text.c_str(), &out.pairs, &out.cations, &out.anions),
1269 get());
1270 return out;
1271 }
1272
1274 [[nodiscard]] DomainReport domains(const DomainOptions &options) {
1275 DomainReport out;
1276 detail::check(seams_domains(get(), options.cutoff, options.spec.c_str(),
1277 static_cast<int>(options.subset), &out.subset, &out.largest,
1278 &out.percolation),
1279 get());
1280 return out;
1281 }
1282
1284 [[nodiscard]] PrismCensus prisms(const PrismOptions &options) {
1285 PrismCensus out;
1286 detail::check(seams_prisms(get(), options.cutoff, options.species, out.perfect.data(),
1287 out.imperfect.data(), out.perfect.size()),
1288 get());
1289 return out;
1290 }
1291
1296 [[nodiscard]] std::vector<int> monolayer(const SheetOptions &options) {
1297 std::vector<int> counts(static_cast<std::size_t>(options.max_size + 1));
1298 detail::check(seams_monolayer(get(), options.cutoff, options.species, options.max_size,
1299 options.sheet_area, counts.data(), counts.size()),
1300 get());
1301 return counts;
1302 }
1303
1309 [[nodiscard]] std::vector<int> site_table(std::string_view spec) {
1310 const std::string text(spec);
1311 std::vector<int> kinds(static_cast<std::size_t>(count()));
1312 detail::check(seams_site_table(get(), text.c_str(), kinds.data(), kinds.size()), get());
1313 return kinds;
1314 }
1315
1321 [[nodiscard]] std::vector<int> symmetry(double shell_rmsd) {
1322 std::vector<int> labels(static_cast<std::size_t>(count()));
1323 detail::check(seams_system_symmetry(get(), shell_rmsd, labels.data(), labels.size()), get());
1324 return labels;
1325 }
1326
1332 [[nodiscard]] Brine brine(std::span<const int> ice, const BrineOptions &options) {
1333 seams_brine *out = nullptr;
1334 detail::check(seams_brine_analyse(get(), ice.data(), ice.size(), options.water_type,
1335 options.ion_type, options.bins,
1336 static_cast<int>(options.axis), &out),
1337 get());
1338 return Brine(out);
1339 }
1340
1341 private:
1342 [[nodiscard]] Classification classify(bool plus, const ChillOptions &options) {
1343 const auto n = static_cast<std::size_t>(count());
1344 Classification out;
1345 out.labels.resize(n);
1346 if (plus) {
1347 detail::check(seams_chill_plus(get(), options.cutoff, options.species,
1348 static_cast<int>(options.graph),
1349 static_cast<int>(options.rule), out.labels.data(),
1350 out.counts.data()),
1351 get());
1352 } else {
1353 detail::check(seams_chill(get(), options.cutoff, options.species,
1354 static_cast<int>(options.graph), static_cast<int>(options.rule),
1355 out.labels.data(), n, out.counts.data()),
1356 get());
1357 }
1358 return out;
1359 }
1360};
1361
1367[[nodiscard]] inline std::string version() {
1368 const char *text = seams_version_string();
1369 return text == nullptr ? std::string() : std::string(text);
1370}
1371
1377[[nodiscard]] inline int abi() { return seams_abi(); }
1378
1384inline void set_num_threads(int n) { detail::check(seams_set_num_threads(n), nullptr); }
1385
1391[[nodiscard]] inline int num_threads() { return seams_get_num_threads(); }
1392
1399[[nodiscard]] inline std::size_t nframes(std::string_view path) {
1400 const std::string text(path);
1401 std::size_t count = 0;
1402 detail::check(seams_path_nframes(text.c_str(), &count), nullptr);
1403 return count;
1404}
1405
1412[[nodiscard]] inline std::string_view label_name(Label label) {
1413 const char *text = seams_label_name(static_cast<int>(label));
1414 return text == nullptr ? std::string_view() : std::string_view(text);
1415}
1416
1423[[nodiscard]] inline std::string_view ring_symmetry_name(RingSymmetry symmetry) {
1424 const char *text = seams_ring_symmetry_name(static_cast<int>(symmetry));
1425 return text == nullptr ? std::string_view() : std::string_view(text);
1426}
1427
1428} // namespace seams
1429
1430#endif
Owned planar ice-front measurement.
Definition seams.hpp:882
Rejection rejection() const
Molal rejection coefficient.
Definition seams.hpp:896
BrineProfile profile() const
Concentration profile along the front axis.
Definition seams.hpp:905
Pockets pockets() const
Pockets trapped in the ice, and the liquid reservoir.
Definition seams.hpp:922
BrineFronts fronts() const
The two planar crossings.
Definition seams.hpp:887
Owned hexagonal and double-diamond membership.
Definition seams.hpp:806
CageCounts counts() const
Disjoint population counts.
Definition seams.hpp:814
std::vector< int > labels(std::size_t n_atoms) const
One cage code per atom.
Definition seams.hpp:826
Failure from the C API, or from a rejected argument.
Definition seams.hpp:177
Status status() const noexcept
Status as the Status enumeration when the code is known.
Definition seams.hpp:191
int code() const noexcept
Status integer.
Definition seams.hpp:199
Error(int status, std::string message)
Build an error from a status and a message.
Definition seams.hpp:184
Owned topological fingerprint.
Definition seams.hpp:837
std::string atom(int index) const
Local key of one atom.
Definition seams.hpp:858
std::vector< int > rings() const
Primitive-ring census stored on the fingerprint.
Definition seams.hpp:871
std::string key() const
Frame fingerprint text.
Definition seams.hpp:845
Owned neighbour list.
Definition seams.hpp:640
ChordlessCycles chordless(int size) const
Chordless cycles of one length on this graph.
Definition seams.hpp:709
std::vector< int > degrees() const
Degree of each atom.
Definition seams.hpp:659
std::vector< std::pair< int, int > > pairs() const
Directed pairs (atom, neighbour).
Definition seams.hpp:682
std::size_t nnz() const
Number of neighbour pairs, omitting self.
Definition seams.hpp:648
Input iterator.
Definition seams.hpp:778
iterator & operator++()
Definition seams.hpp:784
std::vector< int > value_type
Definition seams.hpp:780
value_type operator*() const
Definition seams.hpp:783
bool operator!=(const iterator &other) const
Definition seams.hpp:789
std::ptrdiff_t difference_type
Definition seams.hpp:781
iterator(const Rings *owner, int index)
Definition seams.hpp:782
bool operator==(const iterator &other) const
Definition seams.hpp:788
Owned primitive-ring set.
Definition seams.hpp:731
std::vector< int > histogram(int up_to) const
Histogram of ring size.
Definition seams.hpp:760
iterator end() const
Past the last ring.
Definition seams.hpp:799
iterator begin() const
First ring.
Definition seams.hpp:797
int size() const
Number of primitive rings.
Definition seams.hpp:739
std::vector< int > vertices(int index) const
Atom indices of one ring.
Definition seams.hpp:746
double fraction(int ring_size) const
Fraction of atoms that sit on a ring of one size.
Definition seams.hpp:771
Rings rings(const RingOptions &options)
Primitive rings up to a maximum size.
Definition seams.hpp:1152
Classification chill_plus(const ChillOptions &options)
CHILL+ labels and nine population counts.
Definition seams.hpp:1056
SignatureMatch signature_cages(const SignatureOptions &options)
Closed cages of one ring census.
Definition seams.hpp:1171
Q6Bar q6bar(const Q6BarOptions &options)
q6-bar, its mean and median, and the ice count above the cut.
Definition seams.hpp:1104
RunningCoordination running_cn(const DistributionOptions &options)
Running coordination number along the partial RDF.
Definition seams.hpp:1201
std::vector< int > neighbour_degree(double cutoff, int species=0)
Degree of each atom on the cutoff graph.
Definition seams.hpp:1147
void set_ortho(std::span< const double > xyz, std::span< const double, 3 > origin, std::span< const double, 3 > lengths, std::span< const int > types={}, std::span< const int > ids={})
Store points in an orthorhombic cell.
Definition seams.hpp:972
Distribution rdf(const DistributionOptions &options)
Partial radial distribution and the cell volume.
Definition seams.hpp:1181
PrismCensus prisms(const PrismOptions &options)
Perfect and imperfect prism counts by ring size.
Definition seams.hpp:1284
Neighbours neighbours(const NeighbourOptions &options)
Cutoff or mutual neighbour list.
Definition seams.hpp:1115
DensityProfile density(const DensityOptions &options)
Number density along one cell axis.
Definition seams.hpp:1237
Steinhardt ql(const OrderOptions &options)
Local q_l on a named graph.
Definition seams.hpp:1079
Q4Q6 q4q6(double cutoff, int species=0)
Local q4 and q6 on the cutoff shell.
Definition seams.hpp:1094
Contacts contact_pairs(std::string_view spec)
Mutual nearest unlike contacts.
Definition seams.hpp:1265
double coordination(const DistributionOptions &options)
Coordination number integrated to rmax.
Definition seams.hpp:1219
int count() const
Number of points in the frame.
Definition seams.hpp:1048
std::vector< int > site_table(std::string_view spec)
Per-atom site kind.
Definition seams.hpp:1309
System()
Allocate an empty frame.
Definition seams.hpp:945
void read(std::string_view path, int frame, int type_filter)
Read one frame from a trajectory path.
Definition seams.hpp:1039
Brine brine(std::span< const int > ice, const BrineOptions &options)
Planar ice front from an ice assignment.
Definition seams.hpp:1332
Fingerprint fingerprint(const FingerprintOptions &options)
Topological fingerprint of the bonded graph.
Definition seams.hpp:1255
Steinhardt steinhardt(const SteinhardtOptions &options)
Local q_l on the cutoff shell.
Definition seams.hpp:1064
Cages cages(const CageOptions &options)
Hexagonal and double-diamond cage membership.
Definition seams.hpp:1161
std::vector< int > monolayer(const SheetOptions &options)
Primitive-ring histogram of a monolayer.
Definition seams.hpp:1296
std::pair< std::vector< double >, std::vector< double > > steinhardt(double cutoff, int order, bool average)
Definition seams.hpp:1016
DomainReport domains(const DomainOptions &options)
Largest polar or apolar domain.
Definition seams.hpp:1274
Neighbours knn(const KnnOptions &options)
k-nearest neighbour list.
Definition seams.hpp:1134
int hbonds(const BondOptions &options)
Hydrogen-bond count.
Definition seams.hpp:1228
ChordlessCycles rings_chordless(const NeighbourOptions &options, int size)
Chordless cycles of one length on a neighbour graph.
Definition seams.hpp:1129
void set_ortho(std::span< const double > xyz, double lx, double ly, double lz)
Store points in an orthorhombic cell whose origin is zero.
Definition seams.hpp:958
std::pair< std::vector< int >, std::vector< int > > chill(double cutoff, int type, int graph, int rule)
Definition seams.hpp:1005
Classification chill(const ChillOptions &options)
Original CHILL labels and nine population counts.
Definition seams.hpp:1051
void set_frame(std::span< const double > xyz, std::span< const double, 9 > box9, std::span< const int > types={}, std::span< const int > ids={})
Store points and a general nine-number cell.
Definition seams.hpp:993
std::vector< int > symmetry(double shell_rmsd)
Per-atom ice-shell label.
Definition seams.hpp:1321
Handle(T *ptr) noexcept
Definition seams.hpp:569
Handle & operator=(const Handle &)=delete
Handle(Handle &&other) noexcept
Definition seams.hpp:572
void reset() noexcept
Definition seams.hpp:587
T * get() const noexcept
Definition seams.hpp:585
Handle & operator=(Handle &&other) noexcept
Definition seams.hpp:573
Handle(const Handle &)=delete
SEAMS_API seams_status seams_brine_pockets(const seams_brine *front, int *n_pockets, int *reservoir_waters)
Brine pockets trapped in the ice, excluding the liquid reservoir.
SEAMS_API seams_status seams_brine_profile(const seams_brine *front, double *z_mid, double *molality, double *ice_fraction, size_t cap, size_t *n_out)
Concentration profile along the front axis.
SEAMS_API seams_status seams_brine_analyse(seams_system *sys, const int *ice, size_t n_ice, int water_type, int ion_type, int n_bins, int axis, seams_brine **out)
Planar ice/brine front from an ice assignment.
SEAMS_API seams_status seams_brine_fronts(const seams_brine *front, double *z_enter, double *z_exit, double *thickness, int *found)
The two planar crossings of the ice slab.
SEAMS_API void seams_brine_destroy(seams_brine *front)
Free a brine-front handle.
SEAMS_API seams_status seams_brine_rejection(const seams_brine *front, double *c_ice, double *c_liquid, double *k, int *defined)
Molal rejection coefficient k = c_ice / c_liquid.
SEAMS_API seams_status seams_system_symmetry(seams_system *sys, double shell_rmsd, int *labels, size_t labels_len)
Per-atom ice shell label.
SEAMS_API void seams_cages_destroy(seams_cage_set *cages)
Free a cage-membership handle.
SEAMS_API seams_status seams_cages_labels(const seams_cage_set *cages, int *per_atom, size_t len)
Per-atom cage code.
SEAMS_API seams_status seams_cages_counts(const seams_cage_set *cages, int *n_hex, int *n_cubic, int *n_water, int *n_both)
Disjoint cage population counts.
SEAMS_API seams_status seams_system_set_ortho(seams_system *sys, const double *xyz, int n, double ox, double oy, double oz, double lx, double ly, double lz, const int *types, const int *ids)
Store points and an orthorhombic cell.
SEAMS_API seams_status seams_path_nframes(const char *path, size_t *nframes)
Number of frames in a trajectory path.
SEAMS_API seams_status seams_system_set_frame(seams_system *sys, const double *xyz, int n, const double *box9, const int *types, const int *ids)
Store points and a general LAMMPS cell, with an int count.
SEAMS_API seams_status seams_system_read(seams_system *sys, const char *path, int frame, int type_filter)
Read one frame from a trajectory file.
SEAMS_API int seams_system_count(const seams_system *sys)
Number of points in the frame, as an int.
SEAMS_API seams_system * seams_system_create(void)
Allocate an empty frame.
SEAMS_API void seams_system_destroy(seams_system *sys)
Free a frame.
SEAMS_API const char * seams_label_name(int label)
Name of a CHILL label.
SEAMS_API const char * seams_ring_symmetry_name(int symmetry)
Name of a ring-symmetry code.
SEAMS_API seams_status seams_set_num_threads(int n)
Set the OpenMP team used by later analysis calls.
SEAMS_API const char * seams_handle_error(const void *handle)
Detail string stored on a handle.
SEAMS_API int seams_abi(void)
ABI number compiled into this library.
SEAMS_API const char * seams_version_string(void)
Version text, for example "2.14.0".
SEAMS_API int seams_get_num_threads(void)
Team width the next analysis call will request.
SEAMS_API seams_status seams_rdf(seams_system *sys, double rmax, int bins, int type_i, int type_j, double *r, double *g, int *count, size_t cap, size_t *n_out, double *volume)
Partial radial distribution.
SEAMS_API seams_status seams_cages(seams_system *sys, double cutoff, int type, int graph, int k, int complete, seams_cage_set **out)
Hexagonal and double-diamond cages.
SEAMS_API seams_status seams_hbonds(seams_system *sys, double cutoff, int oxygen_type, int hydrogen_type, double dist_cutoff, double angle_cutoff, int *n_bonds)
Hydrogen-bond count on one frame.
SEAMS_API seams_status seams_density_axis(seams_system *sys, int type, int bins, int axis, double *z, double *rho, size_t cap, size_t *n_out)
Number density along one cell axis.
SEAMS_API seams_status seams_fingerprint_key(const seams_topo *fp, char *buf, size_t cap, size_t *n_out)
Frame key text.
SEAMS_API seams_status seams_site_table(seams_system *sys, const char *spec, int *kinds, size_t len)
Per-atom site kind from a site-table spec.
SEAMS_API seams_status seams_fingerprint(seams_system *sys, double cutoff, int type, int k, int graph, int hops, int color_types, seams_topo **out)
Topological fingerprint of the bonded graph.
SEAMS_API seams_status seams_contact_pairs(seams_system *sys, const char *site_spec, size_t *n_pairs, int *n_cation, int *n_anion)
Mutual nearest unlike contacts of a site table.
SEAMS_API void seams_fingerprint_destroy(seams_topo *fp)
Free a fingerprint.
SEAMS_API seams_status seams_neighbours_knn(seams_system *sys, int k, double cutoff, int type, int mutual, seams_neighbours **out)
k-nearest neighbour list.
SEAMS_API seams_status seams_fingerprint_atom(const seams_topo *fp, int index, char *buf, size_t cap, size_t *n_out)
Local key of one atom.
SEAMS_API seams_status seams_running_cn(seams_system *sys, double rmax, int bins, int type_i, int type_j, double *r, double *cn, size_t cap, size_t *n_out)
Running coordination number along the partial RDF.
SEAMS_API seams_status seams_prisms(seams_system *sys, double cutoff, int type, int *perfect, int *imperfect, size_t len)
Perfect and imperfect prism counts by ring size.
SEAMS_API seams_status seams_domains(seams_system *sys, double cutoff, const char *site_spec, int subset, int *n_subset, int *largest, double *percolation)
Largest domain of a polar or apolar site subset.
SEAMS_API seams_status seams_monolayer(seams_system *sys, double cutoff, int type, int max_depth, double sheet_area, int *counts, size_t counts_len)
Primitive-ring histogram of a monolayer.
SEAMS_API seams_status seams_coordination(seams_system *sys, double rmax, int bins, int type_i, int type_j, double *cn)
Coordination number integrated to rmax.
SEAMS_API seams_status seams_signature_cages(seams_system *sys, double cutoff, int type, int graph, const char *spec, size_t *n_cages, size_t *n_atoms)
Closed cages of one ring census.
SEAMS_API seams_status seams_fingerprint_rings(const seams_topo *fp, int *counts, size_t counts_len)
Primitive-ring census stored on the fingerprint.
SEAMS_API seams_status seams_steinhardt(seams_system *sys, double cutoff, int type, int order_l, double *ql, size_t ql_len, double *qlbar, size_t qlbar_len)
Local Steinhardt q_l on the cutoff shell, and the average on request.
SEAMS_API int seams_neighbours_count(const seams_neighbours *nb)
Number of neighbour rows, as an int.
SEAMS_API void seams_neighbours_destroy(seams_neighbours *nb)
Free a neighbour list.
SEAMS_API seams_status seams_neighbours_copy(const seams_neighbours *nb, int *offsets, size_t offsets_cap, size_t *n_offsets, int *cols, size_t cols_cap, size_t *nnz)
Copy the neighbour CSR into caller buffers.
SEAMS_API seams_status seams_neighbours_build(seams_system *sys, double cutoff, int type, int graph, seams_neighbours **out)
Build a cutoff or mutual neighbour list.
SEAMS_API seams_status seams_chill(seams_system *sys, double cutoff, int type, int graph, int rule, int *labels, size_t labels_len, int counts9[9])
Original CHILL labels, published or OVITO edges.
SEAMS_API seams_status seams_chill_plus(seams_system *sys, double cutoff, int type, int graph, int rule, int *labels, int counts9[9])
CHILL+ labels, without a buffer length.
SEAMS_API seams_status seams_q6bar(seams_system *sys, double cutoff, int type, double ice_cut, double *q6bar, size_t q6bar_len, double *mean, double *median, int *n_ice)
Lechner-Dellago q6-bar and the ice count above a cut.
SEAMS_API seams_status seams_ql(seams_system *sys, double cutoff, int type, int order_l, int graph, double *ql, size_t ql_len, double *qlbar, size_t qlbar_len)
Local Steinhardt q_l, and the Lechner-Dellago average on request.
SEAMS_API seams_status seams_q4q6(seams_system *sys, double cutoff, int type, double *q4, double *q6)
Local q4 and q6 on the cutoff shell, without buffer lengths.
SEAMS_API seams_status seams_rings_chordless(const seams_neighbours *nb, int size, int *rings, size_t rings_len, size_t *n_rings, int *per_atom, size_t per_atom_len)
Chordless cycles of one size.
SEAMS_API void seams_rings_destroy(seams_rings *rings)
Free a ring set.
SEAMS_API int seams_rings_count(const seams_rings *rings)
Number of primitive rings, as an int.
SEAMS_API seams_status seams_rings_find(seams_system *sys, double cutoff, int type, int graph, int max_depth, seams_rings **out)
Primitive rings (Franzblau) up to a maximum size.
SEAMS_API seams_status seams_rings_histogram(const seams_rings *rings, int *counts, int counts_len)
Count primitive rings by size, with an int length.
SEAMS_API seams_status seams_rings_vertices(const seams_rings *rings, int index, int *atoms, size_t cap, size_t *n_out)
Atom indices of one ring.
SEAMS_API seams_status seams_rings_fraction(const seams_rings *rings, int size, double *fraction)
Fraction of atoms that sit on a ring.
struct seams_brine seams_brine
One planar ice/brine front measurement.
Definition seams.h:249
struct seams_cage_set seams_cage_set
Hexagonal and double-diamond membership.
Definition seams.h:247
struct seams_topo seams_topo
Topological fingerprint of one bonded frame.
Definition seams.h:251
struct seams_rings seams_rings
One primitive-ring set.
Definition seams.h:245
struct seams_neighbours seams_neighbours
One neighbour list.
Definition seams.h:243
struct seams_system seams_system
One frame.
Definition seams.h:241
@ SEAMS_SITE_WATER_H
Water hydrogen.
Definition seams.h:236
@ SEAMS_SITE_WATER_O
Water oxygen.
Definition seams.h:235
@ SEAMS_SITE_CATION
Cation head.
Definition seams.h:228
@ SEAMS_SITE_DONOR_H
Hydrogen-bond donor hydrogen.
Definition seams.h:231
@ SEAMS_SITE_ACCEPTOR
Hydrogen-bond acceptor.
Definition seams.h:232
@ SEAMS_SITE_TAIL
Alkyl tail.
Definition seams.h:230
@ SEAMS_SITE_APOLAR
Other apolar site.
Definition seams.h:234
@ SEAMS_SITE_SOLVENT
Other solvent.
Definition seams.h:237
@ SEAMS_SITE_ANION
Anion.
Definition seams.h:229
@ SEAMS_SITE_UNSPECIFIED
Not named in the site table.
Definition seams.h:227
@ SEAMS_SITE_POLAR
Other polar site.
Definition seams.h:233
@ SEAMS_CAGE_CUBIC
Double-diamond cage only.
Definition seams.h:221
@ SEAMS_CAGE_HEX
Hexagonal cage only.
Definition seams.h:220
@ SEAMS_CAGE_WATER
In neither cage.
Definition seams.h:219
@ SEAMS_CAGE_BOTH
Both cages.
Definition seams.h:222
@ SEAMS_RING_HEXAGON
Six-ring outside any cage.
Definition seams.h:189
@ SEAMS_RING_UNCLASSIFIED
No topology assigned.
Definition seams.h:179
@ SEAMS_RING_HC_PRISMATIC
Prismatic face of a hexagonal cage.
Definition seams.h:182
@ SEAMS_RING_MIXED_PRISM
Face of a mixed prism.
Definition seams.h:187
@ SEAMS_RING_DEFORMED_PRISM
Face of a deformed prism.
Definition seams.h:186
@ SEAMS_RING_BOTH_PRISMATIC
Shared by both cage kinds, prismatic.
Definition seams.h:184
@ SEAMS_RING_PENTAGON
Five-ring outside any cage.
Definition seams.h:188
@ SEAMS_RING_BOTH_BASAL
Shared by both cage kinds, basal.
Definition seams.h:183
@ SEAMS_RING_PRISM
Face of a perfect prism.
Definition seams.h:185
@ SEAMS_RING_HC_BASAL
Basal face of a hexagonal cage.
Definition seams.h:181
@ SEAMS_RING_OTHER
Any other size outside any cage.
Definition seams.h:190
@ SEAMS_RING_DDC
Face of a double-diamond cage.
Definition seams.h:180
@ SEAMS_CHILL_OVITO
OVITO Chill+ modifier, every neighbour in the cutoff.
Definition seams.h:203
@ SEAMS_CHILL_PUBLISHED
Nguyen and Molinero, four closest neighbours.
Definition seams.h:202
@ SEAMS_ERR_RANGE
A number or a buffer length is outside the accepted range.
Definition seams.h:156
@ SEAMS_ERR_NOMEM
An allocation failed.
Definition seams.h:160
@ SEAMS_ERR_NULL
A required pointer is null.
Definition seams.h:155
@ SEAMS_ERR_STATE
The handle has no frame yet.
Definition seams.h:159
@ SEAMS_ERR_BOX
The cell is missing, non-finite, or has no volume.
Definition seams.h:157
@ SEAMS_ERR_INTERNAL
The library hit an internal failure.
Definition seams.h:161
@ SEAMS_ERR_ARG
A caller argument is the wrong shape, or a coordinate is not finite.
Definition seams.h:158
@ SEAMS_OK
The call succeeded.
Definition seams.h:154
@ SEAMS_LABEL_INTERCLATHRATE
Interfacial clathrate.
Definition seams.h:171
@ SEAMS_LABEL_UNCLASSIFIED
Not classified, or dropped by the species filter.
Definition seams.h:172
@ SEAMS_LABEL_INTERFACIAL
Interfacial ice.
Definition seams.h:169
@ SEAMS_LABEL_WATER
Liquid water.
Definition seams.h:168
@ SEAMS_LABEL_RECUBIC
Cubic after reclassification.
Definition seams.h:173
@ SEAMS_LABEL_CUBIC
Cubic ice (Ic).
Definition seams.h:166
@ SEAMS_LABEL_HEXAGONAL
Hexagonal ice (Ih).
Definition seams.h:167
@ SEAMS_LABEL_REHEX
Hexagonal after reclassification.
Definition seams.h:174
@ SEAMS_LABEL_CLATHRATE
Clathrate.
Definition seams.h:170
@ SEAMS_GRAPH_CUTOFF
Every neighbour inside the cutoff.
Definition seams.h:208
@ SEAMS_GRAPH_SEEDED
Mutual seeds with union completions, for cages only.
Definition seams.h:210
@ SEAMS_GRAPH_MUTUAL
Mutual four nearest inside cutoff + 1.5.
Definition seams.h:209
std::size_t nframes(std::string_view path)
Count frames in a trajectory path.
Definition seams.hpp:1399
CageLabel
Per-atom cage membership.
Definition seams.hpp:126
int abi()
ABI number compiled into this library.
Definition seams.hpp:1377
Status
Status codes.
Definition seams.hpp:48
ChillRule
CHILL+ threshold table.
Definition seams.hpp:80
Label
CHILL and CHILL+ atom label.
Definition seams.hpp:91
std::string version()
Library version text, for example 2.14.0.
Definition seams.hpp:1367
std::string_view label_name(Label label)
Short name of a CHILL+ label.
Definition seams.hpp:1412
SiteKind
Site-table kind.
Definition seams.hpp:137
std::string_view ring_symmetry_name(RingSymmetry symmetry)
Short name of a ring-symmetry code.
Definition seams.hpp:1423
RingSymmetry
Primitive-ring symmetry class.
Definition seams.hpp:107
DomainSubset
Domain subset.
Definition seams.hpp:165
Graph
Neighbour graph.
Definition seams.hpp:68
Axis
Cell axis.
Definition seams.hpp:155
void set_num_threads(int n)
Set the OpenMP width for the next call.
Definition seams.hpp:1384
int num_threads()
OpenMP width the next call will use.
Definition seams.hpp:1391
@ Both
Both cages.
Definition seams.hpp:130
@ Hex
Hexagonal cage only.
Definition seams.hpp:128
@ Argument
A caller argument is the wrong shape.
Definition seams.hpp:53
@ Cell
The cell is missing or has no volume.
Definition seams.hpp:52
@ State
The handle has no frame yet.
Definition seams.hpp:54
@ Memory
An allocation failed.
Definition seams.hpp:55
@ Range
A number is outside the accepted range.
Definition seams.hpp:51
@ Ok
The call succeeded.
Definition seams.hpp:49
@ Internal
The library hit an internal failure.
Definition seams.hpp:56
@ Null
A required pointer is null.
Definition seams.hpp:50
@ Published
Nguyen and Molinero, 2015.
Definition seams.hpp:81
@ Ovito
OVITO Chill+ modifier.
Definition seams.hpp:82
@ Water
Liquid water.
Definition seams.hpp:94
@ Hexagonal
Hexagonal ice.
Definition seams.hpp:93
@ Unclassified
No class matched.
Definition seams.hpp:98
@ Recubic
Reclassified cubic.
Definition seams.hpp:99
@ Interclathrate
Interfacial clathrate.
Definition seams.hpp:97
@ Interfacial
Interfacial ice.
Definition seams.hpp:95
@ Clathrate
Clathrate.
Definition seams.hpp:96
@ Rehex
Reclassified hexagonal.
Definition seams.hpp:100
@ Cubic
Cubic ice.
Definition seams.hpp:92
@ Solvent
Solvent atom.
Definition seams.hpp:148
@ WaterH
Water hydrogen.
Definition seams.hpp:147
@ Apolar
Apolar atom.
Definition seams.hpp:145
@ Unspecified
The table did not name this atom.
Definition seams.hpp:138
@ WaterO
Water oxygen.
Definition seams.hpp:146
@ Acceptor
Acceptor.
Definition seams.hpp:143
@ DonorH
Donor hydrogen.
Definition seams.hpp:142
@ Cation
Cation head.
Definition seams.hpp:139
@ Polar
Polar atom.
Definition seams.hpp:144
@ Anion
Anion.
Definition seams.hpp:140
@ Tail
Tail atom.
Definition seams.hpp:141
@ Pentagon
Five-membered ring.
Definition seams.hpp:117
@ Hexagon
Six-ring that is not a cage face.
Definition seams.hpp:118
@ HcPrismatic
Prismatic face of a hexagonal cage.
Definition seams.hpp:111
@ BothPrismatic
Prismatic face of both cage types.
Definition seams.hpp:113
@ Other
Neither a pentagon nor a hexagon face.
Definition seams.hpp:119
@ Prism
Prismatic six-ring.
Definition seams.hpp:114
@ DeformedPrism
Deformed prismatic six-ring.
Definition seams.hpp:115
@ HcBasal
Basal face of a hexagonal cage.
Definition seams.hpp:110
@ BothBasal
Basal face of both cage types.
Definition seams.hpp:112
@ Ddc
Double-diamond six-ring.
Definition seams.hpp:109
@ MixedPrism
Prism mixing the two cage types.
Definition seams.hpp:116
@ Apolar
Apolar site subset.
Definition seams.hpp:166
@ Mutual
Mutual four-nearest neighbours.
Definition seams.hpp:70
@ Seeded
Cage graph of seeds and completions.
Definition seams.hpp:71
@ Cutoff
Every pair inside the cutoff.
Definition seams.hpp:69
@ X
First cell edge.
Definition seams.hpp:156
@ Z
Third cell edge.
Definition seams.hpp:158
@ Y
Second cell edge.
Definition seams.hpp:157
void check(int status, const void *handle)
Definition seams.hpp:557
std::string copy_text(Call call, const void *handle)
Definition seams.hpp:597
Water-oxygen selection for a mixed frame.
d-SEAMS stable C API, ABI 1.
Knobs for a hydrogen-bond count.
Definition seams.hpp:483
double cutoff
Heavy-atom cutoff, Angstrom.
Definition seams.hpp:484
int hydrogen
Hydrogen species.
Definition seams.hpp:486
double angle
O-O-H angle, degrees.
Definition seams.hpp:488
int oxygen
Heavy-atom species.
Definition seams.hpp:485
double distance
Acceptor-H distance, Angstrom.
Definition seams.hpp:487
The two planar crossings of an ice slab.
Definition seams.hpp:332
bool found
Both crossings exist.
Definition seams.hpp:336
double exit
Crossing on leaving the ice, Angstrom.
Definition seams.hpp:334
double enter
Crossing on entering the ice, Angstrom.
Definition seams.hpp:333
double thickness
Ice run along the axis, Angstrom.
Definition seams.hpp:335
Knobs for a planar ice front.
Definition seams.hpp:548
int water_type
Species kept as water, or 0.
Definition seams.hpp:549
int bins
Bins along the axis.
Definition seams.hpp:551
int ion_type
Species kept as ions, or 0 for none.
Definition seams.hpp:550
Axis axis
Front axis.
Definition seams.hpp:552
Concentration profile along the brine axis.
Definition seams.hpp:354
std::vector< double > molality
mol/kg.
Definition seams.hpp:356
std::vector< double > ice_fraction
Dimensionless.
Definition seams.hpp:357
std::vector< double > coordinate
Bin centers, Angstrom.
Definition seams.hpp:355
Disjoint cage populations.
Definition seams.hpp:272
int cubic
Double-diamond cage only.
Definition seams.hpp:274
int water
Neither cage.
Definition seams.hpp:275
int both
Both cages.
Definition seams.hpp:276
int hexagonal
Hexagonal cage only.
Definition seams.hpp:273
Knobs for hexagonal and double-diamond cages.
Definition seams.hpp:449
int species
Species filter.
Definition seams.hpp:451
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:450
bool complete
Complete partial cages.
Definition seams.hpp:454
Graph graph
Cage graph.
Definition seams.hpp:452
int k
Neighbour count used to seed the graph.
Definition seams.hpp:453
Knobs for CHILL and CHILL+.
Definition seams.hpp:373
ChillRule rule
Threshold table.
Definition seams.hpp:377
Graph graph
Neighbour graph.
Definition seams.hpp:376
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:374
int species
Species filter.
Definition seams.hpp:375
Chordless cycles of one length.
Definition seams.hpp:616
std::size_t count() const
Number of cycles.
Definition seams.hpp:622
std::vector< int > per_atom
Cycles through each atom.
Definition seams.hpp:619
std::vector< int > cycle(std::size_t index) const
Atom indices of one cycle.
Definition seams.hpp:626
int size
Cycle length.
Definition seams.hpp:617
std::vector< int > atoms
count() rows of size indices.
Definition seams.hpp:618
CHILL or CHILL+ labels and the nine population counts.
Definition seams.hpp:212
std::vector< int > labels
One label code per atom.
Definition seams.hpp:213
std::array< int, 9 > counts
Population in label order.
Definition seams.hpp:214
Mutual nearest unlike contacts of a site table.
Definition seams.hpp:292
std::size_t pairs
Contact count.
Definition seams.hpp:293
int anions
Anion molecules in the ion cloud.
Definition seams.hpp:295
int cations
Cation molecules in the ion cloud.
Definition seams.hpp:294
Knobs for the axial number density.
Definition seams.hpp:495
int species
Species filter.
Definition seams.hpp:496
Axis axis
Cell axis.
Definition seams.hpp:498
int bins
Bin count.
Definition seams.hpp:497
Number density along one cell axis.
Definition seams.hpp:323
std::vector< double > density
Number density.
Definition seams.hpp:325
std::vector< double > coordinate
Bin centers, Angstrom.
Definition seams.hpp:324
Knobs for a partial RDF, its running coordination, or the integral.
Definition seams.hpp:472
double rmax
Outer limit, Angstrom.
Definition seams.hpp:473
int type_i
First species.
Definition seams.hpp:475
int type_j
Second species.
Definition seams.hpp:476
Partial radial distribution.
Definition seams.hpp:252
double volume
Cell volume, cubic Angstrom.
Definition seams.hpp:256
std::vector< double > radius
Bin centers, Angstrom.
Definition seams.hpp:253
std::vector< double > g
g(r), dimensionless.
Definition seams.hpp:254
std::vector< int > count
Pair count in each bin.
Definition seams.hpp:255
Knobs for a domain search.
Definition seams.hpp:518
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:519
std::string spec
Site-table text, for example 1=waterO.
Definition seams.hpp:520
DomainSubset subset
Which subset to measure.
Definition seams.hpp:521
Largest polar or apolar domain.
Definition seams.hpp:302
int subset
Atoms in the requested subset.
Definition seams.hpp:303
double percolation
Percolation measure, dimensionless.
Definition seams.hpp:305
int largest
Largest connected component.
Definition seams.hpp:304
Knobs for a topological fingerprint.
Definition seams.hpp:505
bool color_types
Color vertices by LAMMPS type.
Definition seams.hpp:511
int k
Neighbour count on the bonded graph.
Definition seams.hpp:508
int species
Species filter.
Definition seams.hpp:507
Graph graph
Neighbour graph.
Definition seams.hpp:509
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:506
int hops
Neighbourhood depth.
Definition seams.hpp:510
Knobs for a k-nearest neighbour list.
Definition seams.hpp:427
int k
Positive neighbour count.
Definition seams.hpp:428
double cutoff
Nominal cutoff, Angstrom.
Definition seams.hpp:429
int species
Species filter.
Definition seams.hpp:430
bool mutual
Keep only pairs that name each other.
Definition seams.hpp:431
Knobs for a neighbour list.
Definition seams.hpp:417
int species
Species filter.
Definition seams.hpp:419
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:418
Graph graph
Cutoff or mutual.
Definition seams.hpp:420
Knobs for q_l on a named graph.
Definition seams.hpp:395
bool average
Also return the neighbour mean.
Definition seams.hpp:400
int order
Degree.
Definition seams.hpp:398
Graph graph
Cutoff or mutual.
Definition seams.hpp:399
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:396
int species
Species filter.
Definition seams.hpp:397
Brine pockets trapped in the ice.
Definition seams.hpp:364
int pockets
Pocket count, excluding the reservoir.
Definition seams.hpp:365
int reservoir_waters
Waters in the liquid reservoir.
Definition seams.hpp:366
Perfect and imperfect prism counts by ring size.
Definition seams.hpp:314
std::array< int, 7 > imperfect
Imperfect stacks.
Definition seams.hpp:316
std::array< int, 7 > perfect
Perfect stacks.
Definition seams.hpp:315
Knobs for prism stacks.
Definition seams.hpp:528
int species
Species filter.
Definition seams.hpp:530
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:529
Local q4 and q6 on the cutoff shell.
Definition seams.hpp:232
std::vector< double > q4
One local q4 per atom.
Definition seams.hpp:233
std::vector< double > q6
One local q6 per atom.
Definition seams.hpp:234
Knobs for the q6-bar ice summary.
Definition seams.hpp:407
double ice_cut
Finite threshold.
Definition seams.hpp:410
int species
Species filter.
Definition seams.hpp:409
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:408
Lechner-Dellago q6-bar and the ice count above a cut.
Definition seams.hpp:241
std::vector< double > values
One q6-bar per atom.
Definition seams.hpp:242
double mean
Mean of the finite values.
Definition seams.hpp:243
double median
Median of the finite values.
Definition seams.hpp:244
int n_ice
Count strictly above the cut.
Definition seams.hpp:245
Molal rejection coefficient.
Definition seams.hpp:343
bool defined
The ratio is defined.
Definition seams.hpp:347
double ice
Bulk ice molality, mol/kg.
Definition seams.hpp:344
double k
Ratio of the two molalities.
Definition seams.hpp:346
double liquid
Bulk liquid molality, mol/kg.
Definition seams.hpp:345
Knobs for primitive rings.
Definition seams.hpp:438
int species
Species filter.
Definition seams.hpp:440
int max_size
Largest ring size, from 3 through 12.
Definition seams.hpp:442
Graph graph
Cutoff or mutual.
Definition seams.hpp:441
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:439
Running coordination number along a partial RDF.
Definition seams.hpp:263
std::vector< double > coordination
Running coordination, dimensionless.
Definition seams.hpp:265
std::vector< double > radius
Bin centers, Angstrom.
Definition seams.hpp:264
Knobs for a monolayer ring histogram.
Definition seams.hpp:537
int species
Species filter.
Definition seams.hpp:539
int max_size
Largest ring size.
Definition seams.hpp:540
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:538
double sheet_area
Sheet area, square Angstrom.
Definition seams.hpp:541
Closed cages whose ring census matches a signature.
Definition seams.hpp:283
std::size_t atoms
Distinct atoms in those cages.
Definition seams.hpp:285
std::size_t cages
Number of closed cages.
Definition seams.hpp:284
Knobs for a signature cage census.
Definition seams.hpp:461
int species
Species filter.
Definition seams.hpp:463
Graph graph
Neighbour graph.
Definition seams.hpp:464
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:462
std::string spec
Ring census text, for example 512.
Definition seams.hpp:465
Knobs for a local Steinhardt parameter on the cutoff shell.
Definition seams.hpp:384
bool average
Also return the Lechner-Dellago mean.
Definition seams.hpp:388
int species
Species filter.
Definition seams.hpp:386
double cutoff
Positive cutoff, Angstrom.
Definition seams.hpp:385
Local Steinhardt parameter, and the average when it was asked for.
Definition seams.hpp:223
std::vector< double > average
Neighbour mean of q_lm.
Definition seams.hpp:225
std::vector< double > local
One local q_l per atom.
Definition seams.hpp:224