Clean up sources up to (before) src/SCAN.

This commit is contained in:
J.-S. Caux
2018-02-11 10:01:56 +01:00
parent d337885305
commit e7dd24d337
28 changed files with 1046 additions and 2987 deletions
+47 -30
View File
@@ -21,8 +21,10 @@ using namespace ABACUS;
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,
int weighing_option, int nrglabel_left_begin, int nrglabel_left_end, int nrglabel_right_begin, int nrglabel_right_end,
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
@@ -39,12 +41,18 @@ namespace ABACUS {
// 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) 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 < 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)
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.");
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;
@@ -77,7 +85,6 @@ namespace ABACUS {
}
// Read the whole data file:
//const int MAXDATA = 5000000;
const int MAXDATA = ABACUS::max(nrglabel_left_end, nrglabel_right_end) + 10; // 10 for safety...
int* nrglabel = new int[MAXDATA];
@@ -123,8 +130,9 @@ namespace ABACUS {
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;
if (!Scanstate.conv)
cout << "State of label " << label[nrglabel_left] << " did not converge after " << Scanstate.iter_Newton
<< " Newton step; diffsq = " << Scanstate.diffsq << endl;
} // for nrglabel_left
for (int nrglabel_right = nrglabel_right_begin; nrglabel_right <= nrglabel_right_end; ++nrglabel_right) {
@@ -136,8 +144,9 @@ namespace ABACUS {
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;
if (!Scanstate.conv)
cout << "State of label " << label[nrglabel_right] << " did not converge after " << Scanstate.iter_Newton
<< " Newton step; diffsq = " << Scanstate.diffsq << endl;
} // for nrglabel_left
@@ -147,7 +156,6 @@ namespace ABACUS {
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)
&& abs(Kept_States_left[ll].iK) % iKmod == 0
&& abs(Kept_States_right[lr].iK) % iKmod == 0) {
@@ -176,15 +184,19 @@ namespace ABACUS {
if (block_option == 1) {
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))));
(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] =
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 - 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] =
Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)] * real(exp(ln_Density_ME (Kept_States_left[ll], PRstate)));
Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)]
* real(exp(ln_Density_ME (Kept_States_left[ll], PRstate)));
}
}
@@ -194,15 +206,19 @@ namespace ABACUS {
if (block_option == 1) {
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))));
(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) *
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 - 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)));
Kweight[abs(Kept_States_left[ll].iK - PRstate.iK)]
* real(exp(ln_Density_ME (Kept_States_left[ll], PRstate)));
}
}
@@ -212,15 +228,19 @@ namespace ABACUS {
if (block_option == 1) {
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]))));
(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) *
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 - 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(PLstate.iK - Kept_States_right[lr].iK)] * real(exp(ln_Density_ME (PLstate, Kept_States_right[lr])));
Kweight[abs(PLstate.iK - Kept_States_right[lr].iK)]
* real(exp(ln_Density_ME (PLstate, Kept_States_right[lr])));
}
}
@@ -229,16 +249,13 @@ namespace ABACUS {
else {
DME_block_1[ll* block_row_length + lr] = 0.0;
if (symmetric_states && block_option == 2) DME_block_2[ll* block_row_length + lr] = 0.0; // condition, to prevent segfault if DME_block_2 not allocated.
// condition, to prevent segfault if DME_block_2 not allocated.
if (symmetric_states && block_option == 2) DME_block_2[ll* block_row_length + lr] = 0.0;
}
//cout << ll << "\t" << lr << "\t" << DME_block[ll* block_row_length + lr] << endl;
} // for lr
} // for ll
return;
}
} // namespace ABACUS
-2
View File
@@ -43,6 +43,4 @@ namespace ABACUS {
return(value);
}
} // namespace ABACUS
+4 -121
View File
@@ -22,12 +22,8 @@ namespace ABACUS {
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)
{
//cout << TopState.label << "\t" << GroundState.label << endl;
//cout << TopState.lambdaoc << endl;
DP contrib_estimate = 0.0;
// Define OriginIx2 for labelling:
@@ -49,8 +45,6 @@ namespace ABACUS {
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));
contrib_estimate += abs(FT_of_potential[FT_of_potential.size()/2 + (TopState.iK - GroundState.iK)]
* (densityME/(GroundState.E - TopState.E))
* (1.0 - (GroundState.N/GroundState.L)/(GroundState.E - TopState.E)));
@@ -58,10 +52,6 @@ namespace ABACUS {
nr_cont++;
// Add second order PT contribution coming from TopState:
//contrib_estimate += Weight_integral[Weight_integral.size()/2 + 0]
//* Weight_integral[Weight_integral.size()/2 + (TopState.iK - GroundState.iK)]
//* 1.0 * densityME * (GroundState.N/GroundState.L) // 1.0 is V_{TopState, TopState}
///((GroundState.E - TopState.E) * (GroundState.E - TopState.E));
contrib_estimate += abs(FT_of_potential[FT_of_potential.size()/2 + 0]
* FT_of_potential[FT_of_potential.size()/2 + (TopState.iK - GroundState.iK)]
* 1.0 * densityME * (GroundState.N/GroundState.L) // 1.0 is V_{TopState, TopState}
@@ -69,32 +59,20 @@ namespace ABACUS {
nr_cont++;
//cout << "Here b" << endl;
// Now add 2nd order terms coming from single particle-hole annihilation paths:
// this is only to be included for states with at least 4 excitations (2 ph pairs)
if (nphpairs >= 2) {
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;
//cout << "DescendedIx2 " << DescendedState.Ix2 << endl;
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
///((GroundState.E - TopState.E) * (GroundState.E - DescendedState.E));
// if intermediate state has momentum within allowable window, OK, otherwise discard contribution:
if (abs(TopState.iK - DescendedState.iK) < FT_of_potential.size()/2 &&
abs(DescendedState.iK - GroundState.iK) < FT_of_potential.size()/2) {
@@ -112,21 +90,12 @@ namespace ABACUS {
for (int ihole2 = ihole; ihole2 < nphpairs - 1; ++ihole2) {
LiebLin_Bethe_State DescendedState2 = DescendedState;
//cout << "Here 3a" << "\tipart2 " << ipart2 << "\tihole2 " << ihole2 << endl;
//cout << DescendedState2.Ix2 << endl;
DescendedState2.Annihilate_ph_pair(ipart2, ihole2, OriginIx2);
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)));
//contrib_estimate += Weight_integral[Weight_integral.size()/2 + (TopState.iK - DescendedState2.iK)]
//* Weight_integral[Weight_integral.size()/2 + (DescendedState2.iK - GroundState.iK)]
//* densityME_top_desc2 * densityME_desc2_ground
///((GroundState.E - TopState.E) * (GroundState.E - DescendedState2.E));
// 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) {
@@ -144,26 +113,19 @@ namespace ABACUS {
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
///((GroundState.E - TopState.E) * (GroundState.E - DescendedState3.E));
// 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)]
* 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)));
@@ -181,34 +143,12 @@ namespace ABACUS {
} // for ipart
} // if nphpairs >= 2
//cout << "Here b" << endl;
//cout << "type_id " << TopState.type_id << "\tid " << TopState.id << "\tcontrib_est = " << contrib_estimate << "\tnr_cont = " << nr_cont << endl;
return(contrib_estimate);
}
/*
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
// state ScanState coming from states of base defined in StatesBase.
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)]
* 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));
// The strange vector size is so that iK == 0 corresponds to index size/2, as per convention
return(sum_contrib);
}
*/
void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required, bool symmetric_states, int iKmod,
//int weighing_option, DP (*weight_integrand_fn) (Vect_DP), Vect_DP& args_to_weight_integrand)
int weighing_option, Vect<complex <DP> >& FT_of_potential)
void Select_States_for_NRG (DP c_int, DP L, int N, int iKmin, int iKmax, int Nstates_required,
bool symmetric_states, int iKmod, int weighing_option, Vect<complex <DP> >& FT_of_potential)
{
// This function reads an existing partition function file and determines whether
// each state is to be included in NRG by applying an energy, momentum and form factor criterion.
@@ -218,7 +158,6 @@ namespace ABACUS {
// weighing_option == 1: ordering according to perturbation theory in single p-h annihilation path
// weighing_option == 2: same as 1, but output of list is ordered in weight
stringstream filenameprefix;
Data_File_Name (filenameprefix, 'Z', c_int, L, N, iKmin, iKmax, 0.0, 0.0, "");
string prefix = filenameprefix.str();
@@ -250,21 +189,10 @@ namespace ABACUS {
NRG_outfile.open(NRG_Cstr);
if (NRG_outfile.fail()) ABACUSerror("Could not open NRG_outfile... ");
//NRG_outfile.setf(ios::scientific);
NRG_outfile.precision(16);
// Read the whole data file:
/*
// estimate its size:
struct stat statbuf;
stat (RAW_Cstr, &statbuf);
int filesize = statbuf.st_size;
// Determine the number of entries approximately
int entry_size = 1* sizeof(double) + 2*sizeof(int) + 3* sizeof(long long int);
int estimate_nr_entries = filesize/entry_size;
*/
// Count the number of entries in raw file:
int estimate_nr_entries = 0;
@@ -273,13 +201,10 @@ namespace ABACUS {
getline(infile, line);
estimate_nr_entries++;
}
const int MAXDATA = estimate_nr_entries;
//cout << "estimate_nr_entries: " << estimate_nr_entries << endl;
DP* E = new DP[MAXDATA];
int* iK = new int[MAXDATA];
//int* conv = new int[MAXDATA];
string* label = new string[MAXDATA];
bool* sym = new bool[MAXDATA];
@@ -291,12 +216,10 @@ namespace ABACUS {
while (((infile.peek()) != EOF) && (Ndata < MAXDATA)) {
infile >> E[Ndata];
infile >> iK[Ndata];
//infile >> conv[Ndata];
infile >> label[Ndata];
Ndata++;
}
//cout << "input " << Ndata << " data lines." << endl;
infile.close();
// Define the ground state:
@@ -313,30 +236,8 @@ namespace ABACUS {
// To cover negative and positive momenta (in case potential is not symmetric),
// we define the Weight_integral vector entry with index size/2 as corresponding to iK == 0.
/*
// 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 args(0.0, 2);
DP req_rel_prec = 1.0e-6;
DP req_abs_prec = 1.0e-6;
int max_nr_pts = 10000;
for (int iK = -Weight_integral.size()/2; iK < Weight_integral.size()/2; ++iK) {
args_to_weight_integrand[1] = DP(iK);
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;
}
*/
// Calculate weight of states using selection criterion function
//DP absdensityME = 0.0;
DP* weight = new DP[Ndata];
// For weighing using 2nd order PT, we only trace over 2 excitation states (1 p-h pair)
@@ -344,8 +245,6 @@ namespace ABACUS {
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,16 +258,11 @@ namespace ABACUS {
if (weighing_option == 1 || weighing_option == 2) ScanState.Compute_All(true);
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
// the first non-symmetric pair of quantum numbers is right-weighted:
@@ -378,7 +272,6 @@ namespace ABACUS {
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
//(ScanState, GroundState, Weight_integral)));
(ScanState, GroundState, FT_of_potential)));
}
else weight[i] = 1.0e+100;
@@ -388,10 +281,8 @@ namespace ABACUS {
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
//(ScanState, GroundState, Weight_integral)));
(ScanState, GroundState, FT_of_potential)));
}
//cout << i << " out of " << Ndata << "\tlabel = " << label[i] << "\tweight = " << weight[i] << endl;
}
} // for i
@@ -402,18 +293,15 @@ namespace ABACUS {
QuickSort(weight, index, 0, Ndata - 1);
// Select states by increasing weight, with a max of Nstates_required entries
DP* E_kept = new DP[Nstates_required];
int* iK_kept = new int[Nstates_required];
//int* conv_kept = new int[Nstates_required];
string* label_kept = new string[Nstates_required];
bool* sym_kept = new bool[Nstates_required];
DP* weight_kept = new DP[Nstates_required];
// Copy selected states into new vectors:
for (int i = 0; i < ABACUS::min(Ndata, Nstates_required); ++i) {
E_kept[i] = E[index[i] ];
iK_kept[i] = iK[index[i] ];
@@ -425,7 +313,6 @@ namespace ABACUS {
// If needed, order selected states by increasing energy:
int* index_kept = new int[Nstates_required];
for (int i = 0; i < Nstates_required; ++i) index_kept[i] = i;
@@ -436,19 +323,16 @@ namespace ABACUS {
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] ]
<< "\t" << label_kept[index_kept[i] ]
<< "\t" << sym_kept[index_kept[i] ] << "\t" << weight_kept[index_kept[i] ];
}
delete[] E;
delete[] iK;
//delete[] conv;
delete[] label;
delete[] sym;
delete[] E_kept;
delete[] iK_kept;
//delete[] conv_kept;
delete[] label_kept;
delete[] sym_kept;
delete[] weight;
@@ -458,5 +342,4 @@ namespace ABACUS {
return;
}
} // namespace ABACUS