Loading...
Searching...
No Matches
KernelGeometryIdentity.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4#ifndef GPR_ML_GP_KERNELGEOMETRYIDENTITY_H_
5#define GPR_ML_GP_KERNELGEOMETRYIDENTITY_H_
6
7#include <algorithm>
8
10
11namespace gpr::detail {
12
16inline bool sameSexpatGeometry(const AtomsConfiguration& left,
17 const AtomsConfiguration& right,
18 double left_far_radius = 0.0,
19 double right_far_radius = 0.0)
20{
21 const auto same_matrix = [](const auto& a, const auto& b) {
22 return a.rows() == b.rows() && a.cols() == b.cols() &&
23 (a.size() == 0 ||
24 std::equal(a.data(), a.data() + a.size(), b.data()));
25 };
26 return left_far_radius == right_far_radius &&
27 (left_far_radius == 0.0 ||
28 same_matrix(left.atoms_mov.positions, right.atoms_mov.positions)) &&
29 left.n_pt == right.n_pt && left.pair_cutoff == right.pair_cutoff &&
30 left.pair_cutoff_width == right.pair_cutoff_width &&
31 std::equal(std::begin(left.cell), std::end(left.cell),
32 std::begin(right.cell)) &&
33 same_matrix(left.atoms_mov.type, right.atoms_mov.type) &&
34 same_matrix(left.atoms_froz_active.type,
35 right.atoms_froz_active.type) &&
36 same_matrix(left.atoms_froz_active.positions,
37 right.atoms_froz_active.positions) &&
38 same_matrix(left.pairtype, right.pairtype);
39}
40
41} // namespace gpr::detail
42
43#endif