eOn 3.2.0
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
RateRingSeed.h
Go to the documentation of this file.
1
/*
2
** This file is part of eOn.
3
** SPDX-License-Identifier: BSD-3-Clause
4
** Copyright (c) 2010--present, eOn Development Team
5
*/
6
#pragma once
7
8
#include "
eon/ConFileIO.h
"
9
#include "
eon/Matter.h
"
10
11
#include <cmath>
12
#include <stdexcept>
13
#include <string>
14
#include <vector>
15
16
namespace
eonc::tunneling
{
17
20
inline
std::vector<AtomMatrix>
readRateRingSeed
(
const
std::string &filename,
21
const
Matter
&reference,
22
long
beads) {
23
const
auto
frames = readcon::read_all_frames(filename);
24
if
(beads < 4 || frames.size() !=
static_cast<
size_t
>
(beads)) {
25
throw
std::invalid_argument(
26
"instanton: initial_ring must contain exactly beads frames, without "
27
"a repeated closing frame"
);
28
}
29
std::vector<AtomMatrix> positions;
30
positions.reserve(frames.size());
31
for
(
const
auto
&frame : frames) {
32
Matter
image(reference);
33
if
(!
io::io_ok
(
io::con2matter
(image, frame))) {
34
throw
std::runtime_error(
"instanton: cannot read ring seed "
+ filename);
35
}
36
auto
mismatch = [&]() {
37
throw
std::invalid_argument(
38
"instanton: ring seed differs in ordered species, IDs, masses, "
39
"cell, constraints or frozen coordinates"
);
40
};
41
if
(image.
numberOfAtoms
() != reference.
numberOfAtoms
() ||
42
image.
getPeriodic
() != reference.
getPeriodic
() ||
43
!image.
getCell
().allFinite() || !reference.
getCell
().allFinite() ||
44
(image.
getCell
() - reference.
getCell
()).cwiseAbs().maxCoeff() > 1e-8) {
45
mismatch();
46
}
47
const
AtomMatrix
delta =
48
reference.
pbc
(image.
getPositions
() - reference.
getPositions
());
49
if
(!delta.allFinite()) {
50
mismatch();
51
}
52
for
(
long
atom = 0; atom < reference.
numberOfAtoms
(); ++atom) {
53
if
(image.
getAtomicNr
(atom) != reference.
getAtomicNr
(atom) ||
54
image.
getAtomIndex
(atom) != reference.
getAtomIndex
(atom) ||
55
image.
getFixedMask
(atom) != reference.
getFixedMask
(atom) ||
56
image.
getMass
(atom) != reference.
getMass
(atom) ||
57
!std::isfinite(image.
getMass
(atom)) || !(image.
getMass
(atom) > 0.) ||
58
(reference.
getFixed
(atom) &&
59
delta.row(atom).cwiseAbs().maxCoeff() > 1e-8)) {
60
mismatch();
61
}
62
}
63
positions.push_back(image.
getPositions
());
64
}
65
return
positions;
66
}
67
68
}
// namespace eonc::tunneling
ConFileIO.h
AtomMatrix
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition
Eigen.h:37
Matter.h
eonc::Matter
Definition
Matter.h:94
eonc::Matter::getPositions
const AtomMatrix & getPositions() const
Definition
Matter.cpp:378
eonc::Matter::getPeriodic
bool getPeriodic() const noexcept
Definition
Matter.h:338
eonc::Matter::getCell
Matrix3d getCell() const
Definition
Matter.cpp:345
eonc::Matter::numberOfAtoms
long int numberOfAtoms() const
Definition
Matter.cpp:343
eonc::Matter::pbc
AtomMatrix pbc(const AtomMatrix &diff) const
Definition
Matter.cpp:943
eonc::Matter::getMass
double getMass(long int atom) const
Definition
Matter.cpp:548
eonc::Matter::getAtomicNr
long getAtomicNr(long int atom) const
Definition
Matter.cpp:565
eonc::Matter::getFixedMask
std::array< bool, 3 > getFixedMask(long int atom) const
Per-axis CON column-4 mask (bit0=x, bit1=y, bit2=z).
Definition
Matter.cpp:590
eonc::Matter::getAtomIndex
std::int64_t getAtomIndex(long int atom) const
.con column-5 index (pre-grouping); public for I/O / bindings.
Definition
Matter.cpp:959
eonc::Matter::getFixed
int getFixed(long int atom) const
1 if every Cartesian axis of the atom is fixed, else 0.
Definition
Matter.cpp:575
eonc::io::con2matter
IoStatus con2matter(Matter &m, std::string filename)
Definition
ConFileIO.cpp:603
eonc::io::io_ok
constexpr bool io_ok(IoStatus s) noexcept
Definition
ConFileIO.h:38
eonc::tunneling
Definition
Tunneling.cpp:41
eonc::tunneling::readRateRingSeed
std::vector< AtomMatrix > readRateRingSeed(const std::string &filename, const Matter &reference, long beads)
Read closed-ring geometry on the reference's ordered physical coordinates.
Definition
RateRingSeed.h:20
include
eon
RateRingSeed.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf