votca 2026-dev
Loading...
Searching...
No Matches
latticemodel.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2026 The VOTCA Development Team
3 * (http://www.votca.org)
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License")
6 *
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20#pragma once
21#ifndef VOTCA_XTP_LATTICEMODEL_H
22#define VOTCA_XTP_LATTICEMODEL_H
23
24// Standard includes
25#include <array>
26#include <cstdint>
27#include <random>
28#include <vector>
29
30// Local VOTCA includes
31#include "eigen.h"
32#include "qmstate.h"
33#include "topology.h"
34
35namespace votca {
36namespace xtp {
37
56 public:
58
59 struct Options {
60 std::array<Index, 3> dims = {8, 8, 8};
61 double spacing = 1.0; // a
62 double cutoff = 1.5; // pairs with |r| < cutoff
63 double J2 = 0.0; // |J|^2 at |r| = a
64 double decay_length = 1.0; // of |J|^2
65 double reorganization = 0.0;
66 double mean_energy = 0.0;
67 double sigma = 0.0;
69 double eta_a = 0.2; // weight of the uncorrelated part
70 double eta_b = 0.4; // weight of the short-range moving average
71 Index l_b = 9; // number of neighbours in the short-range average
72 Index l_c = 280; // number of neighbours in the long-range average
76 bool include_self = true;
77 std::uint64_t seed = 1;
78 std::vector<QMStateType> states = {QMStateType::Electron,
80 std::string segment_name = "site";
81 };
82
83 explicit LatticeModel(const Options& opt);
84
86 void BuildTopology(Topology& top) const;
87
89 const std::vector<double>& SiteEnergies() const { return energies_; }
90
92 const std::vector<Eigen::Vector3d>& Positions() const { return positions_; }
93
94 Index NumberOfSites() const { return Index(positions_.size()); }
95
96 static Disorder DisorderFromString(const std::string& name);
97
102 public:
103 explicit NormalGenerator(std::uint64_t seed) : engine_(seed) {}
104 double operator()();
105
106 private:
107 double Uniform(); // in (0,1]
108 std::mt19937_64 engine_;
109 bool has_spare_ = false;
110 double spare_ = 0.0;
111 };
112
113 private:
115 Eigen::Matrix3d box_;
116 std::vector<Eigen::Vector3d> positions_;
117 std::vector<double> energies_;
118
119 Eigen::Vector3d ShortestConnection(const Eigen::Vector3d& r1,
120 const Eigen::Vector3d& r2) const;
121 void GenerateEnergies();
123 std::vector<std::vector<Index>> NearestNeighbours(Index l) const;
128 std::vector<std::pair<double, std::array<Index, 3>>> Offsets(
129 double radius) const;
131 Index SiteIndex(Index ix, Index iy, Index iz) const;
132};
133
134} // namespace xtp
135} // namespace votca
136
137#endif // VOTCA_XTP_LATTICEMODEL_H
std::vector< double > energies_
Eigen::Vector3d ShortestConnection(const Eigen::Vector3d &r1, const Eigen::Vector3d &r2) const
std::vector< std::vector< Index > > NearestNeighbours(Index l) const
indices of the l nearest other sites of every site, ties broken by index
Index NumberOfSites() const
static Disorder DisorderFromString(const std::string &name)
const std::vector< Eigen::Vector3d > & Positions() const
Positions in segment order.
Index SiteIndex(Index ix, Index iy, Index iz) const
site index of lattice coordinates (taken modulo the dimensions)
void BuildTopology(Topology &top) const
Fill an empty topology with segments, box and neighbour list.
LatticeModel(const Options &opt)
std::vector< Eigen::Vector3d > positions_
const std::vector< double > & SiteEnergies() const
Site energies in segment order.
std::vector< std::pair< double, std::array< Index, 3 > > > Offsets(double radius) const
Container for segments and box and atoms.
Definition topology.h:41
Provides a means for comparing floating point numbers.
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26
std::array< Index, 3 > dims
std::vector< QMStateType > states