-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'unstable' of github.com:TRIQS/ctseg_J into unstable
- Loading branch information
Showing
15 changed files
with
181 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[![build](https://github.com/TRIQS/cthyb/workflows/build/badge.svg)](https://github.com/TRIQS/cthyb/actions?query=workflow%3Abuild) | ||
|
||
## TRIQS segment picture impurity solver with spin-spin interactions (CTSEG-J) | ||
|
||
Copyright (C) 2024, N. Kavokine, H. Lu and O. Parcollet \ | ||
|
||
### Documentation | ||
|
||
For documentation and installation instructions see [triqs.github.io/ctseg-j](https://triqs.github.io/ctseg-j). | ||
|
||
### License | ||
|
||
This application is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by the Free | ||
Software Foundation, either version 3 of the License, or (at your option) any | ||
later version (see http://www.gnu.org/licenses/). | ||
|
||
It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
PARTICULAR PURPOSE. See the GNU General Public License for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "./state_hist.hpp" | ||
#include "../logs.hpp" | ||
|
||
namespace measures { | ||
|
||
state_hist::state_hist(params_t const &p, work_data_t const &wdata, configuration_t const &config, results_t &results) | ||
: wdata{wdata}, config{config}, results{results} { | ||
|
||
beta = p.beta; | ||
H = nda::zeros<double>(ipow(2, config.n_color())); | ||
} | ||
|
||
// ------------------------------------- | ||
|
||
void state_hist::accumulate(double s) { | ||
|
||
LOG("\n =================== MEASURE <state histogram> ================ \n"); | ||
|
||
/// Measure the state histogram | ||
/** | ||
*Measures the time the impurity spends in a certain atomic state: | ||
* an atomic state is characterized by occupation number for each color, e.g. | ||
* $|n_1 n_2 n_3 n_4\rangle = |0 1 1 0\rangle$ for a model with 4 colors | ||
* | ||
* - the index of a state in the histogram is given by $\sum_i n_i 2^i$ | ||
* | ||
* - the length of the histogram is 2^n_colors | ||
*/ | ||
|
||
Z += s; | ||
|
||
double tau_prev = beta; // time of prevous operator; start with beta | ||
nda::vector<bool> state = nda::zeros<bool>(config.n_color()); | ||
for (auto const &op : colored_ordered_ops(config.seglists)) { | ||
int state_idx = 0; | ||
for (auto c : range(config.n_color())) | ||
if (state(c)) state_idx += ipow(2, c); // get the index of the impurity state | ||
H(state_idx) += (tau_prev - op.tau); | ||
tau_prev = (double)op.tau; | ||
ALWAYS_EXPECTS((state(op.color) == op.is_cdag), "Operator error at color {}", op.color); | ||
state(op.color) = !op.is_cdag; | ||
} | ||
|
||
// get edge state contribution; tau_prev has time of last operator | ||
ALWAYS_EXPECTS((state == nda::zeros<bool>(config.n_color())), "Operator error"); | ||
H(0) += tau_prev; | ||
} | ||
// ------------------------------------- | ||
|
||
void state_hist::collect_results(mpi::communicator const &c) { | ||
|
||
Z = mpi::all_reduce(Z, c); | ||
H = mpi::all_reduce(H, c); | ||
H = H / (Z * beta); | ||
|
||
// store the result (not reused later, hence we can move it). | ||
results.state_hist = std::move(H); | ||
} | ||
} // namespace measures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include "../configuration.hpp" | ||
#include "../work_data.hpp" | ||
#include "../results.hpp" | ||
#include "../util.hpp" | ||
|
||
namespace measures { | ||
|
||
struct state_hist { | ||
|
||
work_data_t const &wdata; | ||
configuration_t const &config; | ||
results_t &results; | ||
double beta; | ||
|
||
nda::vector<double> H; | ||
|
||
double Z = 0; | ||
|
||
state_hist(params_t const ¶ms, work_data_t const &wdata, configuration_t const &config, results_t &results); | ||
|
||
void accumulate(double s); | ||
void collect_results(mpi::communicator const &c); | ||
}; | ||
} // namespace measures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters