23 #ifndef COM_DAFER45_TBTK_PROPERTY_EXTRACTOR_PROPERTY_EXTRACTOR
24 #define COM_DAFER45_TBTK_PROPERTY_EXTRACTOR_PROPERTY_EXTRACTOR
28 #include "TBTK/Property/AbstractProperty.h"
40 namespace PropertyExtractor{
100 int lowerFermionicMatsubaraEnergyIndex,
101 int upperFermionicMatsubaraEnergyIndex,
102 int lowerBosonicMatsubaraEnergyIndex,
103 int upperBosonicMatsubaraEnergyIndex
157 std::vector<Index> patterns
213 std::vector<Index> patterns
258 std::vector<Index> patterns
323 std::vector<Index> patterns
364 unsigned int numSamples,
365 const std::vector<Index> &patterns = {},
366 unsigned int seed = time(
nullptr)
448 double getEnergyInfinitesimal()
const;
493 template<
typename DataType>
506 int offsetMultiplier,
524 template<
typename DataType>
560 const Index &pattern,
586 std::vector<Index> patterns,
588 bool keepSummationWildcards,
589 bool keepSpinWildcards
596 static constexpr
int ENERGY_RESOLUTION = 1000;
600 int energyResolution;
603 static constexpr
double LOWER_BOUND = -1.;
610 static constexpr
double UPPER_BOUND = 1.;
617 static constexpr
int LOWER_FERMIONIC_MATSUBARA_ENERGY_INDEX = -1;
621 int lowerFermionicMatsubaraEnergyIndex;
624 static constexpr
int UPPER_FERMIONIC_MATSUBARA_ENERGY_INDEX = 1;
628 int upperFermionicMatsubaraEnergyIndex;
631 static constexpr
int LOWER_BOSONIC_MATSUBARA_ENERGY_INDEX = 0;
635 int lowerBosonicMatsubaraEnergyIndex;
638 static constexpr
int UPPER_BOSONIC_MATSUBARA_ENERGY_INDEX = 0;
642 int upperBosonicMatsubaraEnergyIndex;
645 static constexpr
double ENERGY_INFINITESIMAL = 1e-3;
649 double energyInfinitesimal;
659 inline int PropertyExtractor::getEnergyResolution()
const{
661 energyType == EnergyType::Real,
662 "PropertyExtractor::PropertyExtractor::getEnergyResolution()",
663 "The energy resolution cannot be accessed when the energy type"
665 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
666 <<
" with three arguments if real energies are wanted for the"
667 <<
" PropertyExtractor."
670 return energyResolution;
673 inline double PropertyExtractor::getLowerBound()
const{
675 energyType == EnergyType::Real,
676 "PropertyExtractor::PropertyExtractor::getLowerBound()",
677 "The lower bound cannot be accessed when the energy type is"
679 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
680 <<
" with three arguments if real energies are wanted for the"
681 <<
" PropertyExtractor."
687 inline double PropertyExtractor::getUpperBound()
const{
689 energyType == EnergyType::Real,
690 "PropertyExtractor::PropertyExtractor::getUpperBound()",
691 "The upper bound cannot be accessed when the energy type is"
693 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
694 <<
" with three arguments if real energies are wanted for the"
695 <<
" PropertyExtractor."
701 inline int PropertyExtractor::getLowerFermionicMatsubaraEnergyIndex()
const{
703 energyType == EnergyType::Matsubara,
704 "PropertyExtractor::PropertyExtractor::getLowerFermionicMatsubaraEnergyIndex()",
705 "The lower Fermionic Matsubara energy index cannot be accessed"
706 <<
" when the energy type is real.",
707 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
708 <<
" with four arguments if Matsubara energies are wanted for"
709 <<
" the PropertyExtractor."
712 return lowerFermionicMatsubaraEnergyIndex;
715 inline int PropertyExtractor::getUpperFermionicMatsubaraEnergyIndex()
const{
717 energyType == EnergyType::Matsubara,
718 "PropertyExtractor::PropertyExtractor::getUpperFermionicMatsubaraEnergyIndex()",
719 "The upper Fermionic Matsubara energy index cannot be accessed"
720 <<
" when the energy type is real.",
721 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
722 <<
" with four arguments if Matsubara energies are wanted for"
723 <<
" the PropertyExtractor."
726 return upperFermionicMatsubaraEnergyIndex;
729 inline int PropertyExtractor::getLowerBosonicMatsubaraEnergyIndex()
const{
731 energyType == EnergyType::Matsubara,
732 "PropertyExtractor::PropertyExtractor::getLowerBosonicMatsubaraEnergyIndex()",
733 "The lower Bosonic Matsubara energy index cannot be accessed"
734 <<
" when the energy type is real.",
735 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
736 <<
" with four arguments if Matsubara energies are wanted for"
737 <<
" the PropertyExtractor."
740 return lowerBosonicMatsubaraEnergyIndex;
743 inline int PropertyExtractor::getUpperBosonicMatsubaraEnergyIndex()
const{
745 energyType == EnergyType::Matsubara,
746 "PropertyExtractor::PropertyExtractor::getUpperBosonicMatsubaraEnergyIndex()",
747 "The upper Bosonic Matsubara energy index cannot be accessed"
748 <<
" when the energy type is real.",
749 "Use PropertyExtractor::PropertyExtractor::setEnergyWindow()"
750 <<
" with four arguments if Matsubara energies are wanted for"
751 <<
" the PropertyExtractor."
754 return upperBosonicMatsubaraEnergyIndex;
757 inline double PropertyExtractor::getEnergyInfinitesimal()
const{
758 return energyInfinitesimal;
761 template<
typename DataType>
762 void PropertyExtractor::calculate(
774 int offsetMultiplier,
778 int currentSubindex = pattern.
getSize()-1;
779 for(; currentSubindex >= 0; currentSubindex--){
780 if(pattern.
at(currentSubindex) < 0)
784 if(currentSubindex == -1){
786 callback(
this, property, pattern, currentOffset, information);
793 "PropertyExtractor::calculate()",
794 "Invalid specifier found at subindex "
795 << currentSubindex <<
".",
796 "Did you mean IDX_SUM_ALL, IDX_X, IDX_Y, or IDX_Z?"
800 int nextOffsetMultiplier = offsetMultiplier;
802 nextOffsetMultiplier *= ranges.
at(currentSubindex);
806 bool isSumIndex =
false;
813 for(
int n = 0; n < ranges.
at(currentSubindex); n++){
814 pattern.
at(currentSubindex) = n;
821 nextOffsetMultiplier,
825 currentOffset += offsetMultiplier;
830 template<
typename DataType>
831 void PropertyExtractor::calculate(
846 iterator != allIndices.
end();
849 const Index &index = *iterator;
850 std::vector<unsigned int> spinIndices
854 IndexTree::SearchMode::MatchWildcards
856 if(spinIndices.size() != 0){
858 spinIndices.size() == 1,
859 "PropertyExtractor::calculate()",
860 "Several spin indeces found.",
861 "Use IDX_SPIN at most once per pattern to"
862 <<
" indicate spin index."
877 inline void PropertyExtractor::Information::setSpinIndex(
int spinIndex){
878 this->spinIndex = spinIndex;
885 inline const Solver::Solver& PropertyExtractor::getSolver()
const{
887 "PropertyExtractor::getSolver()",
888 "Missing implementation of PropertyExtractor::getSolver() in"