Reorganization of headers (I): rename JSC -> ABACUS
All files need to be changed to refer to new headers. First step of the reorganization.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -13,21 +13,21 @@ Purpose: calculate matrix elements of density operator between
|
||||
For collaboration with Robert Konik.
|
||||
|
||||
***********************************************************/
|
||||
#include "JSC.h"
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
|
||||
void Build_DME_Matrix_Block_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
|
||||
void Build_DME_Matrix_Block_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
|
||||
int weighing_option, int nrglabel_left_begin, int nrglabel_left_end, int nrglabel_right_begin, int nrglabel_right_end,
|
||||
int block_option, DP* DME_block_1, DP* DME_block_2, Vect_DP Kweight)
|
||||
{
|
||||
// Given a list of states produced by Select_States_for_NRG, this function
|
||||
// computes all the density form factors < lstate| \rho | rstate >
|
||||
// for all id_left_begin <= id_left <= id_left_end (similarly for right states).
|
||||
// for all id_left_begin <= id_left <= id_left_end (similarly for right states).
|
||||
|
||||
// The block_option flag determines what kind of data is written in the 2 DME blocks.
|
||||
// If !symmetric_states, then only block 1 is filled.
|
||||
@@ -39,46 +39,46 @@ namespace JSC {
|
||||
// We assume the DME_blocks are already reserved in memory.
|
||||
// If !symmetric states, DME_block_2 doesn't need to be allocated.
|
||||
|
||||
if (nrglabel_left_begin < 0 || nrglabel_right_begin < 0) JSCerror("beginning nrglabels negative in Build_DME_Matrix_Block_for_NRG");
|
||||
if (nrglabel_left_end >= Nstates_required) JSCerror("nrglabel_left_end too large in Build_DME_Matric_Block_for_NRG");
|
||||
if (nrglabel_right_end >= Nstates_required) JSCerror("nrglabel_right_end too large in Build_DME_Matric_Block_for_NRG");
|
||||
if (nrglabel_left_begin < 0 || nrglabel_right_begin < 0) ABACUSerror("beginning nrglabels negative in Build_DME_Matrix_Block_for_NRG");
|
||||
if (nrglabel_left_end >= Nstates_required) ABACUSerror("nrglabel_left_end too large in Build_DME_Matric_Block_for_NRG");
|
||||
if (nrglabel_right_end >= Nstates_required) ABACUSerror("nrglabel_right_end too large in Build_DME_Matric_Block_for_NRG");
|
||||
|
||||
if (nrglabel_left_begin > nrglabel_left_end) JSCerror("nrglabels of left states improperly chosen in DME block builder.");
|
||||
if (nrglabel_right_begin > nrglabel_right_end) JSCerror("nrglabels of right states improperly chosen in DME block builder.");
|
||||
if (nrglabel_left_begin > nrglabel_left_end) ABACUSerror("nrglabels of left states improperly chosen in DME block builder.");
|
||||
if (nrglabel_right_begin > nrglabel_right_end) ABACUSerror("nrglabels of right states improperly chosen in DME block builder.");
|
||||
// DME_block is a pointer of size row_l * col_l, where
|
||||
int block_row_length = nrglabel_right_end - nrglabel_right_begin + 1;
|
||||
int block_col_length = nrglabel_left_end - nrglabel_left_begin + 1;
|
||||
int block_col_length = nrglabel_left_end - nrglabel_left_begin + 1;
|
||||
|
||||
// iKmod is an integer specifying that we're only interested in momenta multiples of
|
||||
// a base unit. In other words, if the perturbation potential repeats itself iKmod times
|
||||
// on the periodic cycle on which the theory is defined, then we only need states such
|
||||
// that iKl - iKr = (integer) * iKmod. We impose this constraint at the same time as
|
||||
// that iKl - iKr = (integer) * iKmod. We impose this constraint at the same time as
|
||||
// the check on the weight of the state.
|
||||
|
||||
// We start by reading off the list of selected states:
|
||||
|
||||
stringstream NRG_stringstream;
|
||||
string NRG_string;
|
||||
|
||||
|
||||
NRG_stringstream << "States_";
|
||||
NRG_stringstream << "c_" << c_int << "_L_" << L << "_N_" << N
|
||||
<< "_iKmin_" << iKmin << "_iKmax_" << iKmax << "_Nstates_" << Nstates_required
|
||||
<< "_Sym_" << symmetric_states << "_iKmod_" << iKmod << "_wopt_" << weighing_option << ".nrg";
|
||||
NRG_stringstream << "c_" << c_int << "_L_" << L << "_N_" << N
|
||||
<< "_iKmin_" << iKmin << "_iKmax_" << iKmax << "_Nstates_" << Nstates_required
|
||||
<< "_Sym_" << symmetric_states << "_iKmod_" << iKmod << "_wopt_" << weighing_option << ".nrg";
|
||||
|
||||
NRG_string = NRG_stringstream.str();
|
||||
const char* NRG_Cstr = NRG_string.c_str();
|
||||
|
||||
ifstream infile;
|
||||
infile.open(NRG_Cstr);
|
||||
|
||||
|
||||
if (infile.fail()) {
|
||||
cout << NRG_Cstr << endl;
|
||||
JSCerror("The input file was not opened successfully in Build_DME_Matrix_between_Selected_States_for_NRG. ");
|
||||
ABACUSerror("The input file was not opened successfully in Build_DME_Matrix_between_Selected_States_for_NRG. ");
|
||||
}
|
||||
|
||||
// Read the whole data file:
|
||||
//const int MAXDATA = 5000000;
|
||||
const int MAXDATA = JSC::max(nrglabel_left_end, nrglabel_right_end) + 10; // 10 for safety...
|
||||
const int MAXDATA = ABACUS::max(nrglabel_left_end, nrglabel_right_end) + 10; // 10 for safety...
|
||||
|
||||
int* nrglabel = new int[MAXDATA];
|
||||
DP* omega = new DP[MAXDATA];
|
||||
@@ -91,7 +91,7 @@ namespace JSC {
|
||||
while (((infile.peek()) != EOF) && (Ndata < MAXDATA)) {
|
||||
|
||||
infile >> nrglabel[Ndata];
|
||||
if (nrglabel[Ndata] != Ndata) JSCerror("reading states nrglabels wrong in NRG_DME_Matrix_Block_builder");
|
||||
if (nrglabel[Ndata] != Ndata) ABACUSerror("reading states nrglabels wrong in NRG_DME_Matrix_Block_builder");
|
||||
infile >> omega[Ndata];
|
||||
infile >> iK[Ndata];
|
||||
infile >> label[Ndata];
|
||||
@@ -113,31 +113,31 @@ namespace JSC {
|
||||
|
||||
// State list containing all the types of states
|
||||
Scan_State_List<LiebLin_Bethe_State> List_of_Basic_States ('Z', Scanstate);
|
||||
|
||||
|
||||
for (int nrglabel_left = nrglabel_left_begin; nrglabel_left <= nrglabel_left_end; ++nrglabel_left) {
|
||||
|
||||
|
||||
Scanstate = List_of_Basic_States.Return_State (Extract_Base_Label(label[nrglabel_left]));
|
||||
Scanstate.Set_to_Label (label[nrglabel_left]);
|
||||
|
||||
|
||||
Scanstate.Compute_All(true);
|
||||
|
||||
|
||||
Kept_States_left[nrglabel_left - nrglabel_left_begin] = Scanstate;
|
||||
|
||||
|
||||
if (!Scanstate.conv) cout << "State of label " << label[nrglabel_left] << " did not converge after " << Scanstate.iter_Newton
|
||||
<< " Newton step; diffsq = " << Scanstate.diffsq << endl;
|
||||
<< " Newton step; diffsq = " << Scanstate.diffsq << endl;
|
||||
} // for nrglabel_left
|
||||
|
||||
|
||||
for (int nrglabel_right = nrglabel_right_begin; nrglabel_right <= nrglabel_right_end; ++nrglabel_right) {
|
||||
|
||||
|
||||
Scanstate = List_of_Basic_States.Return_State (Extract_Base_Label(label[nrglabel_right]));
|
||||
Scanstate.Set_to_Label (label[nrglabel_right]);
|
||||
|
||||
|
||||
Scanstate.Compute_All(true);
|
||||
|
||||
|
||||
Kept_States_right[nrglabel_right - nrglabel_right_begin] = Scanstate;
|
||||
|
||||
|
||||
if (!Scanstate.conv) cout << "State of label " << label[nrglabel_right] << " did not converge after " << Scanstate.iter_Newton
|
||||
<< " Newton step; diffsq = " << Scanstate.diffsq << endl;
|
||||
<< " Newton step; diffsq = " << Scanstate.diffsq << endl;
|
||||
} // for nrglabel_left
|
||||
|
||||
|
||||
@@ -145,28 +145,28 @@ namespace JSC {
|
||||
|
||||
for (int ll = 0; ll < block_col_length; ++ll) {
|
||||
for (int lr = 0; lr < block_row_length; ++lr) {
|
||||
|
||||
if (Kept_States_left[ll].conv && Kept_States_right[lr].conv
|
||||
//&& abs(Kept_States[il].iK - Kept_States[ir].iK) % iKmod == 0)
|
||||
|
||||
if (Kept_States_left[ll].conv && Kept_States_right[lr].conv
|
||||
//&& abs(Kept_States[il].iK - Kept_States[ir].iK) % iKmod == 0)
|
||||
&& abs(Kept_States_left[ll].iK) % iKmod == 0
|
||||
&& abs(Kept_States_right[lr].iK) % iKmod == 0) {
|
||||
|
||||
|
||||
if (!symmetric_states) {
|
||||
DME_block_1[ll* block_row_length + lr] = // By convention, put the lowest energy state to the left
|
||||
DME_block_1[ll* block_row_length + lr] = // By convention, put the lowest energy state to the left
|
||||
Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)]
|
||||
* (Kept_States_left[ll].E <= Kept_States_right[lr].E
|
||||
* (Kept_States_left[ll].E <= Kept_States_right[lr].E
|
||||
? real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])))
|
||||
: real(exp(ln_Density_ME (Kept_States_right[lr], Kept_States_left[ll]))));
|
||||
// We don't do anything with block 2, we don't even assume it's been allocated.
|
||||
}
|
||||
|
||||
|
||||
else if (symmetric_states) {
|
||||
// Check parity of both states:
|
||||
bool Lstate_parity_inv = Kept_States_left[ll].Check_Symmetry();
|
||||
bool Rstate_parity_inv = Kept_States_right[lr].Check_Symmetry();
|
||||
|
||||
|
||||
if (Lstate_parity_inv && Rstate_parity_inv) {
|
||||
DME_block_1[ll* block_row_length + lr] = Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)]
|
||||
DME_block_1[ll* block_row_length + lr] = Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)]
|
||||
* real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])));
|
||||
if (block_option == 2) DME_block_2[ll* block_row_length + lr] = 0.0;
|
||||
}
|
||||
@@ -175,15 +175,15 @@ namespace JSC {
|
||||
PRstate.Parity_Flip();
|
||||
|
||||
if (block_option == 1) {
|
||||
DME_block_1[ll* block_row_length + lr] =
|
||||
DME_block_1[ll* block_row_length + lr] =
|
||||
(Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])))
|
||||
+ Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], PRstate))));
|
||||
// We don't do anything with block 2, we don't even assume it's been allocated.
|
||||
}
|
||||
else if (block_option == 2) {
|
||||
DME_block_1[ll* block_row_length + lr] =
|
||||
DME_block_1[ll* block_row_length + lr] =
|
||||
Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])));
|
||||
DME_block_2[ll* block_row_length + lr] =
|
||||
DME_block_2[ll* block_row_length + lr] =
|
||||
Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], PRstate)));
|
||||
}
|
||||
}
|
||||
@@ -193,16 +193,16 @@ namespace JSC {
|
||||
PRstate.Parity_Flip();
|
||||
|
||||
if (block_option == 1) {
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
(Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])))
|
||||
+ Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], PRstate))));
|
||||
// We don't do anything with block 2, we don't even assume it's been allocated.
|
||||
}
|
||||
else if (block_option == 2) {
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])));
|
||||
DME_block_2[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], PRstate)));
|
||||
DME_block_2[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], PRstate)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,15 +211,15 @@ namespace JSC {
|
||||
PLstate.Parity_Flip();
|
||||
|
||||
if (block_option == 1) {
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
(Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])))
|
||||
+ Kweight[abs(PLstate.iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (PLstate, Kept_States_right[lr]))));
|
||||
// We don't do anything with block 2, we don't even assume it's been allocated.
|
||||
}
|
||||
else if (block_option == 2) {
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
DME_block_1[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
Kweight[abs(Kept_States_left[ll].iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], Kept_States_right[lr])));
|
||||
DME_block_2[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
DME_block_2[ll* block_row_length + lr] = sqrt(0.5) *
|
||||
Kweight[abs(PLstate.iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (PLstate, Kept_States_right[lr])));
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace JSC {
|
||||
} // for ll
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -13,12 +13,13 @@ Purpose: for NRG, this function specifies the momentum-dependent
|
||||
Collaboration with Robert Konik.
|
||||
|
||||
***********************************************************/
|
||||
#include "JSC.h"
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// This function defines the integrand for momentum-dependent perturbation prefactor
|
||||
DP K_Weight_integrand (Vect_DP args)
|
||||
@@ -44,4 +45,4 @@ namespace JSC {
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,15 +12,16 @@ Purpose: select states for numerical RG method,
|
||||
collaboration with Robert Konik.
|
||||
|
||||
***********************************************************/
|
||||
#include "JSC.h"
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
DP Estimate_Contribution_of_Single_ph_Annihilation_Path_to_2nd_Order_PT (LiebLin_Bethe_State& TopState,
|
||||
LiebLin_Bethe_State& GroundState,
|
||||
DP Estimate_Contribution_of_Single_ph_Annihilation_Path_to_2nd_Order_PT (LiebLin_Bethe_State& TopState,
|
||||
LiebLin_Bethe_State& GroundState,
|
||||
//Vect_DP Weight_integral)
|
||||
Vect<complex <DP> >& FT_of_potential)
|
||||
{
|
||||
@@ -36,22 +37,22 @@ namespace JSC {
|
||||
State_Label_Data topdata = Read_State_Label (TopState.label, OriginIx2);
|
||||
int nphpairs = topdata.nexc[0];
|
||||
|
||||
if (nphpairs == 0) JSCerror("Trying to annihilate ground state in Estimate_Contribution...");
|
||||
if (nphpairs == 0) ABACUSerror("Trying to annihilate ground state in Estimate_Contribution...");
|
||||
|
||||
|
||||
DP densityME = real(exp(ln_Density_ME (GroundState, TopState)));
|
||||
if (is_nan(densityME)) {
|
||||
cout << "ME is nan: label = " << TopState.label << endl;
|
||||
JSCerror("ME didn't return value.");
|
||||
ABACUSerror("ME didn't return value.");
|
||||
}
|
||||
|
||||
int nr_cont = 0;
|
||||
|
||||
// Add first-order PT contribution, and 2nd order from ground state (V_{00} == 1)
|
||||
//contrib_estimate += Weight_integral[Weight_integral.size()/2 + (TopState.iK - GroundState.iK)]
|
||||
//* (densityME/(GroundState.E - TopState.E)) * (1.0 - (GroundState.N/GroundState.L)/(GroundState.E - TopState.E));
|
||||
//* (densityME/(GroundState.E - TopState.E)) * (1.0 - (GroundState.N/GroundState.L)/(GroundState.E - TopState.E));
|
||||
contrib_estimate += abs(FT_of_potential[FT_of_potential.size()/2 + (TopState.iK - GroundState.iK)]
|
||||
* (densityME/(GroundState.E - TopState.E))
|
||||
* (densityME/(GroundState.E - TopState.E))
|
||||
* (1.0 - (GroundState.N/GroundState.L)/(GroundState.E - TopState.E)));
|
||||
|
||||
nr_cont++;
|
||||
@@ -77,7 +78,7 @@ namespace JSC {
|
||||
|
||||
for (int ipart = 0; ipart < nphpairs; ++ipart) {
|
||||
for (int ihole = 0; ihole < nphpairs; ++ihole) {
|
||||
|
||||
|
||||
LiebLin_Bethe_State DescendedState = TopState;
|
||||
//cout << "Here 2a" << "\tipart " << ipart << "\tihole " << ihole << " out of " << nphpairs << " nphpairs, label " << TopState.label << endl;
|
||||
//cout << "TopState.Ix2 " << TopState.Ix2 << endl;
|
||||
@@ -85,10 +86,10 @@ namespace JSC {
|
||||
DescendedState.Annihilate_ph_pair(ipart, ihole, OriginIx2);
|
||||
DescendedState.Compute_All(true);
|
||||
//cout << "DescendedIx2 " << DescendedState.Ix2 << endl;
|
||||
|
||||
|
||||
DP densityME_top_desc = real(exp(ln_Density_ME (TopState, DescendedState)));
|
||||
DP densityME_desc_ground = real(exp(ln_Density_ME (DescendedState, GroundState)));
|
||||
|
||||
|
||||
//contrib_estimate += Weight_integral[Weight_integral.size()/2 + (TopState.iK - DescendedState.iK)]
|
||||
//* Weight_integral[Weight_integral.size()/2 + (DescendedState.iK - GroundState.iK)]
|
||||
//* densityME_top_desc * densityME_desc_ground
|
||||
@@ -102,7 +103,7 @@ namespace JSC {
|
||||
* FT_of_potential[FT_of_potential.size()/2 + (DescendedState.iK - GroundState.iK)]
|
||||
* densityME_top_desc * densityME_desc_ground
|
||||
/((GroundState.E - TopState.E) * (GroundState.E - DescendedState.E)));
|
||||
|
||||
|
||||
nr_cont++;
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ namespace JSC {
|
||||
DescendedState2.Compute_All(true);
|
||||
//cout << DescendedState2.Ix2 << endl;
|
||||
//cout << DescendedState2.lambdaoc << endl;
|
||||
|
||||
|
||||
DP densityME_top_desc2 = real(exp(ln_Density_ME (TopState, DescendedState2)));
|
||||
DP densityME_desc2_ground = real(exp(ln_Density_ME (DescendedState2, GroundState)));
|
||||
|
||||
@@ -129,7 +130,7 @@ namespace JSC {
|
||||
// if intermediate state has momentum within allowable window, OK, otherwise discard contribution:
|
||||
if (abs(TopState.iK - DescendedState2.iK) < FT_of_potential.size()/2 &&
|
||||
abs(DescendedState2.iK - GroundState.iK) < FT_of_potential.size()/2) {
|
||||
|
||||
|
||||
contrib_estimate += abs(FT_of_potential[FT_of_potential.size()/2 + (TopState.iK - DescendedState2.iK)]
|
||||
* FT_of_potential[FT_of_potential.size()/2 + (DescendedState2.iK - GroundState.iK)]
|
||||
* densityME_top_desc2 * densityME_desc2_ground
|
||||
@@ -141,17 +142,17 @@ namespace JSC {
|
||||
if (nphpairs >= 4) { // go one step further
|
||||
for (int ipart3 = ipart2; ipart3 < nphpairs - 2; ++ipart3) {
|
||||
for (int ihole3 = ihole2; ihole3 < nphpairs - 2; ++ihole3) {
|
||||
|
||||
|
||||
LiebLin_Bethe_State DescendedState3 = DescendedState2;
|
||||
//cout << "Here 4a" << "\tipart3 " << ipart3 << "\tihole3 " << ihole3 << endl;
|
||||
DescendedState3.Annihilate_ph_pair(ipart3, ihole3, OriginIx2);
|
||||
//cout << DescendedState3.Ix2 << endl;
|
||||
DescendedState3.Compute_All(true);
|
||||
//cout << DescendedState3.Ix2 << endl;
|
||||
|
||||
|
||||
DP densityME_top_desc3 = real(exp(ln_Density_ME (TopState, DescendedState3)));
|
||||
DP densityME_desc3_ground = real(exp(ln_Density_ME (DescendedState3, GroundState)));
|
||||
|
||||
|
||||
//contrib_estimate += Weight_integral[Weight_integral.size()/2 + (TopState.iK - DescendedState3.iK)]
|
||||
//* Weight_integral[Weight_integral.size()/2 + (DescendedState3.iK - GroundState.iK)]
|
||||
//* densityME_top_desc3 * densityME_desc3_ground
|
||||
@@ -160,12 +161,12 @@ namespace JSC {
|
||||
// if intermediate state has momentum within allowable window, OK, otherwise discard contribution:
|
||||
if (abs(TopState.iK - DescendedState3.iK) < FT_of_potential.size()/2 &&
|
||||
abs(DescendedState3.iK - GroundState.iK) < FT_of_potential.size()/2) {
|
||||
|
||||
|
||||
contrib_estimate += abs(FT_of_potential[FT_of_potential.size()/2 + (TopState.iK - DescendedState3.iK)]
|
||||
* FT_of_potential[FT_of_potential.size()/2 + (DescendedState3.iK - GroundState.iK)]
|
||||
* densityME_top_desc3 * densityME_desc3_ground
|
||||
/((GroundState.E - TopState.E) * (GroundState.E - DescendedState3.E)));
|
||||
|
||||
|
||||
nr_cont++;
|
||||
}
|
||||
|
||||
@@ -175,7 +176,7 @@ namespace JSC {
|
||||
} // for ihole2
|
||||
} // for ipart2
|
||||
} // if (nphpairs >= 3)
|
||||
|
||||
|
||||
} // for ihole
|
||||
} // for ipart
|
||||
} // if nphpairs >= 2
|
||||
@@ -187,7 +188,7 @@ namespace JSC {
|
||||
}
|
||||
|
||||
/*
|
||||
DP Estimate_Contribution_of_Base_to_2nd_Order_PT (LiebLin_Bethe_State& ScanState, LiebLin_Bethe_State& GroundState,
|
||||
DP Estimate_Contribution_of_Base_to_2nd_Order_PT (LiebLin_Bethe_State& ScanState, LiebLin_Bethe_State& GroundState,
|
||||
Vect_DP Weight_integral, LiebLin_States_and_Density_ME_of_Base& StatesBase)
|
||||
{
|
||||
// This function calculates the second-order perturbation theory contribution to
|
||||
@@ -196,7 +197,7 @@ namespace JSC {
|
||||
DP sum_contrib = 0.0;
|
||||
|
||||
for (int i = 0; i <= StatesBase.maxid; ++i)
|
||||
sum_contrib += Weight_integral[Weight_integral.size()/2 + (ScanState.iK - StatesBase.State[i].iK)]
|
||||
sum_contrib += Weight_integral[Weight_integral.size()/2 + (ScanState.iK - StatesBase.State[i].iK)]
|
||||
* Weight_integral[Weight_integral.size()/2 + (StatesBase.State[i].iK - GroundState.iK)]
|
||||
* real(exp(ln_Density_ME (ScanState, StatesBase.State[i]))) * StatesBase.densityME[i]
|
||||
/((GroundState.E - StatesBase.State[i].E) * (GroundState.E - ScanState.E));
|
||||
@@ -220,35 +221,35 @@ namespace JSC {
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, 'Z', c_int, L, N, iKmin, iKmax, 0.0, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
|
||||
stringstream NRG_stringstream; string NRG_string;
|
||||
NRG_stringstream << "States_c_" << c_int << "_L_" << L << "_N_" << N
|
||||
<< "_iKmin_" << iKmin << "_iKmax_" << iKmax << "_Nstates_" << Nstates_required
|
||||
<< "_Sym_" << symmetric_states << "_iKmod_" << iKmod << "_wopt_" << weighing_option << ".nrg";
|
||||
|
||||
NRG_stringstream << "States_c_" << c_int << "_L_" << L << "_N_" << N
|
||||
<< "_iKmin_" << iKmin << "_iKmax_" << iKmax << "_Nstates_" << Nstates_required
|
||||
<< "_Sym_" << symmetric_states << "_iKmod_" << iKmod << "_wopt_" << weighing_option << ".nrg";
|
||||
|
||||
|
||||
RAW_string = RAW_stringstream.str();
|
||||
const char* RAW_Cstr = RAW_string.c_str();
|
||||
|
||||
|
||||
NRG_string = NRG_stringstream.str();
|
||||
const char* NRG_Cstr = NRG_string.c_str();
|
||||
|
||||
|
||||
ifstream infile;
|
||||
infile.open(RAW_Cstr);
|
||||
|
||||
|
||||
if (infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("The input file was not opened successfully in Select_States_for_NRG. ");
|
||||
ABACUSerror("The input file was not opened successfully in Select_States_for_NRG. ");
|
||||
}
|
||||
|
||||
ofstream NRG_outfile;
|
||||
|
||||
|
||||
NRG_outfile.open(NRG_Cstr);
|
||||
if (NRG_outfile.fail()) JSCerror("Could not open NRG_outfile... ");
|
||||
|
||||
if (NRG_outfile.fail()) ABACUSerror("Could not open NRG_outfile... ");
|
||||
|
||||
//NRG_outfile.setf(ios::scientific);
|
||||
NRG_outfile.precision(16);
|
||||
|
||||
@@ -281,7 +282,7 @@ namespace JSC {
|
||||
//int* conv = new int[MAXDATA];
|
||||
string* label = new string[MAXDATA];
|
||||
bool* sym = new bool[MAXDATA];
|
||||
|
||||
|
||||
int Ndata = 0;
|
||||
|
||||
infile.close();
|
||||
@@ -299,7 +300,7 @@ namespace JSC {
|
||||
infile.close();
|
||||
|
||||
// Define the ground state:
|
||||
LiebLin_Bethe_State GroundState (c_int, L, N);
|
||||
LiebLin_Bethe_State GroundState (c_int, L, N);
|
||||
GroundState.Compute_All(true);
|
||||
|
||||
// Define OriginIx2 for labelling:
|
||||
@@ -314,7 +315,7 @@ namespace JSC {
|
||||
|
||||
/*
|
||||
// DEPRECATED 25/1/2012: from now on (ABACUS++T_8 onwards), use FT of potential as argument to this function.
|
||||
Vect_DP Weight_integral (0.0, 4* (iKmax - iKmin)); // we give a large window
|
||||
Vect_DP Weight_integral (0.0, 4* (iKmax - iKmin)); // we give a large window
|
||||
|
||||
//Vect_DP args(0.0, 2);
|
||||
DP req_rel_prec = 1.0e-6;
|
||||
@@ -325,7 +326,7 @@ namespace JSC {
|
||||
|
||||
args_to_weight_integrand[1] = DP(iK);
|
||||
|
||||
Integral_result answer = Integrate_optimal (weight_integrand_fn, args_to_weight_integrand,
|
||||
Integral_result answer = Integrate_optimal (weight_integrand_fn, args_to_weight_integrand,
|
||||
0, 0.0, 0.5, req_rel_prec, req_abs_prec, max_nr_pts);
|
||||
|
||||
Weight_integral[Weight_integral.size()/2 + iK] = answer.integ_est;
|
||||
@@ -344,7 +345,7 @@ namespace JSC {
|
||||
for (int i = 0; i < Ndata; ++i) {
|
||||
|
||||
//cout << i << " out of " << Ndata << "\tlabel = " << label[i] << endl;
|
||||
|
||||
|
||||
if (abs(iK[i]) % iKmod != 0) { // if iK not a multiple of iKmod: give stupidly high weight.
|
||||
weight[i] = 1.0e+100;
|
||||
sym[i] = false; // doesn't matter
|
||||
@@ -359,41 +360,41 @@ namespace JSC {
|
||||
sym[i] = ScanState.Check_Symmetry();
|
||||
|
||||
//cout << "Setting state " << i << "\t to label " << label[i] << "\tsym: " << sym[i] << endl;
|
||||
|
||||
|
||||
// WEIGHING THE STATES: **********************************************
|
||||
|
||||
|
||||
State_Label_Data currentdata = Read_State_Label (label[i], OriginIx2);
|
||||
if (currentdata.nexc[0] == 0) weight[i] = 0.0;
|
||||
|
||||
|
||||
else if (symmetric_states && iK[i] < 0 || iK[i] < iKmin || iK[i] > iKmax) weight[i] = 1.0e+100;
|
||||
|
||||
|
||||
//else if (symmetric_states && iK[i] == 0 && !ScanState.Check_Symmetry()) {
|
||||
else if (symmetric_states && iK[i] == 0 && !sym[i]) {
|
||||
// This state is at zero momentum but not symmetric. we keep it only if
|
||||
// This state is at zero momentum but not symmetric. we keep it only if
|
||||
// the first non-symmetric pair of quantum numbers is right-weighted:
|
||||
int icheck = 0;
|
||||
while (ScanState.Ix2[N-1-icheck] == -ScanState.Ix2[icheck]) icheck++;
|
||||
if (ScanState.Ix2[N-1-icheck] > -ScanState.Ix2[icheck]) {
|
||||
if (weighing_option == 0) weight[i] = E[i];
|
||||
else if (weighing_option == 1 || weighing_option == 2)
|
||||
weight[i] = 1.0/(1.0e-100 + fabs(Estimate_Contribution_of_Single_ph_Annihilation_Path_to_2nd_Order_PT
|
||||
else if (weighing_option == 1 || weighing_option == 2)
|
||||
weight[i] = 1.0/(1.0e-100 + fabs(Estimate_Contribution_of_Single_ph_Annihilation_Path_to_2nd_Order_PT
|
||||
//(ScanState, GroundState, Weight_integral)));
|
||||
(ScanState, GroundState, FT_of_potential)));
|
||||
}
|
||||
else weight[i] = 1.0e+100;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
if (weighing_option == 0) weight[i] = E[i];
|
||||
else if (weighing_option == 1 || weighing_option == 2)
|
||||
weight[i] = 1.0/(1.0e-100 + fabs(Estimate_Contribution_of_Single_ph_Annihilation_Path_to_2nd_Order_PT
|
||||
else if (weighing_option == 1 || weighing_option == 2)
|
||||
weight[i] = 1.0/(1.0e-100 + fabs(Estimate_Contribution_of_Single_ph_Annihilation_Path_to_2nd_Order_PT
|
||||
//(ScanState, GroundState, Weight_integral)));
|
||||
(ScanState, GroundState, FT_of_potential)));
|
||||
}
|
||||
//cout << i << " out of " << Ndata << "\tlabel = " << label[i] << "\tweight = " << weight[i] << endl;
|
||||
}
|
||||
} // for i
|
||||
|
||||
|
||||
// Now order the states in increasing weight
|
||||
|
||||
int* index = new int[Ndata];
|
||||
@@ -413,7 +414,7 @@ namespace JSC {
|
||||
|
||||
// Copy selected states into new vectors:
|
||||
|
||||
for (int i = 0; i < JSC::min(Ndata, Nstates_required); ++i) {
|
||||
for (int i = 0; i < ABACUS::min(Ndata, Nstates_required); ++i) {
|
||||
E_kept[i] = E[index[i] ];
|
||||
iK_kept[i] = iK[index[i] ];
|
||||
//conv_kept[i] = conv[index[i] ];
|
||||
@@ -434,8 +435,8 @@ namespace JSC {
|
||||
// Output selected states:
|
||||
for (int i = 0; i < Nstates_required; ++i) {
|
||||
if (i > 0) NRG_outfile << endl;
|
||||
NRG_outfile << i << "\t" << E_kept[i] << "\t" << iK_kept[index_kept[i] ]
|
||||
//<< "\t" << conv_kept[index_kept[i] ]
|
||||
NRG_outfile << i << "\t" << E_kept[i] << "\t" << iK_kept[index_kept[i] ]
|
||||
//<< "\t" << conv_kept[index_kept[i] ]
|
||||
<< "\t" << label_kept[index_kept[i] ]
|
||||
<< "\t" << sym_kept[index_kept[i] ] << "\t" << weight_kept[index_kept[i] ];
|
||||
}
|
||||
@@ -458,4 +459,4 @@ namespace JSC {
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
Reference in New Issue
Block a user