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:
+72
-71
@@ -1,6 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,26 +12,25 @@ Purpose: defines functions in Base class,
|
||||
providing a unified base object for all
|
||||
Bethe Ansatz integrable models.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function definitions: class Base
|
||||
|
||||
Base::Base () : Charge(0), Nrap(Vect<int>()), Nraptot(0), Ix2_infty(Vect<DP>()),
|
||||
Ix2_max(Vect<int>()), id(0LL) {}
|
||||
|
||||
|
||||
Base::Base (int N) : Charge(N), Nrap(Vect<int>(N,1)), Nraptot(N), Ix2_infty(Vect<DP>(1.0e+100,1)),
|
||||
Ix2_max(Vect<int>(LONG_LONG_MAX, 1)), id(N) {}
|
||||
|
||||
Base::Base (const Base& RefBase) // copy constructor
|
||||
: Charge(RefBase.Charge), Nrap(Vect<int>(RefBase.Nrap.size())), Nraptot(RefBase.Nraptot),
|
||||
Ix2_infty(Vect<DP>(RefBase.Ix2_infty.size())), Ix2_max(Vect<int>(RefBase.Ix2_max.size())), id(RefBase.id)
|
||||
: Charge(RefBase.Charge), Nrap(Vect<int>(RefBase.Nrap.size())), Nraptot(RefBase.Nraptot),
|
||||
Ix2_infty(Vect<DP>(RefBase.Ix2_infty.size())), Ix2_max(Vect<int>(RefBase.Ix2_max.size())), id(RefBase.id)
|
||||
{
|
||||
for (int i = 0; i < Nrap.size(); ++i) {
|
||||
Nrap[i] = RefBase.Nrap[i];
|
||||
@@ -40,7 +41,7 @@ namespace JSC {
|
||||
|
||||
/*
|
||||
// DEPRECATED
|
||||
Base::Base (const Heis_Chain& RefChain, int M)
|
||||
Base::Base (const Heis_Chain& RefChain, int M)
|
||||
: Charge(M), Nrap(Vect<int>(RefChain.Nstrings)), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings))
|
||||
{
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nrap[i] = 0;
|
||||
@@ -48,17 +49,17 @@ namespace JSC {
|
||||
|
||||
Nraptot = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
|
||||
|
||||
|
||||
// The id of this is zero by definition
|
||||
id = 0LL;
|
||||
|
||||
// Now compute the Ix2_infty numbers
|
||||
|
||||
|
||||
(*this).Compute_Ix2_limits(RefChain);
|
||||
|
||||
}
|
||||
*/
|
||||
Base::Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities)
|
||||
Base::Base (const Heis_Chain& RefChain, const Vect<int>& Nrapidities)
|
||||
: Charge(0), Nrap(Nrapidities), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings)),
|
||||
id (0LL)
|
||||
{
|
||||
@@ -66,16 +67,16 @@ namespace JSC {
|
||||
// Check consistency of Nrapidities vector with RefChain
|
||||
|
||||
//if (RefChain.Nstrings != Nrapidities.size()) cout << "error: Nstrings = " << RefChain.Nstrings << "\tNrap.size = " << Nrapidities.size() << endl;
|
||||
|
||||
if (RefChain.Nstrings != Nrapidities.size()) JSCerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
|
||||
if (RefChain.Nstrings != Nrapidities.size()) ABACUSerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
int Mcheck = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Mcheck += RefChain.Str_L[i] * Nrap[i];
|
||||
Charge = Mcheck;
|
||||
|
||||
|
||||
Nraptot = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
|
||||
|
||||
|
||||
// Compute id
|
||||
id += Nrapidities[0];
|
||||
long long int factor = 100000LL;
|
||||
@@ -87,10 +88,10 @@ namespace JSC {
|
||||
// Now compute the Ix2_infty numbers
|
||||
|
||||
(*this).Compute_Ix2_limits(RefChain);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Base::Base (const Heis_Chain& RefChain, long long int id_ref)
|
||||
Base::Base (const Heis_Chain& RefChain, long long int id_ref)
|
||||
: Charge(0), Nrap(Vect<int>(RefChain.Nstrings)), Nraptot(0), Ix2_infty(Vect<DP>(RefChain.Nstrings)), Ix2_max(Vect<int>(RefChain.Nstrings)),
|
||||
id (id_ref)
|
||||
{
|
||||
@@ -108,18 +109,18 @@ namespace JSC {
|
||||
//id = id_ref;
|
||||
|
||||
//cout << "In Base constructor: id_ref = " << id_ref << " and Nrapidities = " << Nrap << endl;
|
||||
|
||||
|
||||
// Check consistency of Nrapidities vector with RefChain
|
||||
|
||||
//if (RefChain.Nstrings != Nrap.size()) JSCerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
//if (RefChain.Nstrings != Nrap.size()) ABACUSerror("Incompatible Nrapidities vector used in Base constructor.");
|
||||
|
||||
int Mcheck = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Mcheck += RefChain.Str_L[i] * Nrap[i];
|
||||
Charge = Mcheck;
|
||||
|
||||
|
||||
Nraptot = 0;
|
||||
for (int i = 0; i < RefChain.Nstrings; ++i) Nraptot += Nrap[i];
|
||||
|
||||
|
||||
// Now compute the Ix2_infty numbers
|
||||
|
||||
(*this).Compute_Ix2_limits(RefChain);
|
||||
@@ -138,7 +139,7 @@ namespace JSC {
|
||||
}
|
||||
return(*this);
|
||||
}
|
||||
|
||||
|
||||
bool Base::operator== (const Base& RefBase)
|
||||
{
|
||||
bool answer = (Nrap == RefBase.Nrap);
|
||||
@@ -159,39 +160,39 @@ namespace JSC {
|
||||
if ((RefChain.Delta > 0.0) && (RefChain.Delta < 1.0)) {
|
||||
|
||||
// Compute the Ix2_infty numbers
|
||||
|
||||
|
||||
DP sum1 = 0.0;
|
||||
DP sum2 = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
for (int k = 0; k < RefChain.Nstrings; ++k) {
|
||||
|
||||
|
||||
sum2 = 0.0;
|
||||
|
||||
sum2 += (RefChain.Str_L[j] == RefChain.Str_L[k]) ? 0.0 : 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
|
||||
sum2 += (RefChain.Str_L[j] == RefChain.Str_L[k]) ? 0.0 : 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
- 0.5 * fabs(RefChain.Str_L[j] - RefChain.Str_L[k]) * RefChain.anis));
|
||||
sum2 += 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
sum2 += 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
- 0.5 * (RefChain.Str_L[j] + RefChain.Str_L[k]) * RefChain.anis));
|
||||
|
||||
for (int a = 1; a < JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]); ++a)
|
||||
sum2 += 2.0 * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
|
||||
for (int a = 1; a < ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]); ++a)
|
||||
sum2 += 2.0 * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j] * RefChain.par[k])
|
||||
- 0.5 * (fabs(RefChain.Str_L[j] - RefChain.Str_L[k]) + 2.0*a) * RefChain.anis));
|
||||
|
||||
|
||||
sum1 += (Nrap[k] - ((j == k) ? 1 : 0)) * sum2;
|
||||
}
|
||||
|
||||
Ix2_infty[j] = (1.0/PI) * fabs(RefChain.Nsites * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j])
|
||||
|
||||
Ix2_infty[j] = (1.0/PI) * fabs(RefChain.Nsites * 2.0 * atan(tan(0.25 * PI * (1.0 + RefChain.par[j])
|
||||
- 0.5 * RefChain.Str_L[j] * RefChain.anis)) - sum1);
|
||||
|
||||
|
||||
} // The Ix2_infty are now set.
|
||||
|
||||
// Now compute the Ix2_max limits
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
Ix2_max[j] = int(floor(Ix2_infty[j])); // sets basic integer
|
||||
|
||||
// Reject formally infinite rapidities (i.e. if Delta is root of unity)
|
||||
@@ -205,7 +206,7 @@ namespace JSC {
|
||||
if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
while (Ix2_max[j] > RefChain.Nsites) {
|
||||
Ix2_max[j] -= 2;
|
||||
Ix2_max[j] -= 2;
|
||||
}
|
||||
}
|
||||
} // if XXZ gapless
|
||||
@@ -213,41 +214,41 @@ namespace JSC {
|
||||
else if (RefChain.Delta == 1.0) {
|
||||
|
||||
// Compute the Ix2_infty numbers
|
||||
|
||||
|
||||
int sum1 = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
sum1 = 0;
|
||||
|
||||
|
||||
for (int k = 0; k < RefChain.Nstrings; ++k) {
|
||||
|
||||
sum1 += Nrap[k] * (2 * JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
|
||||
sum1 += Nrap[k] * (2 * ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
//Ix2_infty[j] = (RefChain.Nsites - 1.0 + 2.0 * RefChain.Str_L[j] - sum1);
|
||||
Ix2_infty[j] = (RefChain.Nsites + 1.0 - sum1); // to get counting right...
|
||||
|
||||
|
||||
} // The Ix2_infty are now set.
|
||||
|
||||
|
||||
// Now compute the Ix2_max limits
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
Ix2_max[j] = int(floor(Ix2_infty[j])); // sets basic integer
|
||||
|
||||
// Give the correct parity to Ix2_max
|
||||
|
||||
|
||||
// If Nrap is even, Ix2_max must be odd. If odd, then even.
|
||||
|
||||
if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
// If Ix2_max equals Ix2_infty, we reduce it by 2:
|
||||
|
||||
|
||||
if (Ix2_max[j] == int(Ix2_infty[j])) Ix2_max[j] -= 2;
|
||||
|
||||
|
||||
while (Ix2_max[j] > RefChain.Nsites) {
|
||||
Ix2_max[j] -= 2;
|
||||
Ix2_max[j] -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,40 +257,40 @@ namespace JSC {
|
||||
else if (RefChain.Delta > 1.0) {
|
||||
|
||||
// Compute the Ix2_infty numbers
|
||||
|
||||
|
||||
int sum1 = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
sum1 = 0;
|
||||
|
||||
|
||||
for (int k = 0; k < RefChain.Nstrings; ++k) {
|
||||
|
||||
sum1 += Nrap[k] * (2 * JSC::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
|
||||
sum1 += Nrap[k] * (2 * ABACUS::min(RefChain.Str_L[j], RefChain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
Ix2_infty[j] = (RefChain.Nsites - 1 + 2 * RefChain.Str_L[j] - sum1);
|
||||
|
||||
|
||||
} // The Ix2_infty are now set.
|
||||
|
||||
|
||||
// Now compute the Ix2_max limits
|
||||
|
||||
|
||||
for (int j = 0; j < RefChain.Nstrings; ++j) {
|
||||
|
||||
|
||||
Ix2_max[j] = int(floor(Ix2_infty[j])); // sets basic integer
|
||||
|
||||
// Give the correct parity to Ix2_max
|
||||
|
||||
|
||||
// If Nrap is even, Ix2_max must be odd. If odd, then even.
|
||||
|
||||
if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
|
||||
// If Ix2_max equals Ix2_infty, we reduce it by 2:
|
||||
|
||||
//if (Ix2_max[j] == Ix2_infty[j]) Ix2_max[j] -= 2;
|
||||
|
||||
while (Ix2_max[j] > RefChain.Nsites) {
|
||||
Ix2_max[j] -= 2;
|
||||
Ix2_max[j] -= 2;
|
||||
}
|
||||
|
||||
// Fudge, for strings:
|
||||
@@ -304,4 +305,4 @@ namespace JSC {
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,18 +12,17 @@ Purpose: defines functions in Bethe_State class,
|
||||
providing a unified object for eigenstates of all
|
||||
Bethe Ansatz integrable models.
|
||||
|
||||
|
||||
|
||||
IN DEVELOPMENT
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
Bethe_State::Bethe_State (long long int base_id_ref, long long int type_id_ref, long long int id_ref, long long int maxid_ref) :
|
||||
base_id(base_id_ref), type_id(type_id_ref), id(id_ref), maxid(maxid_ref) {}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+41
-44
@@ -1,25 +1,22 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006-9.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: src/BETHE/Offsets.cc
|
||||
|
||||
Purpose: defines functions in Offsets class.
|
||||
|
||||
|
||||
Last modified: 19/10/2009
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function definitions: class Offsets
|
||||
|
||||
@@ -31,7 +28,7 @@ namespace JSC {
|
||||
for (int i = 0; i < 2 * base.Nrap.size() + 2; ++i) Tableau[i] = RefOffset.Tableau[i];
|
||||
}
|
||||
|
||||
Offsets::Offsets (const Heis_Base& RefBase, long long int req_type_id)
|
||||
Offsets::Offsets (const Heis_Base& RefBase, long long int req_type_id)
|
||||
// sets all tableaux to empty ones, with nparticles(req_type_id) at each level
|
||||
{
|
||||
// Build nparticles vector from req_type_id
|
||||
@@ -47,9 +44,9 @@ namespace JSC {
|
||||
|
||||
// Check if we've got the right vector...
|
||||
long long int idcheck = Offsets_type_id (nparticles);
|
||||
if (idcheck != req_type_id) JSCerror("idcheck != req_type_id in Offsets constructor.");
|
||||
if (idcheck != req_type_id) ABACUSerror("idcheck != req_type_id in Offsets constructor.");
|
||||
|
||||
(*this) = Offsets(RefBase, nparticles);
|
||||
(*this) = Offsets(RefBase, nparticles);
|
||||
}
|
||||
|
||||
Offsets::Offsets (const Heis_Base& RefBase, Vect<int> nparticles) // sets all tableaux to empty ones, with nparticles at each level
|
||||
@@ -58,43 +55,43 @@ namespace JSC {
|
||||
|
||||
// Checks on nparticles vector:
|
||||
|
||||
if (nparticles.size() != 2 * base.Nrap.size() + 2) JSCerror("Wrong nparticles.size in Offsets constructor.");
|
||||
|
||||
//if (base.Nrap[0] != (nparticles[3] + nparticles[2] + base.Mdown - nparticles[0] - nparticles[1])) JSCerror("Wrong Nrap[0] in Offsets constructor.");
|
||||
if (nparticles.size() != 2 * base.Nrap.size() + 2) ABACUSerror("Wrong nparticles.size in Offsets constructor.");
|
||||
|
||||
//if (base.Nrap[0] != (nparticles[3] + nparticles[2] + base.Mdown - nparticles[0] - nparticles[1])) ABACUSerror("Wrong Nrap[0] in Offsets constructor.");
|
||||
if (nparticles[3] + nparticles[2] != nparticles[0] + nparticles[1]) {
|
||||
cout << nparticles[0] << "\t" << nparticles[1] << "\t" << nparticles[2] << "\t" << nparticles[3] << endl;
|
||||
JSCerror("Wrong Npar[0-3] in Offsets constructor.");
|
||||
ABACUSerror("Wrong Npar[0-3] in Offsets constructor.");
|
||||
}
|
||||
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
|
||||
if (base.Nrap[base_level] != nparticles[2*base_level + 2] + nparticles[2*base_level + 3]) {
|
||||
cout << base_level << "\t" << base.Nrap[base_level] << "\t" << nparticles[2*base_level + 2] << "\t" << nparticles[2*base_level + 3] << endl;
|
||||
JSCerror("Wrong Nrap[] in Offsets constructor.");
|
||||
ABACUSerror("Wrong Nrap[] in Offsets constructor.");
|
||||
}
|
||||
|
||||
// nparticles[0,1]: number of holes on R and L side in GS interval
|
||||
if (nparticles[0] > (base.Nrap[0] + 1)/2) JSCerror("nparticles[0] too large in Offsets constructor.");
|
||||
if (nparticles[1] > base.Nrap[0]/2) JSCerror("nparticles[1] too large in Offsets constructor.");
|
||||
if (nparticles[0] > (base.Nrap[0] + 1)/2) ABACUSerror("nparticles[0] too large in Offsets constructor.");
|
||||
if (nparticles[1] > base.Nrap[0]/2) ABACUSerror("nparticles[1] too large in Offsets constructor.");
|
||||
|
||||
// nparticles[2,3]: number of particles of type 0 on R and L side out of GS interval
|
||||
if (nparticles[2] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) JSCerror("nparticles[2] too large in Offsets constructor.");
|
||||
if (nparticles[3] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) JSCerror("nparticles[3] too large in Offsets constructor.");
|
||||
if (nparticles[2] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) ABACUSerror("nparticles[2] too large in Offsets constructor.");
|
||||
if (nparticles[3] > (base.Ix2_max[0] - base.Nrap[0] + 1)/2) ABACUSerror("nparticles[3] too large in Offsets constructor.");
|
||||
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++ base_level)
|
||||
if ((nparticles[2*base_level + 2] > 0 && nparticles[2*base_level + 2] > (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
|
||||
//|| (nparticles[2*base_level + 3] > 0 && nparticles[2*base_level + 3] > (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2)) {
|
||||
|| (nparticles[2*base_level + 3] > 0
|
||||
|| (nparticles[2*base_level + 3] > 0
|
||||
&& nparticles[2*base_level + 3] > base.Ix2_max[base_level] + 1 - (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)) {
|
||||
cout << base_level << "\t" << nparticles[2*base_level + 2] << "\t" << (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2
|
||||
<< "\t" << nparticles[2*base_level + 3] << "\t" << (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2
|
||||
<< "\t" << nparticles[2*base_level + 3] << "\t" << (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2
|
||||
<< "\t" << (nparticles[2*base_level + 2] > 0) << "\t" << (nparticles[2*base_level + 2] > (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
|
||||
//<< "\t" << (nparticles[2*base_level + 3] > 0) << "\t" << (nparticles[2*base_level + 3] > (base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2)
|
||||
<< "\t" << (nparticles[2*base_level + 3] > 0) << "\t"
|
||||
<< "\t" << (nparticles[2*base_level + 3] > 0) << "\t"
|
||||
<< (nparticles[2*base_level + 3] > base.Ix2_max[base_level] + 1 - (base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2) + 2)/2)
|
||||
<< endl;
|
||||
JSCerror("nparticles too large in Offsets constructor.");
|
||||
ABACUSerror("nparticles too large in Offsets constructor.");
|
||||
}
|
||||
|
||||
|
||||
// Check sum of rapidities
|
||||
|
||||
// Holes in GS interval
|
||||
@@ -104,14 +101,14 @@ namespace JSC {
|
||||
// Particles of type 0 out of GS interval
|
||||
Tableau[2] = Young_Tableau(nparticles[2], (base.Ix2_max[0] - base.Nrap[0] + 1)/2 - nparticles[2], Tableau[0]);
|
||||
Tableau[3] = Young_Tableau(nparticles[3], (base.Ix2_max[0] - base.Nrap[0] + 1)/2 - nparticles[3], Tableau[2]);
|
||||
|
||||
|
||||
// Tableaux of index i = 2,...: data about string type i/2-1.
|
||||
for (int base_level = 1; base_level < base.Nrap.size(); ++base_level) {
|
||||
Tableau[2*base_level + 2] = Young_Tableau(nparticles[2*base_level + 2],
|
||||
Tableau[2*base_level + 2] = Young_Tableau(nparticles[2*base_level + 2],
|
||||
//(base.Ix2_max[base_level] - ((base.Nrap[base_level]) % 2) + 2)/2 - nparticles[2*base_level + 2], Tableau[2]);
|
||||
//(base.Ix2_max[base_level] - base.Nrap[base_level] % 2 + 2)/2 - nparticles[2*base_level + 2], Tableau[2]);
|
||||
(base.Ix2_max[base_level] - ((base.Nrap[base_level] + 1) % 2))/2 + 1 - nparticles[2*base_level + 2], Tableau[2]);
|
||||
Tableau[2*base_level + 3] = Young_Tableau(nparticles[2*base_level + 3],
|
||||
Tableau[2*base_level + 3] = Young_Tableau(nparticles[2*base_level + 3],
|
||||
//(base.Ix2_max[base_level] - base.Nrap[base_level] % 2)/2 - nparticles[2*base_level + 3], Tableau[3]);
|
||||
(base.Ix2_max[base_level] - (base.Nrap[base_level] % 2) - 1)/2 + 1 - nparticles[2*base_level + 3], Tableau[3]);
|
||||
}
|
||||
@@ -147,11 +144,11 @@ namespace JSC {
|
||||
for (int level = 0; level < 4; ++level) { // check fundamental level only
|
||||
//for (int level = 0; level < 2 * base.Nrap.size() + 2; ++level) {
|
||||
// First check whether all rows which exist in both tableaux satisfy rule:
|
||||
for (int tableau_level = 0; tableau_level < JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] > RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
for (int tableau_level = 0; tableau_level < ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] > RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
answer = false;
|
||||
// Now check whether there exist extra rows violating rule:
|
||||
for (int tableau_level = JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < Tableau[level].Nrows; ++tableau_level)
|
||||
for (int tableau_level = ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < Tableau[level].Nrows; ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] > 0) answer = false;
|
||||
}
|
||||
|
||||
@@ -167,11 +164,11 @@ namespace JSC {
|
||||
for (int level = 0; level < 4; ++level) { // check fundamental level only
|
||||
//for (int level = 0; level < 2 * base.Nrap.size() + 2; ++level) {
|
||||
// First check whether all rows which exist in both tableaux satisfy rule:
|
||||
for (int tableau_level = 0; tableau_level < JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] < RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
for (int tableau_level = 0; tableau_level < ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); ++tableau_level)
|
||||
if (Tableau[level].Row_L[tableau_level] < RefOffsets.Tableau[level].Row_L[tableau_level])
|
||||
answer = false;
|
||||
// Now check whether there exist extra rows violating rule:
|
||||
for (int tableau_level = JSC::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < RefOffsets.Tableau[level].Nrows; ++tableau_level)
|
||||
for (int tableau_level = ABACUS::min(Tableau[level].Nrows, RefOffsets.Tableau[level].Nrows); tableau_level < RefOffsets.Tableau[level].Nrows; ++tableau_level)
|
||||
if (RefOffsets.Tableau[level].Row_L[tableau_level] > 0) answer = false;
|
||||
}
|
||||
|
||||
@@ -190,13 +187,13 @@ namespace JSC {
|
||||
|
||||
void Offsets::Set_to_id (long long int idnr)
|
||||
{
|
||||
// The idnr of the Offset is given by
|
||||
// The idnr of the Offset is given by
|
||||
// sub_id[0] + (total number of tableaux of type 0) * (sub_id[1] + (total number of tableaux of type 1) * (sub_id[2] + ...
|
||||
// + total number of tableaux of type (2*base.Nrap.size()) * sub_id[2*base.Nrap.size() + 1]
|
||||
|
||||
if (idnr > maxid) {
|
||||
cout << idnr << "\t" << maxid << endl;
|
||||
JSCerror("idnr too large in offsets.Set_to_id.");
|
||||
ABACUSerror("idnr too large in offsets.Set_to_id.");
|
||||
}
|
||||
|
||||
id = idnr;
|
||||
@@ -223,7 +220,7 @@ namespace JSC {
|
||||
|
||||
for (int i = 0; i <= 2*base.Nrap.size() + 1; ++i) {
|
||||
//cout << "level = " << i << " Tableau.id = " << sub_id[i] << endl;
|
||||
if ((Tableau[i].Nrows * Tableau[i].Ncols == 0) && (sub_id[i] != 0)) JSCerror("index too large in offset.Set_to_id.");
|
||||
if ((Tableau[i].Nrows * Tableau[i].Ncols == 0) && (sub_id[i] != 0)) ABACUSerror("index too large in offset.Set_to_id.");
|
||||
if (Tableau[i].id != sub_id[i]) Tableau[i].Set_to_id(sub_id[i]);
|
||||
}
|
||||
|
||||
@@ -235,7 +232,7 @@ namespace JSC {
|
||||
void Offsets::Compute_id ()
|
||||
{
|
||||
long long int prod_maxid = 1LL;
|
||||
|
||||
|
||||
id = 0LL;
|
||||
|
||||
for (int i = 0; i < 2*base.Nrap.size() + 2; ++i) {
|
||||
@@ -251,14 +248,14 @@ namespace JSC {
|
||||
// this function provides the full set of descendents (either at the same momentum if
|
||||
// fixed_iK == true, or not) by returning a vector of all descendent id's (leaving the
|
||||
// base and type invariant), which can then be used for further calculations.
|
||||
|
||||
|
||||
// This set of descendents is meant to be used when calculating either partition functions
|
||||
// or zero-temperature correlation functions.
|
||||
|
||||
// IMPORTANT ASSUMPTIONS:
|
||||
|
||||
// IMPORTANT ASSUMPTIONS:
|
||||
// - all even sectors consistently increase/decrease momentum for increasing tableau row length
|
||||
// - all odd sectors consistently decrease/increase momentum for increasing tableau row length
|
||||
|
||||
|
||||
// FOR FIXED MOMENTUM:
|
||||
// all tableau levels `above' the lowest occupied one are descended as for fixed_iK == false,
|
||||
// and the lowest sector's highest tableau level's row length is modified (increased or decreased by one
|
||||
@@ -269,9 +266,9 @@ namespace JSC {
|
||||
Vect<Young_Tableau> Tableau_ref = (*this).Tableau;
|
||||
Vect<Young_Tableau> Tableau_desc = Tableau_ref;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c) 2006.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,15 +10,13 @@ Combinatorics.cc
|
||||
|
||||
Defines all class related to combinatorics.
|
||||
|
||||
LAST MODIFIED: 04/09/06
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
Choose_Table::Choose_Table ()
|
||||
: Npower(0ULL), Npowerp1(1ULL), table(new unsigned long long int[1])
|
||||
@@ -33,7 +31,7 @@ namespace JSC {
|
||||
|
||||
// We can only go up to ULL_MAX:
|
||||
if (log(DP(ULLONG_MAX)) < DP(Npowerp1) * log(2.0))
|
||||
JSCerror("Choose_Table: too large to contruct.");
|
||||
ABACUSerror("Choose_Table: too large to contruct.");
|
||||
|
||||
table = new unsigned long long int[dim];
|
||||
|
||||
@@ -62,8 +60,8 @@ namespace JSC {
|
||||
|
||||
unsigned long long int Choose_Table::choose(int N, int M)
|
||||
{
|
||||
if (N < 0 || N > Npower) JSCerror("N out of bounds in choose(N,M).");
|
||||
if (M < 0 || M > Npower) JSCerror("M out of bounds in choose(N,M).");
|
||||
if (N < 0 || N > Npower) ABACUSerror("N out of bounds in choose(N,M).");
|
||||
if (M < 0 || M > Npower) ABACUSerror("M out of bounds in choose(N,M).");
|
||||
|
||||
return(table[Npowerp1 * N + M]);
|
||||
}
|
||||
@@ -86,4 +84,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.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,18 +10,17 @@ File: 2CBG_ThLim.cc
|
||||
|
||||
Purpose: solves the TBA equations for the 2-component Bose gas
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 7) JSCerror("Wrong number of arguments to 2CBG_ThLim executable. Use c(best to set to 1), mu, Omega, kBT, TT(minutes), bool Save_data (0 == false).");
|
||||
if (argc != 7) ABACUSerror("Wrong number of arguments to 2CBG_ThLim executable. Use c(best to set to 1), mu, Omega, kBT, TT(minutes), bool Save_data (0 == false).");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP mu = atof(argv[2]);
|
||||
@@ -30,10 +29,10 @@ int main(int argc, const char* argv[])
|
||||
int Max_Secs = 60 * atoi(argv[5]);
|
||||
bool Save_data = bool(atoi(argv[6]));
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (Omega <= 0.0) JSCerror("Give a strictly positive Omega, otherwise the algorithm cannot converge.");
|
||||
if (kBT <= 0.0) JSCerror("Negative T ? You must be a string theorist.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (Omega <= 0.0) ABACUSerror("Give a strictly positive Omega, otherwise the algorithm cannot converge.");
|
||||
if (kBT <= 0.0) ABACUSerror("Negative T ? You must be a string theorist.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Analyze_RAW_File.cc
|
||||
|
||||
Purpose: give some statistics for the matrix element distribution in a raw file.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 4) {
|
||||
if (argc != 4) {
|
||||
cout << "Argument needed: rawfile, iKmin, iKmax." << endl;
|
||||
JSCerror("");
|
||||
ABACUSerror("");
|
||||
}
|
||||
|
||||
const char* rawfilename = argv[1];
|
||||
@@ -33,7 +33,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.open(rawfilename);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
DP omega;
|
||||
@@ -72,7 +72,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
RAW_infile.close();
|
||||
|
||||
cout << "Inverse participation ratio: \t" << sumFF4/(sumFFsq*sumFFsq) << endl;
|
||||
cout << "Inverse participation ratio: \t" << sumFF4/(sumFFsq*sumFFsq) << endl;
|
||||
// Entropy is -sum (FFsq/sumFFsq) * ln(FFsq/sumFFsq) = sum (FFsq lnFFsq - FFsq ln sumFFsq)/sumFFsq
|
||||
cout << "Entropy: \t" << -(sumFFsqlnFFsq - sumFFsq * log(sumFFsq))/sumFFsq << endl;
|
||||
|
||||
|
||||
+16
-17
@@ -2,24 +2,24 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Check_RAW_File.cc
|
||||
|
||||
Purpose: from a .raw_srt file, check that nonzero momentum states
|
||||
Purpose: from a .raw_srt file, check that nonzero momentum states
|
||||
appear (only) twice, and zero momentum ones (only) once.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 7) { // print out some instructions
|
||||
cout << "Usage of Check_RAW_File executable: provide the following arguments:" << endl;
|
||||
@@ -29,7 +29,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
char* rawfilename = argv[1];
|
||||
int iKmin = atoi(argv[2]);
|
||||
int iKmax = atoi(argv[3]);
|
||||
int iKmax = atoi(argv[3]);
|
||||
int sympoint = atoi(argv[4]);
|
||||
DP FFmin = atof(argv[5]);
|
||||
int check_option = atoi(argv[6]);
|
||||
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.open(rawfilename);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open sorted RAW_infile... ");
|
||||
ABACUSerror("Could not open sorted RAW_infile... ");
|
||||
}
|
||||
|
||||
DP omega_next, omega, omega_prev;
|
||||
@@ -88,14 +88,14 @@ int main(int argc, char* argv[])
|
||||
// << omega_next << "\t" << iK_next << "\t" << FF_next << "\t" << label_next << endl;
|
||||
line++;
|
||||
|
||||
if (label.compare(label_next) == 0)
|
||||
if (label.compare(label_next) == 0)
|
||||
cout << "Identical labels around line " << line << ": " << endl
|
||||
<< omega << "\t" << iK << "\t" << FF << "\t" << dev << "\t" << label << endl;
|
||||
|
||||
if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
|
||||
if (check_option == 0 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
&& fabs((FF - FF_prev)/(FF + FF_prev)) > 1.0e-6 && fabs((FF - FF_next)/(FF + FF_next)) > 1.0e-6) {
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
//<< omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << conv_prev << "\t" << label_prev << endl
|
||||
<< omega_prev << "\t" << iK_prev << "\t" << FF_prev << "\t" << dev_prev << "\t" << label_prev << endl
|
||||
//<< omega << "\t" << iK << "\t" << FF << "\t" << conv << "\t" << label << endl
|
||||
@@ -119,10 +119,10 @@ int main(int argc, char* argv[])
|
||||
cin >> a;
|
||||
}
|
||||
|
||||
if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
if (check_option == 2 && iK != 0 && iK != sympoint && iK >= iKmin && iK <= iKmax
|
||||
&& fabs((omega - omega_prev)/(omega + omega_prev)) > 1.0e-6 && fabs((omega - omega_next)/(omega + omega_next)) > 1.0e-6) {
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
|
||||
cout << "State missing around line " << line << ": " << endl
|
||||
<< omega_prev << "\t" << iK_prev << "\t" << dev_prev << "\t" << label_prev << endl
|
||||
<< omega << "\t" << iK << "\t" << dev << "\t" << label << endl
|
||||
<< omega_next << "\t" << iK_next << "\t" << dev_next << "\t" << label_next << endl;
|
||||
@@ -144,4 +144,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -1,29 +1,29 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for Heisenberg spin-1/2 chain
|
||||
Purpose: main function for ABACUS for Heisenberg spin-1/2 chain
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 8) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
@@ -81,7 +81,7 @@ int main(int argc, char* argv[])
|
||||
argsfile.open(argv[1]);
|
||||
if (argsfile.fail()) {
|
||||
cout << argv[1] << endl;
|
||||
JSCerror("Could not open arguments file.");
|
||||
ABACUSerror("Could not open arguments file.");
|
||||
}
|
||||
|
||||
char junk[256];
|
||||
@@ -134,9 +134,8 @@ int main(int argc, char* argv[])
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, Max_Secs, refine);
|
||||
}
|
||||
|
||||
else JSCerror("Wrong number of arguments to Heis_DSF executable.");
|
||||
else ABACUSerror("Wrong number of arguments to Heis_DSF executable.");
|
||||
*/
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_GeneralState.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for Heisenberg spin-1/2 chain
|
||||
Purpose: main function for ABACUS for Heisenberg spin-1/2 chain
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
|
||||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in Heis_DSF_GeneralState");
|
||||
}
|
||||
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
@@ -111,7 +111,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
|
||||
AveragingState.Compute_All(true);
|
||||
|
||||
|
||||
// Perform the scan:
|
||||
Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
AveragingState.Set_Label_from_Ix2(AveragingState.Ix2);
|
||||
AveragingState.Compute_All(true);
|
||||
|
||||
|
||||
// Perform the scan:
|
||||
Scan_Heis (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
}
|
||||
@@ -130,4 +130,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
+19
-21
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc != 8) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
|
||||
@@ -56,21 +55,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time + 300) JSCerror("Please allow more time in Heis_DSF_par.");
|
||||
if (Max_Secs <= supercycle_time + 300) ABACUSerror("Please allow more time in Heis_DSF_par.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
// IMPORTANT PRECONDITION: no flags are being raised in General_Scan in parallel mode, so
|
||||
// the preinitializing serial run must be extensive enough to have flagged all base/type s necessary.
|
||||
|
||||
@@ -83,30 +82,30 @@ int main(int argc, char *argv[])
|
||||
if (rank == 0)
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, nr_processors);
|
||||
|
||||
|
||||
//cout << "rank " << rank << " done preparing, ready to scan." << endl;
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
|
||||
supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
|
||||
//cout << "rank " << rank << " finished scanning, reached wrapup stage." << endl;
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
if (rank == 0)
|
||||
// Now that everybody is done, digest data into unique files
|
||||
if (rank == 0)
|
||||
Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, nr_processors);
|
||||
|
||||
//cout << "rank " << rank << " passed wrapup stage." << endl;
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
@@ -117,4 +116,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par_Prepare executable: " << endl;
|
||||
cout << endl << "This function prepares for ABACUS++G in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function prepares for ABACUSG in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
|
||||
@@ -53,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 9 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Prepare.");
|
||||
if (argc != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -64,12 +63,11 @@ int main(int argc, char *argv[])
|
||||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par_Run.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par_Run executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the Heis_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
|
||||
@@ -56,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Run.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Run.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
@@ -69,12 +68,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in Heis_DSF_par_Run.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in Heis_DSF_par_Run.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
@@ -87,12 +86,12 @@ int main(int argc, char *argv[])
|
||||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
@@ -100,21 +99,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
|
||||
Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax,
|
||||
supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
@@ -124,4 +123,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Heis_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare or Wrapup
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Heis_DSF_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++G parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUSG parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
cout << "DP Delta \t\t Value of the anisotropy: use positive real values only" << endl;
|
||||
@@ -53,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 9 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
|
||||
if (argc != 9 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in Heis_DSF_par_Wrapup.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -64,12 +63,11 @@ int main(int argc, char *argv[])
|
||||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Wrapup_Parallel_Scan_Heis (whichDSF, Delta, N, M, iKmin, iKmax, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,13 +12,14 @@ Purpose: Produces sets of data files for correlations, increasing system size a
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include <omp.h>
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 7) { // provide some info
|
||||
@@ -45,7 +46,7 @@ int main(int argc, char* argv[])
|
||||
DP kBT = atof(argv[ia++]);
|
||||
DP target_sumrule = atof(argv[ia++]);
|
||||
int Max_Secs = atoi(argv[ia++]);
|
||||
|
||||
|
||||
|
||||
//clock_t StartTime = clock();
|
||||
double StartTime = omp_get_wtime();
|
||||
@@ -76,9 +77,9 @@ int main(int argc, char* argv[])
|
||||
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
SRC_stringstream << ".src";
|
||||
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
||||
|
||||
|
||||
fstream srcfile;
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
if (srcfile.fail()) {
|
||||
srsat = 0.0;
|
||||
refine = false;
|
||||
@@ -92,7 +93,7 @@ int main(int argc, char* argv[])
|
||||
ActualTime = omp_get_wtime();
|
||||
Secs_left = int(Max_Secs - (ActualTime - StartTime));
|
||||
|
||||
if (srsat < target_sumrule && Secs_left > Max_Secs/2)
|
||||
if (srsat < target_sumrule && Secs_left > Max_Secs/2)
|
||||
// Improve the icmin calculation by one chunk:
|
||||
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Secs_left, target_sumrule, refine);
|
||||
|
||||
@@ -107,10 +108,9 @@ int main(int argc, char* argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
} // while there is time
|
||||
} // while there is time
|
||||
|
||||
} // else if arguments given OK
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for LiebLin gas
|
||||
Purpose: main function for ABACUS for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 11) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -59,4 +59,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_GeneralState.cc
|
||||
|
||||
Purpose: function for ABACUS++ for LiebLin gas, on general states
|
||||
Purpose: function for ABACUS for LiebLin gas, on general states
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 11) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
|
||||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
@@ -83,10 +83,10 @@ int main(int argc, char* argv[])
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine, 0, 1);
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, Max_Secs, target_sumrule, refine);
|
||||
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
// int Max_Secs, DP target_sumrule, bool refine, int paralevel, Vect<int> rank, Vect<int> nr_processors)
|
||||
// Simplified function call of the above:
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
// int Max_Secs, DP target_sumrule, bool refine)
|
||||
Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine);
|
||||
|
||||
@@ -94,4 +94,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_GeneralState_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -29,9 +28,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
|
||||
cout << endl << "This function prepares an ABACUS++ parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -58,7 +57,7 @@ int main(int argc, char *argv[])
|
||||
iKmax = atoi(argv[n++]);
|
||||
//kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_GeneralState_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_GeneralState_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -83,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
@@ -98,9 +97,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_GeneralState_par_Run.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -29,9 +28,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -59,7 +58,7 @@ int main(int argc, char *argv[])
|
||||
iKmax = atoi(argv[n++]);
|
||||
//kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
@@ -72,14 +71,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= 120) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
if (Max_Secs <= 120) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
|
||||
int Max_Secs_used = Max_Secs - 120;
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
@@ -95,18 +94,18 @@ int main(int argc, char *argv[])
|
||||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
//cout << i << "\t" << Ix2_input[i] << endl;
|
||||
}
|
||||
|
||||
|
||||
// Now define the AveragingState
|
||||
LiebLin_Bethe_State AveragingState(c_int, L, N);
|
||||
AveragingState.Ix2 = Ix2_input;
|
||||
AveragingState.Compute_All(true);
|
||||
|
||||
|
||||
|
||||
Vect<int> rank (paralevel);
|
||||
Vect<int> nr_processors (paralevel);
|
||||
@@ -117,31 +116,31 @@ int main(int argc, char *argv[])
|
||||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
|
||||
|
||||
//while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
|
||||
if (Max_Secs_used > 0) {
|
||||
if (Max_Secs_used > 0) {
|
||||
|
||||
// Barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
// supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, AveragingState, defaultScanStatename, iKmin, iKmax, Max_Secs, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
} // while (tnow - tstart...
|
||||
@@ -150,4 +149,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -29,9 +28,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -58,7 +57,7 @@ int main(int argc, char *argv[])
|
||||
iKmax = atoi(argv[n++]);
|
||||
//kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -81,7 +80,7 @@ int main(int argc, char *argv[])
|
||||
Ix2_input_file.open(filename_Cstr);
|
||||
if (Ix2_input_file.fail()) {
|
||||
cout << filename_Cstr << endl;
|
||||
JSCerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
ABACUSerror("Could not open Ix2 input file in LiebLin_DSF_GeneralState");
|
||||
}
|
||||
for (int i = 0; i < N; ++i) {
|
||||
Ix2_input_file >> Ix2_input[i];
|
||||
@@ -93,12 +92,11 @@ int main(int argc, char *argv[])
|
||||
AveragingState.Ix2 = Ix2_input;
|
||||
//AveragingState.Compute_All(true);
|
||||
*/
|
||||
|
||||
|
||||
// Digest files into a unique one for the latest paralevel:
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for LiebLin gas
|
||||
Purpose: main function for ABACUS for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 13) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -31,8 +31,8 @@ int main(int argc, char* argv[])
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
//cout << "DP kBT \t\t Temperature (positive only of course)" << endl;
|
||||
cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
|
||||
@@ -81,4 +81,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc != 12) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int Max_Secs \t\t Allowed computational time: (in seconds)" << endl;
|
||||
cout << "int supercycle_time \t\t time for one supercycle (in seconds)" << endl;
|
||||
@@ -66,21 +65,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
@@ -106,27 +105,27 @@ int main(int argc, char *argv[])
|
||||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, MosesState, defaultScanStatename, iKmin, iKmax, supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
if (rank == 0)
|
||||
|
||||
if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
@@ -136,4 +135,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 12) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par_Prepare executable: " << endl;
|
||||
cout << endl << "This function prepares an ABACUS++ parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int paralevel" << endl;
|
||||
cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
|
||||
@@ -61,7 +60,7 @@ int main(int argc, char *argv[])
|
||||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 12 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -73,24 +72,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
||||
|
||||
// Split the sea:
|
||||
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
|
||||
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
|
||||
|
||||
|
||||
MosesState.Compute_All (true);
|
||||
|
||||
|
||||
// Handy default name:
|
||||
stringstream defaultScanStatename_strstream;
|
||||
defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
|
||||
string defaultScanStatename = defaultScanStatename_strstream.str();
|
||||
|
||||
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 13) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par_Run executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int paralevel" << endl;
|
||||
cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
|
||||
@@ -62,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 13 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 13 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
@@ -75,12 +74,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
@@ -95,33 +94,33 @@ int main(int argc, char *argv[])
|
||||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
||||
|
||||
// Split the sea:
|
||||
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
|
||||
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
|
||||
|
||||
|
||||
MosesState.Compute_All (true);
|
||||
|
||||
|
||||
// Handy default name:
|
||||
stringstream defaultScanStatename_strstream;
|
||||
defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
|
||||
string defaultScanStatename = defaultScanStatename_strstream.str();
|
||||
|
||||
|
||||
//cout << "rank " << rank_here << " out of " << nr_processors_here << " waiting at barrier." << endl;
|
||||
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
|
||||
while (tnow - tstart < Max_Secs - supercycle_time - 120) { // space for one more supercycle, + 2 minutes safety
|
||||
|
||||
@@ -129,27 +128,27 @@ int main(int argc, char *argv[])
|
||||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, MosesState, defaultScanStatename, iKmin, iKmax, supercycle_time, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
//if (rank == 0)
|
||||
|
||||
//if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
@@ -159,4 +158,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_MosesState_par_Wrapup.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -30,17 +29,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 12) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_MosesState_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers to scan over: recommended values: -2*N and 2*N" << endl;
|
||||
cout << "int paralevel" << endl;
|
||||
cout << "rank[i], nr_processors[i] \t rank and nr_processors of each earlier paralevels." << endl;
|
||||
@@ -61,7 +60,7 @@ int main(int argc, char *argv[])
|
||||
iKmin = atoi(argv[n++]);
|
||||
iKmax = atoi(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 12 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
if (argc != 12 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_MosesState_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -73,24 +72,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
|
||||
|
||||
// Split the sea:
|
||||
for (int i = 0; i < Nl; ++i) MosesState.Ix2[i] += 2 * DIl;
|
||||
for (int i = Nl; i < N; ++i) MosesState.Ix2[i] += 2 * DIr;
|
||||
|
||||
|
||||
MosesState.Compute_All (true);
|
||||
|
||||
|
||||
// Handy default name:
|
||||
stringstream defaultScanStatename_strstream;
|
||||
defaultScanStatename_strstream << "Moses_Nl_" << Nl << "_DIl_" << DIl << "_DIr_" << DIr;
|
||||
string defaultScanStatename = defaultScanStatename_strstream.str();
|
||||
|
||||
|
||||
|
||||
|
||||
// Digest files into a unique one for the latest paralevel:
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_over_Ensemble.cc
|
||||
|
||||
Purpose: main function for ABACUS++T for LiebLin gas, averaging over an Ensemble.
|
||||
Purpose: main function for ABACUS for LiebLin gas, averaging over an Ensemble.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -75,7 +75,7 @@ int main(int argc, char* argv[])
|
||||
// Now perform the DSF calculation over each state in the ensemble, distributing the time according to the weight
|
||||
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors)
|
||||
//Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, int(Max_Secs * ensemble.weight[ns]), 1.0e+6, refine, 0, 1);
|
||||
Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, int(Max_Secs * ensemble.weight[ns]), 1.0e+6, refine);
|
||||
@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
|
||||
Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
|
||||
FSR_string = FSR_stringstream.str(); const char* FSR_Cstr = FSR_string.c_str();
|
||||
|
||||
|
||||
DP Chem_Pot = 0.0;
|
||||
|
||||
Evaluate_F_Sumrule (whichDSF, c_int, L, N, kBT, ensemble.nstates, Chem_Pot, iKmin, iKmax, FSR_Cstr);
|
||||
@@ -96,4 +96,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,19 +12,19 @@ Purpose: main function for ABACUS for LiebLin gas, averaging over an Ensemble,
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_Tgt0 executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -53,16 +53,16 @@ int main(int argc, char* argv[])
|
||||
int Max_Secs = atoi(argv[8]);
|
||||
bool refine = (atoi(argv[9]) == 1);
|
||||
|
||||
if (refine == false) JSCerror("Please run the serial version of LiebLin_DSF_over_Ensemble first.");
|
||||
if (refine == false) ABACUSerror("Please run the serial version of LiebLin_DSF_over_Ensemble first.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
|
||||
// Start by constructing (or loading) the state ensemble.
|
||||
@@ -91,16 +91,16 @@ int main(int argc, char* argv[])
|
||||
|
||||
/* Original implementation: Scan always called serially. Superseded by version below, using successive parallel scans on each state in the ensemble.
|
||||
int nDSFperproc = ensemble.nstates/nr_processors + 1;
|
||||
//if (ensemble.nstates % nr_processors) JSCerror("Use nr_processors * integer multiple == ensemble.nstates in LiebLin_DSF_over_Ensemble_par.");
|
||||
|
||||
// Processor with rank r does all
|
||||
//if (ensemble.nstates % nr_processors) ABACUSerror("Use nr_processors * integer multiple == ensemble.nstates in LiebLin_DSF_over_Ensemble_par.");
|
||||
|
||||
// Processor with rank r does all
|
||||
|
||||
int ns;
|
||||
int Max_Secs_used = Max_Secs/nDSFperproc;
|
||||
|
||||
for (int ir = 0; ir < nDSFperproc; ++ir) {
|
||||
ns = rank + ir * nr_processors;
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//void Scan_LiebLin (char whichDSF, LiebLin_Bethe_State AveragingState, string defaultScanStatename, int iKmin, int iKmax,
|
||||
//int Max_Secs, DP target_sumrule, bool refine, int rank, int nr_processors)
|
||||
if (ns < ensemble.nstates) {
|
||||
//cout << "Processor rank " << rank << " going for ns = " << ns << " out of " << ensemble.nstates << endl;
|
||||
@@ -117,13 +117,13 @@ int main(int argc, char* argv[])
|
||||
|
||||
DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs_used <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
|
||||
if (Max_Secs_used <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
|
||||
|
||||
// Main loop over ensemble:
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
|
||||
tstart = MPI::Wtime();
|
||||
DP tnow = MPI::Wtime();
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
string defaultScanStatename = ensemble.state[ns].label;
|
||||
|
||||
@@ -133,31 +133,31 @@ int main(int argc, char* argv[])
|
||||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
//supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
Scan_LiebLin (whichDSF, ensemble.state[ns], ensemble.state[ns].label, iKmin, iKmax, supercycle_time, 1.0e+6, refine, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
if (rank == 0)
|
||||
|
||||
if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
|
||||
} // while (tnow - tstart...
|
||||
|
||||
} // for ns
|
||||
@@ -174,9 +174,9 @@ int main(int argc, char* argv[])
|
||||
Data_File_Name (FSR_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
FSR_stringstream << "_ns_" << ensemble.nstates << ".fsr";
|
||||
FSR_string = FSR_stringstream.str(); const char* FSR_Cstr = FSR_string.c_str();
|
||||
|
||||
|
||||
DP Chem_Pot = 0.0;
|
||||
|
||||
|
||||
Evaluate_F_Sumrule (whichDSF, c_int, L, N, kBT, ensemble.nstates, Chem_Pot, iKmin, iKmax, FSR_Cstr);
|
||||
}
|
||||
|
||||
@@ -188,4 +188,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -60,21 +59,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
//DP supercycle_time = 600.0; // allotted time per supercycle
|
||||
|
||||
if (Max_Secs <= supercycle_time) JSCerror("Please allow more time in LiebLin_DSF_par.");
|
||||
if (Max_Secs <= supercycle_time) ABACUSerror("Please allow more time in LiebLin_DSF_par.");
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
if (nr_processors < 2) JSCerror("Give at least 2 processors to ABACUS++ parallel !");
|
||||
if (nr_processors < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
@@ -86,27 +85,27 @@ int main(int argc, char *argv[])
|
||||
// Split up thread list into chunks, one per processor
|
||||
//Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
|
||||
// Barrier synchronization, to make sure other processes wait for process of rank 0
|
||||
// to have finished splitting up the thr file into pieces before starting:
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
supercycle_time, target_sumrule, refine, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// Now that everybody is done, digest data into unique files
|
||||
|
||||
if (rank == 0)
|
||||
|
||||
if (rank == 0)
|
||||
//Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, nr_processors);
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
@@ -116,4 +115,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Prepare.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Prepare executable: " << endl;
|
||||
cout << endl << "This function prepares an ABACUS++ parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function prepares an ABACUS parallel mode run, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -55,7 +54,7 @@ int main(int argc, char *argv[])
|
||||
iKmax = atoi(argv[n++]);
|
||||
kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Prepare.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -66,12 +65,11 @@ int main(int argc, char *argv[])
|
||||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Split up thread list into chunks, one per processor
|
||||
Prepare_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Run.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Run executable: " << endl;
|
||||
cout << endl << "This function runs ABACUS++ in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "This function runs ABACUS in parallel mode, starting from a preexisting serial run (obtained using the LiebLin_DSF executable) using the same model parameters." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -56,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
iKmax = atoi(argv[n++]);
|
||||
kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Run.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Run.");
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
for (int i = 0; i < paralevel - 1; ++i) {
|
||||
@@ -65,14 +64,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
Max_Secs = atoi(argv[n++]);
|
||||
|
||||
if (Max_Secs < 120) JSCerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
if (Max_Secs < 120) ABACUSerror("Please allow more time in LiebLin_DSF_par_Run.");
|
||||
|
||||
int Max_Secs_used = Max_Secs - 120;
|
||||
|
||||
MPI::Init(argc, argv);
|
||||
|
||||
|
||||
DP tstart = MPI::Wtime();
|
||||
|
||||
|
||||
int rank_here = MPI::COMM_WORLD.Get_rank();
|
||||
int nr_processors_here = MPI::COMM_WORLD.Get_size();
|
||||
|
||||
@@ -85,12 +84,12 @@ int main(int argc, char *argv[])
|
||||
rank[paralevel-1] = rank_here;
|
||||
nr_processors[paralevel-1] = nr_processors_here;
|
||||
|
||||
if (nr_processors_here < 2) JSCerror("Give at least 2 processors to ABACUS parallel !");
|
||||
if (nr_processors_here < 2) ABACUSerror("Give at least 2 processors to ABACUS parallel !");
|
||||
|
||||
refine = true;
|
||||
|
||||
// ASSUMPTION: preexisting files (raw, thr, ...) exist for the run.
|
||||
|
||||
|
||||
|
||||
DP tnow = MPI::Wtime();
|
||||
|
||||
@@ -100,21 +99,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
// then everybody gets going on their own chunk !
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
//Scan_LiebLin (whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded,
|
||||
Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT,
|
||||
Max_Secs_used, target_sumrule, refine, paralevel, rank, nr_processors);
|
||||
|
||||
// Another barrier synchronization
|
||||
|
||||
// Another barrier synchronization
|
||||
MPI_Barrier (MPI::COMM_WORLD);
|
||||
|
||||
|
||||
tnow = MPI::Wtime();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
MPI::Finalize();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,20 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_DSF_par_Wrapup.cc
|
||||
|
||||
Purpose: Parallel version of ABACUS++ using MPICH.
|
||||
|
||||
Purpose: Parallel version of ABACUS using MPICH.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
//#include "mpi.h" // not needed for Prepare or Wrapup
|
||||
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -28,9 +27,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc < 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_par_Wrapup executable: " << endl;
|
||||
cout << endl << "This function wraps up an ABACUS++ parallel mode run." << endl;
|
||||
cout << endl << "This function wraps up an ABACUS parallel mode run." << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
cout << "DP c_int \t\t Value of the interaction parameter: use positive real values only" << endl;
|
||||
@@ -55,7 +54,7 @@ int main(int argc, char *argv[])
|
||||
iKmax = atoi(argv[n++]);
|
||||
kBT = atof(argv[n++]);
|
||||
paralevel = atoi(argv[n++]); // paralevel == 1 means that we have one layer of parallelization, so no previous rank and nr_processors to specify
|
||||
if (argc != 10 + 2*(paralevel - 1)) JSCerror("Wrong nr of arguments in LiebLin_DSF_par_Wrapup.");
|
||||
if (argc != 10 + 2*(paralevel - 1)) ABACUSerror("Wrong nr of arguments in LiebLin_DSF_par_Wrapup.");
|
||||
|
||||
Vect<int> rank_lower_paralevels(paralevel - 1);
|
||||
Vect<int> nr_processors_lower_paralevels(paralevel - 1);
|
||||
@@ -66,12 +65,11 @@ int main(int argc, char *argv[])
|
||||
nr_processors_at_newlevel = atoi(argv[n++]);
|
||||
|
||||
string defaultScanStatename = "";
|
||||
|
||||
|
||||
// Digest files into a unique one for the latest paralevel:
|
||||
Wrapup_Parallel_Scan_LiebLin (whichDSF, c_int, L, N, iKmin, iKmax, kBT, defaultScanStatename, paralevel, rank_lower_paralevels, nr_processors_lower_paralevels, nr_processors_at_newlevel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,18 +12,18 @@ Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 6) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -42,10 +42,10 @@ int main(int argc, char* argv[])
|
||||
int N = atoi(argv[4]);
|
||||
DP kBT = atof(argv[5]);
|
||||
|
||||
//if (whichDSF != 'd') JSCerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
//if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
|
||||
// Delta is the number of sites involved in the smoothing of the entropy
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
|
||||
// Construct the finite-size saddle-point state:
|
||||
//LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
|
||||
@@ -73,11 +73,11 @@ int main(int argc, char* argv[])
|
||||
estate.Compute_All(false);
|
||||
cout << spstate << endl;
|
||||
cout << estate;
|
||||
if (whichDSF == 'd')
|
||||
if (whichDSF == 'd')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
|
||||
else if (whichDSF == 'o')
|
||||
else if (whichDSF == 'o')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
|
||||
else if (whichDSF == 'g')
|
||||
else if (whichDSF == 'g')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
|
||||
|
||||
//cout << "Another try ? (1 == yes, 0 == no)" << endl;
|
||||
@@ -89,4 +89,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,18 +12,18 @@ Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 6) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -42,10 +42,10 @@ int main(int argc, char* argv[])
|
||||
int N = atoi(argv[4]);
|
||||
DP kBT = atof(argv[5]);
|
||||
|
||||
//if (whichDSF != 'd') JSCerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
//if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in finite T Scan_LiebLin");
|
||||
|
||||
// Delta is the number of sites involved in the smoothing of the entropy
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
//int Delta = int(sqrt(N))/2;//6;//N/20;
|
||||
|
||||
// Construct the finite-size saddle-point state:
|
||||
//LiebLin_Bethe_State spstate = Canonical_Saddle_Point_State (c_int, L, N, kBT, Delta);
|
||||
@@ -73,11 +73,11 @@ int main(int argc, char* argv[])
|
||||
estate.Compute_All(false);
|
||||
cout << spstate << endl;
|
||||
cout << estate;
|
||||
if (whichDSF == 'd')
|
||||
if (whichDSF == 'd')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Density_ME(spstate, estate))) << endl;
|
||||
else if (whichDSF == 'o')
|
||||
else if (whichDSF == 'o')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(estate, spstate))) << endl;
|
||||
else if (whichDSF == 'g')
|
||||
else if (whichDSF == 'g')
|
||||
cout << setprecision(16) << "estate.E - spstate.E = " << estate.E - spstate.E << "\tME = " << real(exp(ln_Psi_ME(spstate, estate))) << endl;
|
||||
|
||||
cout << "Another try ? (1 == yes, 0 == no)" << endl;
|
||||
@@ -89,4 +89,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,13 +12,14 @@ Purpose: Produces sets of data files for correlations.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include <omp.h>
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 11) { // provide some info
|
||||
@@ -50,7 +51,7 @@ int main(int argc, char* argv[])
|
||||
DP kBT = atof(argv[ia++]);
|
||||
int Max_Hrs = atoi(argv[ia++]);
|
||||
|
||||
// Individual computations are split into chuncks of Max_Hrs/(Nc * 4)
|
||||
// Individual computations are split into chuncks of Max_Hrs/(Nc * 4)
|
||||
//int Max_Secs = (Max_Hrs * 900)/Nc;
|
||||
int Max_Secs = (Max_Hrs * 2700)/Nc; // to minimize wrapping up & restarting time
|
||||
|
||||
@@ -63,13 +64,13 @@ int main(int argc, char* argv[])
|
||||
double ActualTime = omp_get_wtime();
|
||||
|
||||
DP c_int;
|
||||
DP target_sumrule = 1.0;
|
||||
DP target_sumrule = 1.0;
|
||||
|
||||
//while (double(ActualTime - StartTime)/CLOCKS_PER_SEC < double(3600 * Max_Hrs - Max_Secs)) {
|
||||
while (ActualTime - StartTime < double(3600 * Max_Hrs - Max_Secs)) {
|
||||
|
||||
Vect<DP> srsat(0.0, Nc);
|
||||
Vect<bool> refine(false, Nc);
|
||||
Vect<bool> refine(false, Nc);
|
||||
DP srmin = 1.0;
|
||||
int icmin = 0;
|
||||
|
||||
@@ -80,9 +81,9 @@ int main(int argc, char* argv[])
|
||||
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
SRC_stringstream << ".src";
|
||||
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
||||
|
||||
|
||||
fstream srcfile;
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
if (srcfile.fail()) {
|
||||
srsat[ic] = 0.0;
|
||||
refine[ic] = false;
|
||||
@@ -97,9 +98,9 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
srcfile.close();
|
||||
|
||||
} // for ic
|
||||
} // for ic
|
||||
|
||||
cout << "srsat min found: " << srmin << "\t for c = " << c_int_max/pow(cfact, icmin) << ". Now refining this."
|
||||
cout << "srsat min found: " << srmin << "\t for c = " << c_int_max/pow(cfact, icmin) << ". Now refining this."
|
||||
//<< " Time left: " << 3600* Max_Hrs - (ActualTime - StartTime)/CLOCKS_PER_SEC << " seconds." << endl;
|
||||
<< " Time left: " << 3600* Max_Hrs - (ActualTime - StartTime) << " seconds." << endl;
|
||||
|
||||
@@ -109,7 +110,7 @@ int main(int argc, char* argv[])
|
||||
//ActualTime = clock();
|
||||
ActualTime = omp_get_wtime();
|
||||
|
||||
} // while there is time
|
||||
} // while there is time
|
||||
|
||||
cout << "Wrapping up, time's up." << endl;
|
||||
|
||||
@@ -117,4 +118,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,13 +12,14 @@ Purpose: Produces sets of data files for correlations, increasing system size a
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include <omp.h>
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 9) { // provide some info
|
||||
@@ -46,7 +47,7 @@ int main(int argc, char* argv[])
|
||||
DP kBT = atof(argv[ia++]);
|
||||
DP target_sumrule = atof(argv[ia++]);
|
||||
int Max_minutes = atoi(argv[ia++]);
|
||||
|
||||
|
||||
|
||||
//clock_t StartTime = clock();
|
||||
double StartTime = omp_get_wtime();
|
||||
@@ -57,7 +58,7 @@ int main(int argc, char* argv[])
|
||||
int Secs_left = 60* Max_minutes;
|
||||
|
||||
int iN = 0;
|
||||
|
||||
|
||||
while (Secs_left > 0) {
|
||||
|
||||
iN += 1;
|
||||
@@ -72,9 +73,9 @@ int main(int argc, char* argv[])
|
||||
Data_File_Name (SRC_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
SRC_stringstream << ".src";
|
||||
SRC_string = SRC_stringstream.str(); const char* SRC_Cstr = SRC_string.c_str();
|
||||
|
||||
|
||||
fstream srcfile;
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
srcfile.open(SRC_Cstr, fstream::in);
|
||||
if (srcfile.fail()) {
|
||||
srsat = 0.0;
|
||||
refine = false;
|
||||
@@ -95,10 +96,9 @@ int main(int argc, char* argv[])
|
||||
|
||||
cout << "Done with N = " << N << ". Time left = " << Secs_left << " seconds." << endl;
|
||||
|
||||
} // while there is time
|
||||
} // while there is time
|
||||
|
||||
} // else if arguments given OK
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: Compute the Q(x)^2 expectation value for LiebLin, where Q(x) = \int_0^
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_Qsqx executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -46,11 +46,11 @@ int main(int argc, char* argv[])
|
||||
// Force Npts_x
|
||||
//Npts_x = L;
|
||||
|
||||
if (whichDSF != 'd') JSCerror("Must use whichDSF == d in LiebLin_Fourier_ssf_to_Qsqx");
|
||||
if (whichDSF != 'd') ABACUSerror("Must use whichDSF == d in LiebLin_Fourier_ssf_to_Qsqx");
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// We also read the f-sumrule file, to correct for missing intensity.
|
||||
@@ -70,7 +70,7 @@ int main(int argc, char* argv[])
|
||||
FSR_infile.open(FSR_Cstr);
|
||||
if (FSR_infile.fail()) {
|
||||
cout << FSR_Cstr << endl;
|
||||
JSCerror("Could not open FSR_infile... ");
|
||||
ABACUSerror("Could not open FSR_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
||||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
@@ -100,7 +100,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.close();
|
||||
|
||||
// Reset proper normalization:
|
||||
DP normalization = twoPI * L;
|
||||
DP normalization = twoPI * L;
|
||||
for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
|
||||
|
||||
|
||||
@@ -121,15 +121,15 @@ int main(int argc, char* argv[])
|
||||
// Reset proper normalization: 1/L from space FT,
|
||||
FT[ix] *= 2.0*L/(PI * PI);
|
||||
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
|
||||
// so SSF becomes N/L.
|
||||
// We thus need to correct above by adding
|
||||
// \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
|
||||
// Resumming carefully:
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -47,11 +47,11 @@ int main(int argc, char* argv[])
|
||||
DP t_max = atof(argv[9]);
|
||||
|
||||
// Momentum business: use symmetry
|
||||
if (iKmin != 0) JSCerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// We also read the f-sumrule file, to correct for missing intensity.
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
||||
FSR_infile.open(FSR_Cstr);
|
||||
if (FSR_infile.fail()) {
|
||||
cout << FSR_Cstr << endl;
|
||||
JSCerror("Could not open FSR_infile... ");
|
||||
ABACUSerror("Could not open FSR_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
@@ -79,7 +79,7 @@ int main(int argc, char* argv[])
|
||||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open TFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
@@ -103,11 +103,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
while (RAW_infile.peek() != EOF) {
|
||||
RAW_infile >> omega >> iK >> FF >> dev >> label;
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += FF * FF * exp(II * omega * tlattice[it]);
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
|
||||
}
|
||||
RAW_infile.close();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -49,7 +49,7 @@ int main(int argc, char* argv[])
|
||||
DP t_max = atof(argv[9]);
|
||||
|
||||
// Momentum business: use symmetry
|
||||
if (iKmin != 0) JSCerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
if (iKmin != 0) ABACUSerror("LiebLin_Fourier_to_t_equal_x only implemented for raw files with iKmin == 0.");
|
||||
|
||||
ifstream RAW_infile;
|
||||
//RAW_infile.open(RAW_Cstr);
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
||||
if (RAW_infile.fail()) {
|
||||
//cout << RAW_Cstr << endl;
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char* argv[])
|
||||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open TFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open TFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
@@ -89,11 +89,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
while (RAW_infile.peek() != EOF) {
|
||||
RAW_infile >> omega >> iK >> FF >> dev >> label;
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
if (iK == 0)
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += FF * FF * exp(II * omega * tlattice[it]);
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
else
|
||||
for (int it = 0; it < Npts_t; ++it)
|
||||
FT[it] += 2.0 * FF * FF * exp(II * omega * tlattice[it]);
|
||||
}
|
||||
RAW_infile.close();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// We also read the f-sumrule file, to correct for missing intensity.
|
||||
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
|
||||
FSR_infile.open(FSR_Cstr);
|
||||
if (FSR_infile.fail()) {
|
||||
cout << FSR_Cstr << endl;
|
||||
JSCerror("Could not open FSR_infile... ");
|
||||
ABACUSerror("Could not open FSR_infile... ");
|
||||
}
|
||||
|
||||
stringstream SFT_stringstream; string SFT_string;
|
||||
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
|
||||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
@@ -98,7 +98,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.close();
|
||||
|
||||
// Reset proper normalization:
|
||||
DP normalization = twoPI * L;
|
||||
DP normalization = twoPI * L;
|
||||
for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
|
||||
|
||||
// We now refine the SSF in the following way.
|
||||
@@ -142,23 +142,23 @@ int main(int argc, char* argv[])
|
||||
FTre[ix] /= L;
|
||||
FTim[ix] /= L;
|
||||
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
|
||||
// so SSF becomes N/L.
|
||||
// We thus need to correct above by adding
|
||||
// \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
|
||||
// Resumming carefully:
|
||||
if (whichDSF == 'd') {
|
||||
FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
* N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
}
|
||||
}
|
||||
|
||||
// Since iKmax and iKmin are finite, we need to average over an interval of
|
||||
// Since iKmax and iKmin are finite, we need to average over an interval of
|
||||
// deltax such that (2\pi/L) iKmax deltax = 2\pi, with deltax == deltaix * L/Npts_x
|
||||
// so deltaix = (Npts_x/L) * (L/iKmax)
|
||||
// so deltaix = (Npts_x/L) * (L/iKmax)
|
||||
/*
|
||||
int deltaix = 0*int(Npts_x/(2.0*iKmax));
|
||||
cout << "deltaix = " << deltaix << endl;
|
||||
@@ -167,8 +167,8 @@ int main(int argc, char* argv[])
|
||||
Vect_DP FTimavg(0.0, Npts_x);
|
||||
for (int ix = 0; ix < Npts_x; ++ix) {
|
||||
for (int ix2 = -deltaix; ix2 < deltaix; ++ix2) {
|
||||
FTreavg[ix] += FTre[JSC::min(JSC::max(0, ix + ix2), Npts_x - 1)];
|
||||
FTimavg[ix] += FTim[JSC::min(JSC::max(0, ix + ix2), Npts_x - 1)];
|
||||
FTreavg[ix] += FTre[ABACUS::min(ABACUS::max(0, ix + ix2), Npts_x - 1)];
|
||||
FTimavg[ix] += FTim[ABACUS::min(ABACUS::max(0, ix + ix2), Npts_x - 1)];
|
||||
}
|
||||
FTreavg[ix] /= (2*deltaix + 1);
|
||||
FTimavg[ix] /= (2*deltaix + 1);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: Fourier transform to static space correlator for LiebLin.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_Fourier_to_x_equal_t executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -50,7 +50,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
//stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
//string prefix = filenameprefix.str();
|
||||
//string prefix = filenameprefix.str();
|
||||
|
||||
//stringstream RAW_stringstream; string RAW_string;
|
||||
//RAW_stringstream << prefix << ".raw";
|
||||
@@ -61,7 +61,7 @@ int main(int argc, char* argv[])
|
||||
if (RAW_infile.fail()) {
|
||||
//cout << RAW_Cstr << endl;
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
// Define the output file name: use the RAW file name but with different suffix
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
||||
SFT_string = SFT_stringstream.str(); const char* SFT_Cstr = SFT_string.c_str();
|
||||
ofstream SFT_outfile;
|
||||
SFT_outfile.open(SFT_Cstr);
|
||||
if (SFT_outfile.fail()) JSCerror("Could not open SFT_outfile... ");
|
||||
if (SFT_outfile.fail()) ABACUSerror("Could not open SFT_outfile... ");
|
||||
|
||||
// First compute the static structure factor from the RAW data:
|
||||
|
||||
@@ -93,7 +93,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.close();
|
||||
|
||||
// Reset proper normalization:
|
||||
DP normalization = twoPI * L;
|
||||
DP normalization = twoPI * L;
|
||||
for (int iK = 0; iK < iKmax - iKmin + 1; ++iK) SSF[iK] *= normalization/twoPI; // twoPI from integral over omega
|
||||
|
||||
|
||||
@@ -117,16 +117,16 @@ int main(int argc, char* argv[])
|
||||
FTre[ix] /= L;
|
||||
FTim[ix] /= L;
|
||||
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// Outside of window iKmin, iKmax, we take the DSF to be a constant with delta function
|
||||
// at free energy k^2, so DSF = 2\pi N/L \delta(\omega - k^2) (to fit f-sumrule)
|
||||
// so SSF becomes N/L.
|
||||
// We thus need to correct above by adding
|
||||
// \frac{1}{L} \sum_{-\infty}^{iKmin - 1} SSF e^{ikx} + \frac{1}{L} \sum_{iKmax + 1}^\infty SSF e^{ikx}
|
||||
// Resumming carefully:
|
||||
//if (whichDSF == 'd') {
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTre[ix] += (sin(twopioverL * (iKmin - 0.5) * xlattice[ix]) - sin(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
// * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
//FTim[ix] += (-cos(twopioverL * (iKmin - 0.5) * xlattice[ix]) + cos(twopioverL * (iKmax + 0.5) * xlattice[ix]))
|
||||
// * N/(2.0 * L*L * sin(PI * xlattice[ix]/L));
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,18 +12,18 @@ Purpose: allows for Ix2 manipulations (user-prompted) for LiebLin gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 8) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_DSF_tester executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -31,8 +31,8 @@ int main(int argc, char* argv[])
|
||||
cout << "DP L \t\t\t Length of the system: use positive real values only" << endl;
|
||||
cout << "int N \t\t\t Number of particles: use positive integer values only" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
}
|
||||
|
||||
else { // (argc == 6), correct nr of arguments
|
||||
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
|
||||
int DIl = atoi(argv[6]);
|
||||
int DIr = atoi(argv[7]);
|
||||
|
||||
if (whichDSF != 'd') JSCerror("Other options not implemented yet in LiebLin_Moses_tester");
|
||||
if (whichDSF != 'd') ABACUSerror("Other options not implemented yet in LiebLin_Moses_tester");
|
||||
|
||||
// Define the Moses state:
|
||||
LiebLin_Bethe_State MosesState (c_int, L, N);
|
||||
@@ -76,4 +76,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -13,18 +13,18 @@ Purpose: Analyzes the distribution of matrix element values in a RAW file,
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 9) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of LiebLin_RAW_File_Stats executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -46,7 +46,7 @@ int main(int argc, char* argv[])
|
||||
DP kBT = atof(argv[7]);
|
||||
int AgSize = atoi(argv[8]);
|
||||
|
||||
if (AgSize < 2) JSCerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
if (AgSize < 2) ABACUSerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
Data_File_Name (RAW_stringstream, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
||||
RAW_infile.open(RAW_Cstr);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << RAW_Cstr << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
stringstream STAT_stringstream; string STAT_string;
|
||||
@@ -66,9 +66,9 @@ int main(int argc, char* argv[])
|
||||
STAT_string = STAT_stringstream.str(); const char* STAT_Cstr = STAT_string.c_str();
|
||||
|
||||
ofstream STATfile;
|
||||
STATfile.open(STAT_Cstr);
|
||||
STATfile.open(STAT_Cstr);
|
||||
if (STATfile.fail()) {
|
||||
cout << STAT_Cstr << endl; JSCerror("Could not open STATfile.");
|
||||
cout << STAT_Cstr << endl; ABACUSerror("Could not open STATfile.");
|
||||
}
|
||||
|
||||
LiebLin_Bethe_State AveragingState = Canonical_Saddle_Point_State (c_int, L, N, whichDSF == 'Z' ? 0.0 : kBT);
|
||||
@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
|
||||
DP Chem_Pot = Chemical_Potential (AveragingState);
|
||||
//DP sumrule_factor = Sumrule_Factor (whichDSF, AveragingState, Chem_Pot, fixed_iK, iKneeded);
|
||||
Vect<DP> sumrule_factor(iKmax - iKmin + 1);
|
||||
for (int ik = 0; ik < iKmax - iKmin + 1; ++ik)
|
||||
for (int ik = 0; ik < iKmax - iKmin + 1; ++ik)
|
||||
sumrule_factor[ik] = Sumrule_Factor (whichDSF, AveragingState, Chem_Pot, ik, ik);
|
||||
// Normalize by total number of considered momenta
|
||||
DP correction_factor = 1.0/(iKmax - iKmin + 1);
|
||||
@@ -92,7 +92,7 @@ int main(int argc, char* argv[])
|
||||
DP ME;
|
||||
DP dev;
|
||||
string label;
|
||||
|
||||
|
||||
int nread = 0;
|
||||
|
||||
DP srcont = 0.0;
|
||||
@@ -106,11 +106,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
RAW_infile >> omega >> iK >> ME >> dev >> label;
|
||||
nread++;
|
||||
|
||||
|
||||
if (iK >= iKmin && iK <= iKmax) {
|
||||
srcont = omega * ME * ME * sumrule_factor[iK - iKmin];
|
||||
abssrcont = fabs(srcont);
|
||||
maxsrcont = JSC::max(maxsrcont, abssrcont);
|
||||
maxsrcont = ABACUS::max(maxsrcont, abssrcont);
|
||||
totsrcont += srcont;
|
||||
accumulatedsrcont += srcont;
|
||||
naccounted++;
|
||||
@@ -123,7 +123,7 @@ int main(int argc, char* argv[])
|
||||
totsrcont = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RAW_infile.close();
|
||||
STATfile.close();
|
||||
}
|
||||
@@ -131,4 +131,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,19 +10,18 @@ File: LiebLin_TBA.cc
|
||||
|
||||
Purpose: solves the TBA equations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
//if (argc != 7) JSCerror("Wrong number of arguments to 2CBG_ThLim executable. Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
|
||||
if (argc != 6) JSCerror("Wrong number of arguments. Use c(best to set to 1), mu, kBT, req_diff, Max_Secs");
|
||||
//if (argc != 7) ABACUSerror("Wrong number of arguments to 2CBG_ThLim executable. Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
|
||||
if (argc != 6) ABACUSerror("Wrong number of arguments. Use c(best to set to 1), mu, kBT, req_diff, Max_Secs");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP mu = atof(argv[2]);
|
||||
@@ -30,9 +29,9 @@ int main(int argc, const char* argv[])
|
||||
DP req_diff = atof(argv[4]);
|
||||
int Max_Secs = atoi(argv[5]);
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) JSCerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) ABACUSerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,19 +10,18 @@ File: LiebLin_TBA_fixed_nbar.cc
|
||||
|
||||
Purpose: solves the TBA equations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
//if (argc != 7) JSCerror("Wrong number of arguments to 2CBG_ThLim executable. Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
|
||||
if (argc != 6) JSCerror("Wrong number of arguments. Use c(best to set to 1), nbar, kBT, req_diff, Max_Secs");
|
||||
//if (argc != 7) ABACUSerror("Wrong number of arguments to 2CBG_ThLim executable. Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
|
||||
if (argc != 6) ABACUSerror("Wrong number of arguments. Use c(best to set to 1), nbar, kBT, req_diff, Max_Secs");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP nbar = atof(argv[2]);
|
||||
@@ -30,9 +29,9 @@ int main(int argc, const char* argv[])
|
||||
DP req_diff = atof(argv[4]);
|
||||
int Max_Secs = atoi(argv[5]);
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) JSCerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (kBT <= 0.0) ABACUSerror("Negative T ? Not for the LiebLin gas.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,18 +10,17 @@ File: LiebLin_TBA_fixed_nbar_ebar.cc
|
||||
|
||||
Purpose: solves the TBA equations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 7) JSCerror("Wrong number of arguments. Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
|
||||
if (argc != 7) ABACUSerror("Wrong number of arguments. Use c(best to set to 1), nbar, ebar, req_diff, Max_Secs, bool Save_data (0 == false).");
|
||||
|
||||
DP c_int = atof(argv[1]);
|
||||
DP nbar = atof(argv[2]);
|
||||
@@ -30,8 +29,8 @@ int main(int argc, const char* argv[])
|
||||
int Max_Secs = atoi(argv[5]);
|
||||
bool Save_data = bool(atoi(argv[6]));
|
||||
|
||||
if (c_int <= 0.0) JSCerror("Give a strictly positive c.");
|
||||
if (Max_Secs < 10) JSCerror("Give more time.");
|
||||
if (c_int <= 0.0) ABACUSerror("Give a strictly positive c.");
|
||||
if (Max_Secs < 10) ABACUSerror("Give more time.");
|
||||
|
||||
//cout << "Read c_int = " << c_int << "\tmu = " << mu << "\tOmega = " << Omega << "\tkBT = " << kBT << "\tMax_Secs = " << Max_Secs << endl;
|
||||
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ODSLF_DSF.cc
|
||||
|
||||
Purpose: main function for ABACUS++ for spinless fermions related to Heisenberg spin-1/2 chain
|
||||
Purpose: main function for ABACUS for spinless fermions related to Heisenberg spin-1/2 chain
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 10) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << "Usage of ODSLF_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: m for S- S+, z for Sz Sz, p for S+ S-." << endl;
|
||||
@@ -53,8 +53,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
|
||||
else JSCerror("Wrong number of arguments to ODSLF_DSF executable.");
|
||||
else ABACUSerror("Wrong number of arguments to ODSLF_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Sort_RAW_File.cc
|
||||
|
||||
Purpose: produce a sorted .raw file.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 4) {
|
||||
if (argc != 4) {
|
||||
cout << "Arguments needed: rawfile, whichDSF, whichsorting." << endl;
|
||||
JSCerror("");
|
||||
ABACUSerror("");
|
||||
}
|
||||
|
||||
const char* rawfilename = argv[1];
|
||||
|
||||
+13
-14
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -13,18 +13,18 @@ Purpose: Analyzes the distribution of matrix element values in a RAW file,
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc != 3) { // provide some info
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of RAW_File_Stats executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << endl << "string RAW file name" << endl;
|
||||
@@ -35,13 +35,13 @@ int main(int argc, char* argv[])
|
||||
const char* rawfilename = argv[1];
|
||||
int AgSize = atoi(argv[2]);
|
||||
|
||||
if (AgSize < 2) JSCerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
if (AgSize < 2) ABACUSerror("Give an aggregate size > 1 in LiebLin_RAW_File_Stats.");
|
||||
|
||||
ifstream RAW_infile;
|
||||
RAW_infile.open(rawfilename);
|
||||
if (RAW_infile.fail()) {
|
||||
cout << rawfilename << endl;
|
||||
JSCerror("Could not open RAW_infile... ");
|
||||
ABACUSerror("Could not open RAW_infile... ");
|
||||
}
|
||||
|
||||
stringstream STAT_stringstream; string STAT_string;
|
||||
@@ -49,9 +49,9 @@ int main(int argc, char* argv[])
|
||||
STAT_string = STAT_stringstream.str(); const char* STAT_Cstr = STAT_string.c_str();
|
||||
|
||||
ofstream STATfile;
|
||||
STATfile.open(STAT_Cstr);
|
||||
STATfile.open(STAT_Cstr);
|
||||
if (STATfile.fail()) {
|
||||
cout << STAT_Cstr << endl; JSCerror("Could not open STATfile.");
|
||||
cout << STAT_Cstr << endl; ABACUSerror("Could not open STATfile.");
|
||||
}
|
||||
|
||||
DP omega;
|
||||
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
|
||||
DP ME;
|
||||
DP dev;
|
||||
string label;
|
||||
|
||||
|
||||
int nread = 0;
|
||||
|
||||
DP srcont = 0.0;
|
||||
@@ -73,10 +73,10 @@ int main(int argc, char* argv[])
|
||||
|
||||
RAW_infile >> omega >> iK >> ME >> dev >> label;
|
||||
nread++;
|
||||
|
||||
|
||||
srcont = ME * ME;
|
||||
abssrcont = fabs(srcont);
|
||||
maxsrcont = JSC::max(maxsrcont, abssrcont);
|
||||
maxsrcont = ABACUS::max(maxsrcont, abssrcont);
|
||||
totsrcont += srcont;
|
||||
accumulatedsrcont += srcont;
|
||||
naccounted++;
|
||||
@@ -88,7 +88,7 @@ int main(int argc, char* argv[])
|
||||
totsrcont = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RAW_infile.close();
|
||||
STATfile.close();
|
||||
}
|
||||
@@ -96,4 +96,3 @@ int main(int argc, char* argv[])
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,13 +12,13 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13 && argc != 14) { // Print out instructions
|
||||
//if (strcmp(argv[1],"help") == 0) { // Output some instructions
|
||||
@@ -26,7 +26,7 @@ int main(int argc, char* argv[])
|
||||
cout << "Provide arguments using one of the following options:" << endl << endl;
|
||||
cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax DiK kBT ommin ommax Nom gwidth" << endl << endl;
|
||||
cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
|
||||
//else JSCerror("Incomprehensible arguments in Smoothen_Heis_DSF executable.");
|
||||
//else ABACUSerror("Incomprehensible arguments in Smoothen_Heis_DSF executable.");
|
||||
}
|
||||
|
||||
else if (argc == 13) { // !fixed_iK
|
||||
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, kBT, 0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
DP denom_sum_K = 1.0/N;
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, fixed_iK, iKneeded, 0.0, 0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
int iKmin = iKneeded;
|
||||
@@ -84,7 +84,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
*/
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
|
||||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
DP denom_sum_K = L;
|
||||
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
|
||||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
//sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
@@ -88,14 +88,14 @@ int main(int argc, char* argv[])
|
||||
DP ommax = atof(argv[8]);
|
||||
int Nom = atoi(argv[9]);
|
||||
DP gwidth = atof(argv[10]);
|
||||
|
||||
|
||||
//bool fixed_iK = true;
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 0.0);
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, iKneeded, iKneeded, 0.0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
int iKmin = iKneeded;
|
||||
@@ -105,7 +105,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
*/
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -67,7 +67,7 @@ int main(int argc, char* argv[])
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, defaultScanStatename);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
DP denom_sum_K = L;
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
||||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
//sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
@@ -97,14 +97,14 @@ int main(int argc, char* argv[])
|
||||
DP ommax = atof(argv[8]);
|
||||
int Nom = atoi(argv[9]);
|
||||
DP gwidth = atof(argv[10]);
|
||||
|
||||
|
||||
//bool fixed_iK = true;
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
//LiebLin_Bethe_State GroundState (c_int, L, N, iK_UL, 0LL);
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, fixed_iK, iKneeded, GroundState, GroundState);
|
||||
//Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, fixed_iK, iKneeded, 0.0);
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iK_UL, iKneeded, iKneeded, 0.0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
int iKmin = iKneeded;
|
||||
@@ -114,7 +114,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
*/
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 15) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF_MosesState executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -30,8 +30,8 @@ int main(int argc, char* argv[])
|
||||
cout << "DP L \t\t\t Length of the system" << endl;
|
||||
cout << "int N \t\t\t Number of particles" << endl;
|
||||
cout << "int Nl \t\t\t Number of particles in left Fermi sea (Nr is then N - Nl)" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int DIl \t\t shift of left sea as compared to its ground state position" << endl;
|
||||
cout << "int DIr \t\t shift of right sea as compared to its ground state position" << endl;
|
||||
cout << "int iKmin" << endl << "int iKmax \t\t Min and max momentum integers" << endl;
|
||||
//cout << "DP kBT \t\t Temperature" << endl;
|
||||
cout << "int DiK \t\t\t Window of iK over which DSF is averaged (DiK == 0 means a single iK is used; DiK == 1 means 3 are used (iK-1, iK, iK+1), etc.)" << endl;
|
||||
@@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
||||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, defaultScanStatename);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
|
||||
|
||||
@@ -84,14 +84,14 @@ int main(int argc, char* argv[])
|
||||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
//sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
//cout << "Smoothing: sumcheck = " << sumcheck << endl;
|
||||
}
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: produces .dsfs and .ssf files from a .raw file
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF_Scaled executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
|
||||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
//DP denom_sum_K = L;
|
||||
@@ -69,14 +69,14 @@ int main(int argc, char* argv[])
|
||||
// We use the scaled width function as default:
|
||||
|
||||
DP sumcheck;
|
||||
//if (kBT < 0.1)
|
||||
//if (kBT < 0.1)
|
||||
sumcheck = Smoothen_RAW_into_SF_LiebLin_Scaled (prefix, L, N, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization);
|
||||
//sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, DiK, ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
//else sumcheck = Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, width, normalization);
|
||||
//cout << "Smoothing: sumcheck = " << sumcheck << endl;
|
||||
}
|
||||
|
||||
//else JSCerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
//else ABACUSerror("Wrong number of arguments to Smoothen_LiebLin_DSF executable.");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,17 +12,17 @@ Purpose: produces .dsf and .ssf files from an ensemble of .raw files
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 13) { // Print out instructions
|
||||
|
||||
cout << endl << "Welcome to ABACUS++\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Welcome to ABACUS\t(copyright J.-S. Caux)." << endl;
|
||||
cout << endl << "Usage of Smoothen_LiebLin_DSF_over_Ensemble executable: " << endl;
|
||||
cout << endl << "Provide the following arguments:" << endl << endl;
|
||||
cout << "char whichDSF \t\t Which structure factor should be calculated ? Options are: d for rho rho, g for psi psi{dagger}, o for psi{dagger} psi" << endl;
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
}
|
||||
|
||||
else if (argc == 13) {
|
||||
else if (argc == 13) {
|
||||
char whichDSF = *argv[1];
|
||||
DP c_int = atof(argv[2]);
|
||||
DP L = atof(argv[3]);
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char* argv[])
|
||||
stringstream filenameprefix;
|
||||
//void Data_File_Name (stringstream& name, char whichDSF, DP c_int, DP L, int N, int iKmin, int iKmax, DP kBT, DP L2)
|
||||
Data_File_Name (filenameprefix, whichDSF, c_int, L, N, iKmin, iKmax, kBT, 0.0, "");
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI * L;
|
||||
DP denom_sum_K = L;
|
||||
@@ -85,16 +85,16 @@ int main(int argc, char* argv[])
|
||||
for (int ns = 0; ns < ensemble.nstates; ++ns) {
|
||||
// Define the raw input file name:
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
string prefix = filenameprefix.str();
|
||||
//Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
string prefix = filenameprefix.str();
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
//RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
||||
rawfilename[ns] = RAW_stringstream.str();
|
||||
}
|
||||
|
||||
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK,
|
||||
Smoothen_RAW_into_SF (prefix, rawfilename, ensemble.weight, iKmin, iKmax, DiK,
|
||||
ommin, ommax, Nom, width, normalization, denom_sum_K);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,13 +12,13 @@ Purpose: produces .dsf and .ssf files from a .raw file
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 10 && argc != 11) { // Print out instructions
|
||||
//if (strcmp(argv[1],"help") == 0) { // Output some instructions
|
||||
@@ -26,7 +26,7 @@ int main(int argc, char* argv[])
|
||||
cout << "Provide arguments using one of the following options:" << endl << endl;
|
||||
cout << "1) (for general momenta) whichDSF Delta N M iKmin iKmax ommin ommax Nom gwidth" << endl << endl;
|
||||
cout << "2) (for fixed momentum) whichDSF Delta N M iKneeded ommin ommax Nom gwidth" << endl << endl;
|
||||
//else JSCerror("Incomprehensible arguments in Smoothen_ODSLF_DSF executable.");
|
||||
//else ABACUSerror("Incomprehensible arguments in Smoothen_ODSLF_DSF executable.");
|
||||
}
|
||||
|
||||
else if (argc == 11) { // !fixed_iK
|
||||
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
stringstream filenameprefix;
|
||||
ODSLF_Data_File_Name (filenameprefix, whichDSF, Delta, N, M, iKmin, iKmax, 0.0, 0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
|
||||
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
stringstream filenameprefix;
|
||||
Data_File_Name (filenameprefix, whichDSF, Delta, N, M, fixed_iK, iKneeded, 0.0, 0);
|
||||
string prefix = filenameprefix.str();
|
||||
string prefix = filenameprefix.str();
|
||||
|
||||
DP normalization = twoPI;
|
||||
int iKmin = iKneeded;
|
||||
@@ -78,5 +78,5 @@ int main(int argc, char* argv[])
|
||||
cout << "Smoothing: sumcheck = " << Smoothen_RAW_into_SF (prefix, iKmin, iKmax, ommin, ommax, Nom, gwidth, normalization) << endl;
|
||||
}
|
||||
|
||||
else JSCerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
else ABACUSerror("Wrong number of arguments to Smoothen_Heis_DSF executable.");
|
||||
}
|
||||
|
||||
@@ -1,43 +1,42 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ABACUS++G_2_testing.cc
|
||||
|
||||
Purpose: testing of ABACUS++2
|
||||
File: XXZ_gpd_StagSz_h0.cc
|
||||
|
||||
Purpose: Compute the staggered magentization of XXZ_gpd in zero field.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
int main( int argc, char* argv[])
|
||||
int main( int argc, char* argv[])
|
||||
{
|
||||
if (!(argc == 3 || argc == 5)) { // provide some info
|
||||
cout << endl << "This code computes the (1/N) (-1)^j S^z_j on-site staggered magnetization for XXZ_gpd in zero field." << endl;
|
||||
cout << "First option: provide two arguments: anisotropy Delta (> 1) and system size N (even)." << endl;
|
||||
cout << "Second option: provide five arguments: system size N (even), Delta min, Delta max, NDelta." << endl;
|
||||
cout << "The output is Delta, N, stag mag, energy gap." << endl;
|
||||
JSCerror("");
|
||||
ABACUSerror("");
|
||||
}
|
||||
else if (argc == 3) {
|
||||
DP Delta = atof(argv[1]);
|
||||
if (Delta <= 1.0) JSCerror("Provide Delta > 1.");
|
||||
if (Delta <= 1.0) ABACUSerror("Provide Delta > 1.");
|
||||
int N = atoi(argv[2]);
|
||||
if (N % 2) JSCerror("Provide an even Delta.");
|
||||
if (N % 2) ABACUSerror("Provide an even Delta.");
|
||||
int M = N/2;
|
||||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Heis_Base gbase(chain, M);
|
||||
|
||||
XXZ_gpd_Bethe_State gstate(chain, gbase);
|
||||
@@ -54,9 +53,9 @@ int main( int argc, char* argv[])
|
||||
XXZ_gpd_Bethe_State estategap(chain, basegap);
|
||||
estategap.Compute_All(true);
|
||||
|
||||
if (!gstate.conv) JSCerror("Ground state did not converge.");
|
||||
if (!estate.conv) JSCerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) JSCerror("Gap state did not converge.");
|
||||
if (!gstate.conv) ABACUSerror("Ground state did not converge.");
|
||||
if (!estate.conv) ABACUSerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) ABACUSerror("Gap state did not converge.");
|
||||
|
||||
cout << Delta << "\t" << N << "\t" << setprecision(12) << exp(real(ln_Sz_ME (gstate, estate)))/sqrt(N) << "\t" << estategap.E - gstate.E << endl;
|
||||
|
||||
@@ -65,14 +64,14 @@ int main( int argc, char* argv[])
|
||||
else if (argc == 5) { // Do a scan in Delta
|
||||
|
||||
int N = atoi(argv[1]);
|
||||
if (N % 2) JSCerror("Provide an even Delta.");
|
||||
if (N % 2) ABACUSerror("Provide an even Delta.");
|
||||
int M = N/2;
|
||||
|
||||
DP Deltamin = atof(argv[2]);
|
||||
if (Deltamin <= 1.0) JSCerror("Provide Deltamin > 1.");
|
||||
if (Deltamin <= 1.0) ABACUSerror("Provide Deltamin > 1.");
|
||||
|
||||
DP Deltamax = atof(argv[3]);
|
||||
if (Deltamin <= 1.0) JSCerror("Provide Deltamax > Deltamin.");
|
||||
if (Deltamin <= 1.0) ABACUSerror("Provide Deltamax > Deltamin.");
|
||||
|
||||
int NDelta = atoi(argv[4]);
|
||||
|
||||
@@ -82,29 +81,29 @@ int main( int argc, char* argv[])
|
||||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Heis_Base gbase(chain, M);
|
||||
|
||||
|
||||
XXZ_gpd_Bethe_State gstate(chain, gbase);
|
||||
gstate.Compute_All(true);
|
||||
|
||||
|
||||
XXZ_gpd_Bethe_State estate(chain, gbase);
|
||||
estate.Ix2[0][0] = M+1; // umklapp excitation
|
||||
estate.Compute_All(true);
|
||||
|
||||
|
||||
stringstream basestrstream;
|
||||
basestrstream << M-2 << "x1";
|
||||
string basestr = basestrstream.str();
|
||||
Heis_Base basegap(chain, basestr);
|
||||
XXZ_gpd_Bethe_State estategap(chain, basegap);
|
||||
estategap.Compute_All(true);
|
||||
|
||||
if (!gstate.conv) JSCerror("Ground state did not converge.");
|
||||
if (!estate.conv) JSCerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) JSCerror("Gap state did not converge.");
|
||||
|
||||
|
||||
if (!gstate.conv) ABACUSerror("Ground state did not converge.");
|
||||
if (!estate.conv) ABACUSerror("Umklapp state did not converge.");
|
||||
if (!estategap.conv) ABACUSerror("Gap state did not converge.");
|
||||
|
||||
cout << Delta << "\t" << N << "\t" << setprecision(12) << exp(real(ln_Sz_ME (gstate, estate)))/sqrt(N) << "\t" << estategap.E - gstate.E << endl;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2007.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: mrqmin.cc
|
||||
File: covsrt.cc
|
||||
|
||||
Purpose: Nonlinear fitting
|
||||
|
||||
Last modified: 14/08/07
|
||||
Purpose: covsrt algorithm
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit)
|
||||
void covsrt (SQMat_DP& covar, Vect<bool>& ia, const int mfit)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,15 +10,13 @@ File: lin_reg.cc
|
||||
|
||||
Purpose: Linear regression
|
||||
|
||||
Last modified: 11/05/07
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void lin_reg (Vect_DP x, Vect_DP y, Vect_DP sigma, DP& a, DP& b, DP& chisq)
|
||||
{
|
||||
|
||||
+7
-9
@@ -1,26 +1,24 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2007.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: mrqmin.cc
|
||||
File: mrq.cc
|
||||
|
||||
Purpose: Nonlinear fitting
|
||||
|
||||
Last modified: 14/08/07
|
||||
Purpose: mrqmin and mrqcof algorithms
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
void mrqmin (Vect_DP& x, Vect_DP& y, Vect_DP& sig, Vect_DP& a,
|
||||
Vect<bool>& ia, SQMat_DP& covar, SQMat_DP& alpha, DP& chisq,
|
||||
void funcs(const DP, Vect_DP&, DP&, Vect_DP&), DP& alambda)
|
||||
{
|
||||
|
||||
+17
-3
@@ -1,7 +1,21 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: polint.cc
|
||||
|
||||
Purpose: Polynomial interpolation
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
|
||||
void ABACUS::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
|
||||
{
|
||||
// Polynomial interpolation/extrapolation, NR page 113.
|
||||
|
||||
@@ -25,7 +39,7 @@ void JSC::polint(Vect_DP& xa, Vect_DP& ya, const DP x, DP& y, DP& dy)
|
||||
ho = xa[i] - x;
|
||||
hp = xa[i+m] - x;
|
||||
w = c[i+1] - d[i];
|
||||
if ((den = ho-hp) == 0.0) JSCerror("Error in routine polint.");
|
||||
if ((den = ho-hp) == 0.0) ABACUSerror("Error in routine polint.");
|
||||
den = w/den;
|
||||
d[i] = hp * den;
|
||||
c[i] = ho * den;
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: polint_cx.cc
|
||||
|
||||
Purpose: Polynomial interpolation
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy)
|
||||
void ABACUS::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y, complex<DP>& dy)
|
||||
{
|
||||
// Polynomial interpolation/extrapolation, NR page 113.
|
||||
|
||||
@@ -26,7 +40,7 @@ void JSC::polint(Vect_CX& xa, Vect_CX& ya, const complex<DP> x, complex<DP>& y,
|
||||
ho = xa[i] - x;
|
||||
hp = xa[i+m] - x;
|
||||
w = c[i+1] - d[i];
|
||||
if ((den = ho-hp) == 0.0) JSCerror("Error in routine polint_cx.");
|
||||
if ((den = ho-hp) == 0.0) ABACUSerror("Error in routine polint_cx.");
|
||||
den = w/den;
|
||||
d[i] = hp * den;
|
||||
c[i] = ho * den;
|
||||
|
||||
+227
-228
File diff suppressed because it is too large
Load Diff
+23
-22
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,19 +10,20 @@ File: src/HEIS/Heis_Chem_Pot.cc
|
||||
|
||||
Purpose: calculates the chemical potential.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
using namespace std;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP Ezero (DP Delta, int N, int M)
|
||||
{
|
||||
// Returns the energy of the ground state with M down spins
|
||||
|
||||
if (M < 0 || M > N/2) JSCerror("M out of bounds in Ezero.");
|
||||
|
||||
if (M < 0 || M > N/2) ABACUSerror("M out of bounds in Ezero.");
|
||||
|
||||
DP E = -1.0; // sentinel value
|
||||
|
||||
if (M == 0) E = N * Delta/4.0;
|
||||
@@ -30,32 +31,32 @@ namespace JSC {
|
||||
else {
|
||||
|
||||
Heis_Chain BD1(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Vect_INT Nrapidities_groundstate(0, BD1.Nstrings);
|
||||
|
||||
|
||||
Nrapidities_groundstate[0] = M;
|
||||
|
||||
|
||||
Heis_Base baseconfig_groundstate(BD1, Nrapidities_groundstate);
|
||||
|
||||
|
||||
if ((Delta > 0.0) && (Delta < 1.0)) {
|
||||
XXZ_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta == 1.0) {
|
||||
XXX_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta > 1.0) {
|
||||
XXZ_gpd_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
else JSCerror("Anisotropy out of bounds in Ezero.");
|
||||
|
||||
else ABACUSerror("Anisotropy out of bounds in Ezero.");
|
||||
}
|
||||
|
||||
return(E);
|
||||
@@ -67,7 +68,7 @@ namespace JSC {
|
||||
|
||||
DP H = 0.0;
|
||||
|
||||
if (2*M == N) H = 0.0;
|
||||
if (2*M == N) H = 0.0;
|
||||
|
||||
else if (Delta <= 1.0) H = Ezero (Delta, N, M - 1) - Ezero (Delta, N, M);
|
||||
|
||||
@@ -78,7 +79,7 @@ namespace JSC {
|
||||
{
|
||||
if (M < 0 || M > N/2 - 1) {
|
||||
cout << "M = " << M << endl;
|
||||
JSCerror("M out of bounds in HZmin.");
|
||||
ABACUSerror("M out of bounds in HZmin.");
|
||||
}
|
||||
|
||||
if (Ezero_ref[M] == -1.0) Ezero_ref[M] = Ezero(Delta, N, M);
|
||||
@@ -91,7 +92,7 @@ namespace JSC {
|
||||
{
|
||||
// Returns the value of M for given field HZ
|
||||
|
||||
if (HZ < 0.0) JSCerror("Please use a positive field in M_vs_H.");
|
||||
if (HZ < 0.0) ABACUSerror("Please use a positive field in M_vs_H.");
|
||||
|
||||
else if (HZ == 0.0) return(N/2);
|
||||
|
||||
@@ -109,7 +110,7 @@ namespace JSC {
|
||||
if (HZ >= 1.0 + Delta) M_actual = 0; // saturation
|
||||
|
||||
else {
|
||||
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
@@ -117,15 +118,15 @@ namespace JSC {
|
||||
|
||||
if (HZmin_actual > HZ) M_actual += M_step;
|
||||
else if (HZmax_actual <= HZ) M_actual -= M_step;
|
||||
|
||||
|
||||
M_step = (M_step + 1)/2;
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
// << "\tHZmin_actual = " << HZmin_actual << "\tHZmax_actual = " << HZmax_actual << "\tHZ = " << HZ << "\t" << M_found << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,15 +10,14 @@ File: src/HEIS/Heis_Matrix_Element_Contrib.cc
|
||||
|
||||
Purpose: handles the generic call for a matrix element.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, XXZ_Bethe_State& LeftState,
|
||||
//XXZ_Bethe_State& RightState, DP Chem_Pot, fstream& DAT_outfile)
|
||||
@@ -50,7 +49,7 @@ namespace JSC {
|
||||
}
|
||||
else if (whichDSF == 'p')
|
||||
ME = exp(real(ln_Smin_ME (LeftState, RightState)));
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = 0.0;
|
||||
|
||||
@@ -157,7 +156,7 @@ namespace JSC {
|
||||
else if (whichDSF == 'q') // Geometric quench
|
||||
//ME_CX = ln_Overlap (LeftState, RightState);
|
||||
ME_CX = ln_Overlap (RightState, LeftState);
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = 0.0;
|
||||
if (is_nan(norm(ME_CX))) ME_CX = -100.0;
|
||||
@@ -254,7 +253,7 @@ namespace JSC {
|
||||
|
||||
sum1 = 0;
|
||||
for (int k = 0; k < LeftState.chain.Nstrings; ++k)
|
||||
sum1 += LeftState.base.Nrap[k] * (2 * JSC::min(LeftState.chain.Str_L[j], LeftState.chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
sum1 += LeftState.base.Nrap[k] * (2 * ABACUS::min(LeftState.chain.Str_L[j], LeftState.chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
// This almost does it: only missing are the states with one on -PI/2 and one on PI/2
|
||||
if (LeftState.base.Nrap[j] >= 1
|
||||
&& (LeftState.Ix2[j][0] <= -(LeftState.chain.Nsites - sum1)
|
||||
@@ -324,7 +323,7 @@ namespace JSC {
|
||||
}
|
||||
else if (whichDSF == 'p')
|
||||
ME = exp(real(ln_Smin_ME (LeftState, RightState)));
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = 0.0;
|
||||
|
||||
@@ -376,4 +375,4 @@ namespace JSC {
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+30
-31
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,14 +10,13 @@ File: src/HEIS/Heis_Sumrules.cc
|
||||
|
||||
Purpose: defines sumrule factors for Heisenberg
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
DP X_avg (char xyorz, DP Delta, int N, int M)
|
||||
{
|
||||
@@ -29,24 +28,24 @@ namespace JSC {
|
||||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
// Define the base: chain, Mdown
|
||||
Heis_Base gbase(chain, M);
|
||||
|
||||
// Define the chain: J, Delta, h, Nsites
|
||||
Heis_Chain chain2(1.0, Delta + eps_Delta, 0.0, N);
|
||||
|
||||
|
||||
// Define the base: chain, Mdown
|
||||
Heis_Base gbase2(chain2, M);
|
||||
|
||||
|
||||
DP E0_Delta = 0.0;
|
||||
DP E0_Delta_eps = 0.0;
|
||||
DP E0_Delta_eps = 0.0;
|
||||
|
||||
if (Delta > 0.0 && Delta < 1.0) {
|
||||
|
||||
// Define the ground state
|
||||
XXZ_Bethe_State gstate(chain, gbase);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate.Compute_All(true);
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace JSC {
|
||||
|
||||
// Define the ground state
|
||||
XXZ_Bethe_State gstate2(chain2, gbase2);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate2.Compute_All(true);
|
||||
|
||||
@@ -64,7 +63,7 @@ namespace JSC {
|
||||
else if (Delta == 1.0) {
|
||||
// Define the ground state
|
||||
XXX_Bethe_State gstate(chain, gbase);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate.Compute_All(true);
|
||||
|
||||
@@ -72,7 +71,7 @@ namespace JSC {
|
||||
|
||||
// Define the ground state
|
||||
XXZ_gpd_Bethe_State gstate2(chain2, gbase2); // need XXZ_gpd here
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate2.Compute_All(true);
|
||||
|
||||
@@ -82,7 +81,7 @@ namespace JSC {
|
||||
else if (Delta > 1.0) {
|
||||
// Define the ground state
|
||||
XXZ_gpd_Bethe_State gstate(chain, gbase);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate.Compute_All(true);
|
||||
|
||||
@@ -90,14 +89,14 @@ namespace JSC {
|
||||
|
||||
// Define the ground state
|
||||
XXZ_gpd_Bethe_State gstate2(chain2, gbase2);
|
||||
|
||||
|
||||
// Compute everything about the ground state
|
||||
gstate2.Compute_All(true);
|
||||
|
||||
E0_Delta_eps = gstate2.E;
|
||||
}
|
||||
|
||||
else JSCerror("Wrong anisotropy in S1_sumrule_factor.");
|
||||
else ABACUSerror("Wrong anisotropy in S1_sumrule_factor.");
|
||||
|
||||
DP answer = 0.0;
|
||||
//if (xyorz == 'x' || xyorz == 'y') answer = 0.5 * (E0_Delta - Delta * (E0_Delta_eps - E0_Delta)/eps_Delta);
|
||||
@@ -106,7 +105,7 @@ namespace JSC {
|
||||
// Careful for z ! Hamiltonian defined as S^z S^z - 1/4, so add back N/4:
|
||||
else if (xyorz == 'z') answer = (E0_Delta_eps - E0_Delta)/eps_Delta + 0.25 * N;
|
||||
|
||||
else JSCerror("option not implemented in X_avg.");
|
||||
else ABACUSerror("option not implemented in X_avg.");
|
||||
|
||||
return(answer);
|
||||
}
|
||||
@@ -129,7 +128,7 @@ namespace JSC {
|
||||
else if (mporz == 'b') sumrule = 1.0;
|
||||
else if (mporz == 'c') sumrule = 1.0;
|
||||
|
||||
else JSCerror("option not implemented in S1_sumrule_factor.");
|
||||
else ABACUSerror("option not implemented in S1_sumrule_factor.");
|
||||
|
||||
//return(1.0/sumrule);
|
||||
return(1.0/(sumrule + 1.0e-16)); // sumrule is 0 for iK == 0 or N
|
||||
@@ -153,7 +152,7 @@ namespace JSC {
|
||||
else if (mporz == 'b') sumrule = 1.0;
|
||||
else if (mporz == 'c') sumrule = 1.0;
|
||||
|
||||
else JSCerror("option not implemented in S1_sumrule_factor.");
|
||||
else ABACUSerror("option not implemented in S1_sumrule_factor.");
|
||||
|
||||
return(1.0/(sumrule + 1.0e-16)); // sumrule is 0 for iK == 0 or N
|
||||
}
|
||||
@@ -166,7 +165,7 @@ namespace JSC {
|
||||
//if (!fixed_iK) {
|
||||
if (iKmin != iKmax) {
|
||||
if (whichDSF == 'Z') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'm')
|
||||
else if (whichDSF == 'm')
|
||||
sumrule_factor = 1.0/AveragingState.base.Mdown;
|
||||
else if (whichDSF == 'z') sumrule_factor = 1.0/(0.25 * AveragingState.chain.Nsites);
|
||||
else if (whichDSF == 'p') sumrule_factor = 1.0/(AveragingState.chain.Nsites - AveragingState.base.Mdown);
|
||||
@@ -175,33 +174,33 @@ namespace JSC {
|
||||
else if (whichDSF == 'c') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'q') sumrule_factor = 1.0;
|
||||
|
||||
else JSCerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
}
|
||||
//else if (fixed_iK) {
|
||||
else if (iKmin == iKmax) {
|
||||
if (whichDSF == 'Z') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'm' || whichDSF == 'z' || whichDSF == 'p')
|
||||
else if (whichDSF == 'm' || whichDSF == 'z' || whichDSF == 'p')
|
||||
//sumrule_factor = S1_sumrule_factor (whichDSF, AveragingState.chain.Delta, AveragingState.chain.Nsites, AveragingState.base.Mdown, iKneeded);
|
||||
sumrule_factor = S1_sumrule_factor (whichDSF, AveragingState.chain.Delta, AveragingState.chain.Nsites, AveragingState.base.Mdown, Chem_Pot, iKmax);
|
||||
else if (whichDSF == 'a') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'b') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'c') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'q') sumrule_factor = 1.0;
|
||||
|
||||
else JSCerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
|
||||
else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return(sumrule_factor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Evaluate_F_Sumrule (string prefix, char whichDSF, const Heis_Bethe_State& AveragingState, DP Chem_Pot, int iKmin_ref, int iKmax_ref)
|
||||
{
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
||||
|
||||
stringstream FSR_stringstream; string FSR_string;
|
||||
@@ -210,15 +209,15 @@ namespace JSC {
|
||||
|
||||
ifstream infile;
|
||||
infile.open(RAW_Cstr);
|
||||
if(infile.fail()) JSCerror("Could not open raw input file in Evaluate_F_Sumrule(Heis...).");
|
||||
if(infile.fail()) ABACUSerror("Could not open raw input file in Evaluate_F_Sumrule(Heis...).");
|
||||
|
||||
int iKmin = 0;
|
||||
int iKmax = AveragingState.chain.Nsites;
|
||||
int iKmod = AveragingState.chain.Nsites;
|
||||
|
||||
// We run through the data file to chech the f sumrule at each positive momenta:
|
||||
//Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
//Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
Vect<DP> Sum_omega_MEsq(0.0, iKmax - iKmin + 1);
|
||||
|
||||
DP omega, ME;
|
||||
int iK, iKexc;
|
||||
@@ -252,4 +251,4 @@ namespace JSC {
|
||||
outfile.close();
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+23
-24
@@ -1,8 +1,8 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) 2006-9.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,21 +10,20 @@ File: M_vs_H.cc
|
||||
|
||||
Purpose: field to and from magnetization for Heisenberg
|
||||
|
||||
Last modified: 21/10/09
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
using namespace std;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP Ezero (DP Delta, int N, int M)
|
||||
{
|
||||
// Returns the energy of the ground state with M down spins
|
||||
|
||||
if (M < 0 || M > N/2) JSCerror("M out of bounds in Ezero.");
|
||||
|
||||
if (M < 0 || M > N/2) ABACUSerror("M out of bounds in Ezero.");
|
||||
|
||||
DP E = -1.0; // sentinel value
|
||||
|
||||
if (M == 0) E = N * Delta/4.0;
|
||||
@@ -32,32 +31,32 @@ namespace JSC {
|
||||
else {
|
||||
|
||||
Heis_Chain BD1(1.0, Delta, 0.0, N);
|
||||
|
||||
|
||||
Vect_INT Nrapidities_groundstate(0, BD1.Nstrings);
|
||||
|
||||
|
||||
Nrapidities_groundstate[0] = M;
|
||||
|
||||
|
||||
Heis_Base baseconfig_groundstate(BD1, Nrapidities_groundstate);
|
||||
|
||||
|
||||
if ((Delta > 0.0) && (Delta < 1.0)) {
|
||||
XXZ_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta == 1.0) {
|
||||
XXX_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
|
||||
else if (Delta > 1.0) {
|
||||
XXZ_gpd_Bethe_State groundstate(BD1, baseconfig_groundstate);
|
||||
groundstate.Compute_All(true);
|
||||
E = groundstate.E;
|
||||
}
|
||||
|
||||
else JSCerror("Anisotropy out of bounds in Ezero.");
|
||||
|
||||
else ABACUSerror("Anisotropy out of bounds in Ezero.");
|
||||
}
|
||||
|
||||
return(E);
|
||||
@@ -69,7 +68,7 @@ namespace JSC {
|
||||
|
||||
DP H = 0.0;
|
||||
|
||||
if (2*M == N) H = 0.0;
|
||||
if (2*M == N) H = 0.0;
|
||||
|
||||
else if (Delta <= 1.0) H = Ezero (Delta, N, M - 1) - Ezero (Delta, N, M);
|
||||
|
||||
@@ -80,7 +79,7 @@ namespace JSC {
|
||||
{
|
||||
if (M < 0 || M > N/2 - 1) {
|
||||
cout << "M = " << M << endl;
|
||||
JSCerror("M out of bounds in HZmin.");
|
||||
ABACUSerror("M out of bounds in HZmin.");
|
||||
}
|
||||
|
||||
if (Ezero_ref[M] == -1.0) Ezero_ref[M] = Ezero(Delta, N, M);
|
||||
@@ -93,7 +92,7 @@ namespace JSC {
|
||||
{
|
||||
// Returns the value of M for given field HZ
|
||||
|
||||
if (HZ < 0.0) JSCerror("Please use a positive field in M_vs_H.");
|
||||
if (HZ < 0.0) ABACUSerror("Please use a positive field in M_vs_H.");
|
||||
|
||||
else if (HZ == 0.0) return(N/2);
|
||||
|
||||
@@ -111,7 +110,7 @@ namespace JSC {
|
||||
if (HZ >= 1.0 + Delta) M_actual = 0; // saturation
|
||||
|
||||
else {
|
||||
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
@@ -119,15 +118,15 @@ namespace JSC {
|
||||
|
||||
if (HZmin_actual > HZ) M_actual += M_step;
|
||||
else if (HZmax_actual <= HZ) M_actual -= M_step;
|
||||
|
||||
|
||||
M_step = (M_step + 1)/2;
|
||||
|
||||
HZmin_actual = HZmin (Delta, N, M_actual, Ezero);
|
||||
HZmax_actual = HZmin (Delta, N, M_actual - 1, Ezero);
|
||||
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
M_found = (HZmin_actual < HZ && HZ <= HZmax_actual);
|
||||
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
//cout << "M_actual = " << M_actual << "\tM_step = " << M_step
|
||||
// << "\tHZmin_actual = " << HZmin_actual << "\tHZmax_actual = " << HZmax_actual << "\tHZ = " << HZ << "\t" << M_found << endl;
|
||||
}
|
||||
}
|
||||
|
||||
+80
-80
@@ -1,6 +1,6 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
@@ -12,11 +12,11 @@ Purpose: Defines all functions for XXX_Bethe_State
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function prototypes
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace JSC {
|
||||
|
||||
// Function definitions: class XXX_Bethe_State
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State ()
|
||||
XXX_Bethe_State::XXX_Bethe_State ()
|
||||
: Heis_Bethe_State()
|
||||
{};
|
||||
|
||||
@@ -35,22 +35,22 @@ namespace JSC {
|
||||
: Heis_Bethe_State(RefState)
|
||||
{
|
||||
}
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M)
|
||||
{
|
||||
if (RefChain.Delta != 1.0) {
|
||||
cout << setprecision(16) << RefChain.Delta << endl;
|
||||
JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
}
|
||||
}
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
|
||||
XXX_Bethe_State::XXX_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase)
|
||||
{
|
||||
if (RefChain.Delta != 1.0) {
|
||||
cout << setprecision(16) << RefChain.Delta << endl;
|
||||
JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -59,7 +59,7 @@ namespace JSC {
|
||||
{
|
||||
if (RefChain.Delta != 1.0) {
|
||||
cout << setprecision(16) << RefChain.Delta << endl;
|
||||
JSCerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
ABACUSerror("Delta != 1.0 in XXX_Bethe_State constructor");
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -104,13 +104,13 @@ namespace JSC {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool XXX_Bethe_State::Check_Admissibility(char option)
|
||||
{
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
|
||||
// and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
|
||||
|
||||
@@ -122,9 +122,9 @@ namespace JSC {
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
// The following line puts answer to true if there is at least one higher string with zero Ix2
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) && !(chain.Str_L[j] % 2))
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) && !(chain.Str_L[j] % 2))
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
// NOTE: if base[j] == 0, Zero_at_level[j] remains false.
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace JSC {
|
||||
// Checks that we have strings of equal length modulo 2 with Ix2 == 0, so equal rapidities, and inadmissibility
|
||||
for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
|
||||
for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
string_coincidence = true;
|
||||
}
|
||||
/*
|
||||
@@ -147,8 +147,8 @@ namespace JSC {
|
||||
|
||||
// Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
|
||||
if (!answer) {
|
||||
E = 0.0;
|
||||
@@ -170,15 +170,15 @@ namespace JSC {
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
|
||||
BE[j][alpha] = 2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
|
||||
@@ -190,18 +190,18 @@ namespace JSC {
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
|
||||
BE[j][alpha] = 2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ namespace JSC {
|
||||
{
|
||||
// Returns a new iteration value for lambda[j][alpha] given BE[j][alpha]
|
||||
|
||||
return(0.5 * chain.Str_L[j] * tan(0.5 *
|
||||
return(0.5 * chain.Str_L[j] * tan(0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
|
||||
(2.0 * atan(2.0 * lambda[j][alpha]/chain.Str_L[j]) - BE[j][alpha])
|
||||
));
|
||||
@@ -231,10 +231,10 @@ namespace JSC {
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX(lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
@@ -283,10 +283,10 @@ namespace JSC {
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan(lambda[j][alpha] - lambda[k][beta]);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXX((lambda[j][alpha] - lambda[k][beta]), chain.Str_L[j], chain.Str_L[k]);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ namespace JSC {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(*this).Build_Reduced_Gaudin_Matrix (Gaudin);
|
||||
|
||||
for (int i = 0; i < base.Nraptot; ++i) dlambda[i] = - RHSBAE[i];
|
||||
@@ -334,7 +334,7 @@ namespace JSC {
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) nonan *= !is_nan(lambda[j][alpha]);
|
||||
|
||||
|
||||
return nonan;
|
||||
}
|
||||
|
||||
@@ -362,48 +362,48 @@ namespace JSC {
|
||||
for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
|
||||
|
||||
ln_deltadiff = 0.0;
|
||||
|
||||
|
||||
for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if ((*this).chain.Str_L[j] > 1) { // else the BAE are already 1
|
||||
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0))
|
||||
/((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
log_BAE_reg += log((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
) - II );
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
log_BAE_reg -= log(((*this).lambda[j][alpha] + 0.5 * II * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
|
||||
)
|
||||
)
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
) + II );
|
||||
}
|
||||
|
||||
// The regular LHS of BAE is now defined. Now sum up the deltas...
|
||||
|
||||
|
||||
if (a == 1) ln_deltadiff[0] = - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
|
||||
|
||||
} // if ((*this).chain.Str_L[j] > 1)
|
||||
|
||||
|
||||
} // for (int a = 1; ...
|
||||
|
||||
for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
|
||||
deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
|
||||
delta += fabs(deltadiff[a]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // alpha sum
|
||||
} // j sum
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace JSC {
|
||||
void XXX_Bethe_State::Compute_Energy ()
|
||||
{
|
||||
DP sum = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
sum += chain.Str_L[j] / ( 4.0 * lambda[j][alpha] * lambda[j][alpha] + chain.Str_L[j] * chain.Str_L[j]);
|
||||
@@ -426,7 +426,7 @@ namespace JSC {
|
||||
}
|
||||
|
||||
sum *= - chain.J * 2.0;
|
||||
|
||||
|
||||
E = sum;
|
||||
|
||||
return;
|
||||
@@ -462,7 +462,7 @@ namespace JSC {
|
||||
void XXX_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
int index_jalpha;
|
||||
int index_kbeta;
|
||||
@@ -482,24 +482,24 @@ namespace JSC {
|
||||
|
||||
for (int kp = 0; kp < chain.Nstrings; ++kp) {
|
||||
for (int betap = 0; betap < base[kp]; ++betap) {
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXX
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXX
|
||||
+= ddlambda_Theta_XXX (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp]);
|
||||
}
|
||||
}
|
||||
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * chain.Str_L[j]/(lambda[j][alpha] * lambda[j][alpha] + 0.25 * chain.Str_L[j] * chain.Str_L[j])
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * chain.Str_L[j]/(lambda[j][alpha] * lambda[j][alpha] + 0.25 * chain.Str_L[j] * chain.Str_L[j])
|
||||
- sum_hbar_XXX);
|
||||
}
|
||||
|
||||
else {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> ( 2.0/(pow(lambda[j][alpha] - lambda[k][beta], 2.0) + 1.0));
|
||||
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> (ddlambda_Theta_XXX (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k]));
|
||||
}
|
||||
index_kbeta++;
|
||||
@@ -520,7 +520,7 @@ namespace JSC {
|
||||
if (fabs(lambda[j][alpha]) > 1.0e6) answer = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(answer);
|
||||
}
|
||||
|
||||
@@ -533,12 +533,12 @@ namespace JSC {
|
||||
DP result;
|
||||
|
||||
if ((nj == 1) && (nk == 1)) result = 2.0 * atan(lambda);
|
||||
|
||||
|
||||
else {
|
||||
|
||||
result = (nj == nk) ? 0.0 : 2.0 * atan(2.0 * lambda/fabs(nj - nk));
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 4.0 * atan(2.0 * lambda/(fabs(nj - nk) + 2*a));
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 4.0 * atan(2.0 * lambda/(fabs(nj - nk) + 2*a));
|
||||
|
||||
result += 2.0 * atan(2.0 * lambda/(nj + nk));
|
||||
}
|
||||
@@ -552,7 +552,7 @@ namespace JSC {
|
||||
|
||||
DP result = (nj == nk) ? 0.0 : DP(n)/(lambda * lambda + 0.25 * n * n);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * (n + 2.0*a)
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * (n + 2.0*a)
|
||||
/ (lambda * lambda + 0.25 * (n + 2.0*a) * (n + 2.0*a));
|
||||
|
||||
result += DP(nj + nk)/(lambda * lambda + 0.25 * (nj + nk) * (nj + nk));
|
||||
@@ -564,7 +564,7 @@ namespace JSC {
|
||||
{
|
||||
DP result = (nj == nk) ? 0.0 : DP(nj - nk)/(lambda * lambda + 0.25 * (nj - nk) * (nj - nk));
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a)
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a)
|
||||
/ (lambda * lambda + 0.25 * (nj - nk + 2.0*a) * (nj - nk + 2.0*a));
|
||||
|
||||
result += DP(nj + nk)/(lambda * lambda + 0.25 * (nj + nk) * (nj + nk));
|
||||
@@ -575,8 +575,8 @@ namespace JSC {
|
||||
|
||||
XXX_Bethe_State Add_Particle_at_Center (const XXX_Bethe_State& RefState)
|
||||
{
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] + 1;
|
||||
@@ -586,10 +586,10 @@ namespace JSC {
|
||||
XXX_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
|
||||
for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
|
||||
@@ -602,7 +602,7 @@ namespace JSC {
|
||||
XXX_Bethe_State Remove_Particle_at_Center (const XXX_Bethe_State& RefState)
|
||||
{
|
||||
if (RefState.base.Nrap[0] == 0)
|
||||
JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] - 1;
|
||||
@@ -612,7 +612,7 @@ namespace JSC {
|
||||
XXX_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Remove midmost and shift quantum numbers by half-integer towards removed one:
|
||||
@@ -622,5 +622,5 @@ namespace JSC {
|
||||
return(ReturnState);
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
+110
-110
@@ -1,6 +1,6 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
@@ -12,11 +12,11 @@ Purpose: Defines all functions for XXZ_Bethe_State
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function prototypes
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace JSC {
|
||||
|
||||
// Function definitions: class XXZ_Bethe_State
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinhlambda(Lambda(chain, 1)), coshlambda(Lambda(chain, 1)), tanhlambda(Lambda(chain, 1))
|
||||
XXZ_Bethe_State::XXZ_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinhlambda(Lambda(chain, 1)), coshlambda(Lambda(chain, 1)), tanhlambda(Lambda(chain, 1))
|
||||
{};
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const XXZ_Bethe_State& RefState) // copy constructor
|
||||
: Heis_Bethe_State(RefState), sinhlambda(Lambda(RefState.chain, RefState.base)), coshlambda(Lambda(RefState.chain, RefState.base)),
|
||||
: Heis_Bethe_State(RefState), sinhlambda(Lambda(RefState.chain, RefState.base)), coshlambda(Lambda(RefState.chain, RefState.base)),
|
||||
tanhlambda(Lambda(RefState.chain, RefState.base))
|
||||
{
|
||||
// copy arrays into new ones
|
||||
@@ -50,29 +50,29 @@ namespace JSC {
|
||||
}
|
||||
//cout << "Done calling XXZ state copy constructor." << endl;
|
||||
}
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
sinhlambda(Lambda(RefChain, M)), coshlambda(Lambda(RefChain, M)), tanhlambda(Lambda(RefChain, M))
|
||||
{
|
||||
//cout << "Here in XXZ BS constructor." << endl;
|
||||
//cout << (*this).lambda[0][0] << endl;
|
||||
//cout << "OK" << endl;
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
}
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase),
|
||||
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase),
|
||||
sinhlambda(Lambda(RefChain, RefBase)), coshlambda(Lambda(RefChain, RefBase)), tanhlambda(Lambda(RefChain, RefBase))
|
||||
{
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
}
|
||||
/*
|
||||
XXZ_Bethe_State::XXZ_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref)
|
||||
: Heis_Bethe_State(RefChain, base_id_ref, type_id_ref),
|
||||
sinhlambda(Lambda(chain, base)), coshlambda(Lambda(chain, base)), tanhlambda(Lambda(chain, base))
|
||||
{
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) JSCerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
if ((RefChain.Delta <= -1.0) || (RefChain.Delta >= 1.0)) ABACUSerror("Delta out of range in XXZ_Bethe_State constructor");
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -130,13 +130,13 @@ namespace JSC {
|
||||
lambda[i][alpha] = atanh(x/sqrt(1.0 + x*x)); // lambda then always initiated real
|
||||
}
|
||||
|
||||
else JSCerror("Invalid parities in Set_Free_lambdas.");
|
||||
else ABACUSerror("Invalid parities in Set_Free_lambdas.");
|
||||
//cout << tan(chain.Str_L[i] * 0.5 * chain.anis) << endl;
|
||||
//cout << "Set_Free_lambdas: " << i << "\t" << alpha << "\t" << lambda[i][alpha] << "\t" << tan(chain.Str_L[i] * 0.5 * chain.anis) * tan(PI * 0.5 * Ix2[i][alpha]/chain.Nsites) << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace JSC {
|
||||
|
||||
bool XXZ_Bethe_State::Check_Admissibility(char option)
|
||||
{
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
|
||||
// and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
|
||||
|
||||
@@ -179,9 +179,9 @@ namespace JSC {
|
||||
bool higher_string_on_zero = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
// The following line puts answer to true if there is at least one higher string with zero Ix2
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] >= 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] >= 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
// NOTE: if base[j] == 0, Zero_at_level[j] remains false.
|
||||
}
|
||||
|
||||
@@ -192,12 +192,12 @@ namespace JSC {
|
||||
bool string_coincidence = false;
|
||||
for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
|
||||
for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (chain.par[j1] == chain.par[j2]) && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (chain.par[j1] == chain.par[j2]) && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
string_coincidence = true;
|
||||
}
|
||||
|
||||
bool M_odd_and_onep_on_zero = false;
|
||||
if (option == 'z') { // for Sz, if M is odd, exclude symmetric states with a 1+ on zero
|
||||
if (option == 'z') { // for Sz, if M is odd, exclude symmetric states with a 1+ on zero
|
||||
// (zero rapidities in left and right states, so FF det not defined).
|
||||
bool is_ground_state = base.Nrap[0] == base.Mdown && Ix2[0][0] == -(base.Mdown - 1) && Ix2[0][base.Mdown-1] == base.Mdown - 1;
|
||||
if (Zero_at_level[0] && (base.Mdown % 2) && !is_ground_state) M_odd_and_onep_on_zero = true;
|
||||
@@ -212,8 +212,8 @@ namespace JSC {
|
||||
|
||||
// Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
|
||||
if (!answer) {
|
||||
E = 0.0;
|
||||
@@ -233,18 +233,18 @@ namespace JSC {
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < base[k]; ++beta) {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
: -2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]])) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
|
||||
}
|
||||
@@ -257,22 +257,22 @@ namespace JSC {
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int k = 0; k < chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < base[k]; ++beta) {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((tanhlambda[j][alpha] - tanhlambda[k][beta])/((1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((tanhlambda[j][alpha] - tanhlambda[k][beta])/(1.0 - tanhlambda[j][alpha] * tanhlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = ((chain.par[j] == 1) ? 2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
: -2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]])) - (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
|
||||
//if (is_nan(BE[j][alpha])) cout << "BE nan: " << j << "\t" << alpha << "\t" << lambda[j][alpha] << "\t" << tanhlambda[j][alpha] << endl;
|
||||
@@ -281,59 +281,59 @@ namespace JSC {
|
||||
|
||||
DP XXZ_Bethe_State::Iterate_BAE (int j, int alpha)
|
||||
{
|
||||
// Returns a new iteration value for lambda[j][alpha] given tanhlambda and BE Lambdas
|
||||
// Returns a new iteration value for lambda[j][alpha] given tanhlambda and BE Lambdas
|
||||
// Assumes that tanhlambda[][] and BE[][] have been computed.
|
||||
|
||||
DP new_lambda = 0.0;
|
||||
DP arg = 0.0;
|
||||
|
||||
if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]]
|
||||
* tan(0.5 *
|
||||
if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]]
|
||||
* tan(0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
|
||||
(2.0 * atan(tanhlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]]) - BE[j][alpha])
|
||||
);
|
||||
|
||||
else if (chain.par[j] == -1) arg = -tan(0.5 *
|
||||
|
||||
else if (chain.par[j] == -1) arg = -tan(0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites)
|
||||
(-2.0 * atan(tanhlambda[j][alpha] * chain.ta_n_anis_over_2[chain.Str_L[j]]) - BE[j][alpha]))
|
||||
/chain.ta_n_anis_over_2[chain.Str_L[j]];
|
||||
|
||||
|
||||
if (fabs(arg) < 1.0) {
|
||||
new_lambda = atanh(arg);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
new_lambda = lambda[j][alpha]; // back to drawing board...
|
||||
int block = 0; // counter to prevent runaway while loop
|
||||
int block = 0; // counter to prevent runaway while loop
|
||||
DP new_tanhlambda = 0.0;
|
||||
DP sumtheta = 0.0;
|
||||
arg = 10.0; // reset value to start while loop
|
||||
arg = 10.0; // reset value to start while loop
|
||||
while ((fabs(arg) > 1.0) && (block++ < 100)) { // recompute the diverging root on its own...
|
||||
new_lambda *= 1.01; // try to go slowly towards infinity...
|
||||
new_tanhlambda = tanh(new_lambda);
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((new_tanhlambda - tanhlambda[k][beta])/((1.0 - new_tanhlambda * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta]),
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += (chain.par[j] == chain.par[k])
|
||||
? atan((new_tanhlambda - tanhlambda[k][beta])/((1.0 - new_tanhlambda * tanhlambda[k][beta]) * chain.ta_n_anis_over_2[2]))
|
||||
: - atan(((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta])) * chain.ta_n_anis_over_2[2]) ;
|
||||
else sumtheta += 0.5 * Theta_XXZ((new_tanhlambda - tanhlambda[k][beta])/(1.0 - new_tanhlambda * tanhlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.par[j], chain.par[k], chain.ta_n_anis_over_2);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
if (chain.par[j] == 1) arg = chain.ta_n_anis_over_2[chain.Str_L[j]] * tan(0.5 * (PI * Ix2[j][alpha] + sumtheta)/chain.Nsites);
|
||||
|
||||
|
||||
else if (chain.par[j] == -1) arg = -tan(0.5 * (PI * Ix2[j][alpha] + sumtheta)/chain.Nsites)/chain.ta_n_anis_over_2[chain.Str_L[j]];
|
||||
|
||||
else JSCerror("Invalid parities in Iterate_BAE.");
|
||||
|
||||
else ABACUSerror("Invalid parities in Iterate_BAE.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (fabs(arg) < 1.0) {
|
||||
new_lambda = atanh(arg);
|
||||
}
|
||||
|
||||
|
||||
//else cout << "Rapidity blows up !\t" << lambda[j][alpha] << "\t" << new_lambda << endl;
|
||||
} // else
|
||||
|
||||
@@ -346,7 +346,7 @@ namespace JSC {
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) nonan *= !is_nan(lambda[j][alpha]);
|
||||
|
||||
|
||||
return nonan;
|
||||
}
|
||||
|
||||
@@ -360,8 +360,8 @@ namespace JSC {
|
||||
for (int i = 0; i < (*this).chain.Nstrings; ++i) if ((*this).chain.Str_L[i] > 1) occupied_strings += (*this).base.Nrap[i];
|
||||
|
||||
//if ((*this).conv == 0) delta = 1.0;
|
||||
|
||||
if (occupied_strings == 0) delta = 0.0;
|
||||
|
||||
if (occupied_strings == 0) delta = 0.0;
|
||||
|
||||
else {
|
||||
|
||||
@@ -369,56 +369,56 @@ namespace JSC {
|
||||
Vect_DP deltadiff(0.0, 1000); // contains |delta^{a, a+1}|
|
||||
|
||||
complex<DP> log_BAE_reg = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < (*this).chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
|
||||
|
||||
ln_deltadiff = 0.0;
|
||||
|
||||
|
||||
for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if ((*this).chain.Str_L[j] > 1) { // else the BAE are already 1
|
||||
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sinh((*this).lambda[j][alpha]
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sinh((*this).lambda[j][alpha]
|
||||
+ 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
/sinh((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j])));
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
log_BAE_reg += log(sinh(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[k])) - II * (*this).chain.anis));
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
log_BAE_reg -= log(sinh(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[j]))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b )
|
||||
+ 0.25 * II * PI * (1.0 - (*this).chain.par[k])) + II * (*this).chain.anis));
|
||||
}
|
||||
|
||||
// The regular LHS of BAE is now defined. Now sum up the deltas...
|
||||
|
||||
|
||||
if (a == 1) ln_deltadiff[0] = - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
|
||||
|
||||
} // if ((*this).chain.Str_L[j] > 1)
|
||||
|
||||
|
||||
} // for (int a = 1; ...
|
||||
|
||||
for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
|
||||
deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
|
||||
delta += fabs(deltadiff[a]);
|
||||
}
|
||||
}
|
||||
|
||||
} // alpha sum
|
||||
} // j sum
|
||||
@@ -434,7 +434,7 @@ namespace JSC {
|
||||
void XXZ_Bethe_State::Compute_Energy ()
|
||||
{
|
||||
DP sum = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
sum += sin(chain.Str_L[j] * chain.anis) / (chain.par[j] * cosh(2.0 * lambda[j][alpha]) - cos(chain.Str_L[j] * chain.anis));
|
||||
@@ -442,7 +442,7 @@ namespace JSC {
|
||||
}
|
||||
|
||||
sum *= - chain.J * sin(chain.anis);
|
||||
|
||||
|
||||
E = sum;
|
||||
|
||||
return;
|
||||
@@ -477,7 +477,7 @@ namespace JSC {
|
||||
void XXZ_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
int index_jalpha;
|
||||
int index_kbeta;
|
||||
@@ -502,26 +502,26 @@ namespace JSC {
|
||||
|
||||
for (int kp = 0; kp < chain.Nstrings; ++kp) {
|
||||
for (int betap = 0; betap < base[kp]; ++betap) {
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp], chain.par[j], chain.par[kp],
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp], chain.par[j], chain.par[kp],
|
||||
chain.si_n_anis_over_2);
|
||||
}
|
||||
}
|
||||
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * hbar_XXZ (lambda[j][alpha], chain.Str_L[j], chain.par[j], chain.si_n_anis_over_2) - sum_hbar_XXZ);
|
||||
}
|
||||
|
||||
else {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> ((chain.par[j] * chain.par[k] == 1)
|
||||
? chain.si_n_anis_over_2[4]/(pow(sinhlambda[j][alpha] * coshlambda[k][beta]
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> ((chain.par[j] * chain.par[k] == 1)
|
||||
? chain.si_n_anis_over_2[4]/(pow(sinhlambda[j][alpha] * coshlambda[k][beta]
|
||||
- coshlambda[j][alpha] * sinhlambda[k][beta], 2.0) + sinzetasq)
|
||||
: chain.si_n_anis_over_2[4]/(-pow(coshlambda[j][alpha] * coshlambda[k][beta]
|
||||
: chain.si_n_anis_over_2[4]/(-pow(coshlambda[j][alpha] * coshlambda[k][beta]
|
||||
- sinhlambda[j][alpha] * sinhlambda[k][beta], 2.0) + sinzetasq) );
|
||||
else
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j], chain.Str_L[k],
|
||||
chain.par[j], chain.par[k], chain.si_n_anis_over_2));
|
||||
}
|
||||
@@ -546,7 +546,7 @@ namespace JSC {
|
||||
|
||||
else if (par == -1) result = -2.0 * atan(tanhlambda * tannzetaover2);
|
||||
|
||||
else JSCerror("Faulty parity in fbar_XXZ.");
|
||||
else ABACUSerror("Faulty parity in fbar_XXZ.");
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -556,12 +556,12 @@ namespace JSC {
|
||||
DP result = 0.0;
|
||||
|
||||
if ((nj == 1) && (nk == 1)) result = fbar_XXZ(tanhlambda, parj*park, tannzetaover2[2]);
|
||||
|
||||
|
||||
else {
|
||||
|
||||
result = (nj == nk) ? 0.0 : fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk)]);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk) + 2*a]);
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * fbar_XXZ(tanhlambda, parj*park, tannzetaover2[fabs(nj - nk) + 2*a]);
|
||||
|
||||
result += fbar_XXZ(tanhlambda, parj*park, tannzetaover2[nj + nk]);
|
||||
}
|
||||
@@ -577,16 +577,16 @@ namespace JSC {
|
||||
|
||||
else if (par == -1) result = si_n_anis_over_2[2*n]/(-pow(cosh(lambda), 2.0) + pow(si_n_anis_over_2[n], 2.0));
|
||||
|
||||
else JSCerror("Faulty parity in hbar_XXZ.");
|
||||
else ABACUSerror("Faulty parity in hbar_XXZ.");
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
DP ddlambda_Theta_XXZ (DP lambda, int nj, int nk, int parj, int park, DP* si_n_anis_over_2)
|
||||
{
|
||||
DP result = (nj == nk) ? 0.0 : hbar_XXZ(lambda, fabs(nj - nk), parj*park, si_n_anis_over_2);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * hbar_XXZ(lambda, fabs(nj - nk) + 2*a, parj*park, si_n_anis_over_2);
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * hbar_XXZ(lambda, fabs(nj - nk) + 2*a, parj*park, si_n_anis_over_2);
|
||||
|
||||
result += hbar_XXZ(lambda, nj + nk, parj*park, si_n_anis_over_2);
|
||||
|
||||
@@ -596,8 +596,8 @@ namespace JSC {
|
||||
|
||||
XXZ_Bethe_State Add_Particle_at_Center (const XXZ_Bethe_State& RefState)
|
||||
{
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] + 1;
|
||||
@@ -607,10 +607,10 @@ namespace JSC {
|
||||
XXZ_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
|
||||
for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
|
||||
@@ -623,7 +623,7 @@ namespace JSC {
|
||||
XXZ_Bethe_State Remove_Particle_at_Center (const XXZ_Bethe_State& RefState)
|
||||
{
|
||||
if (RefState.base.Nrap[0] == 0)
|
||||
JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] - 1;
|
||||
@@ -633,7 +633,7 @@ namespace JSC {
|
||||
XXZ_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Remove midmost and shift quantum numbers by half-integer towards removed one:
|
||||
@@ -642,5 +642,5 @@ namespace JSC {
|
||||
|
||||
return(ReturnState);
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
+127
-128
@@ -1,6 +1,6 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
@@ -12,12 +12,11 @@ Purpose: Defines all functions for XXZ_gpd_Bethe_State
|
||||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Function prototypes
|
||||
|
||||
@@ -31,14 +30,14 @@ namespace JSC {
|
||||
|
||||
// Function definitions: class XXZ_gpd_Bethe_State
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinlambda(Lambda(chain, 1)), coslambda(Lambda(chain, 1)), tanlambda(Lambda(chain, 1))
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State ()
|
||||
: Heis_Bethe_State(), sinlambda(Lambda(chain, 1)), coslambda(Lambda(chain, 1)), tanlambda(Lambda(chain, 1))
|
||||
{};
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const XXZ_gpd_Bethe_State& RefState) // copy constructor
|
||||
: Heis_Bethe_State(RefState),
|
||||
sinlambda(Lambda(RefState.chain, RefState.base)), coslambda(Lambda(RefState.chain, RefState.base)),
|
||||
tanlambda(Lambda(RefState.chain, RefState.base))
|
||||
: Heis_Bethe_State(RefState),
|
||||
sinlambda(Lambda(RefState.chain, RefState.base)), coslambda(Lambda(RefState.chain, RefState.base)),
|
||||
tanlambda(Lambda(RefState.chain, RefState.base))
|
||||
{
|
||||
// copy arrays into new ones
|
||||
|
||||
@@ -50,27 +49,27 @@ namespace JSC {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, int M)
|
||||
: Heis_Bethe_State(RefChain, M),
|
||||
sinlambda(Lambda(RefChain, M)), coslambda(Lambda(RefChain, M)), tanlambda(Lambda(RefChain, M))
|
||||
{
|
||||
if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
}
|
||||
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, const Heis_Base& RefBase)
|
||||
: Heis_Bethe_State(RefChain, RefBase),
|
||||
sinlambda(Lambda(RefChain, RefBase)), coslambda(Lambda(RefChain, RefBase)),
|
||||
tanlambda(Lambda(RefChain, RefBase))
|
||||
sinlambda(Lambda(RefChain, RefBase)), coslambda(Lambda(RefChain, RefBase)),
|
||||
tanlambda(Lambda(RefChain, RefBase))
|
||||
{
|
||||
if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
}
|
||||
/*
|
||||
XXZ_gpd_Bethe_State::XXZ_gpd_Bethe_State (const Heis_Chain& RefChain, long long int base_id_ref, long long int type_id_ref)
|
||||
: Heis_Bethe_State(RefChain, base_id_ref, type_id_ref),
|
||||
sinlambda(Lambda(chain, base)), coslambda(Lambda(chain, base)), tanlambda(Lambda(chain, base))
|
||||
{
|
||||
if (RefChain.Delta <= 1.0) JSCerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
if (RefChain.Delta <= 1.0) ABACUSerror("Delta too low in XXZ_gpd_Bethe_State constructor");
|
||||
}
|
||||
*/
|
||||
XXZ_gpd_Bethe_State& XXZ_gpd_Bethe_State::operator= (const XXZ_gpd_Bethe_State& RefState)
|
||||
@@ -119,7 +118,7 @@ namespace JSC {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -155,7 +154,7 @@ namespace JSC {
|
||||
|
||||
bool XXZ_gpd_Bethe_State::Check_Admissibility(char option)
|
||||
{
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// This function checks the admissibility of the Ix2's of a state:
|
||||
// returns false if there are higher strings with Ix2 = 0, a totally symmetric distribution of I's at each level,
|
||||
// and strings of equal length modulo 2 and parity with Ix2 = 0, meaning at least two equal roots in BAE.
|
||||
|
||||
@@ -163,18 +162,18 @@ namespace JSC {
|
||||
Vect<bool> Zero_at_level(false, chain.Nstrings); // whether there exists an Ix2 == 0 at a given level
|
||||
|
||||
/*
|
||||
Vect<bool> min_Ix2_max_busy(false, chain.Nstrings);
|
||||
Vect<bool> min_Ix2_max_busy(false, chain.Nstrings);
|
||||
Vect<bool> plus_Ix2_max_busy(false, chain.Nstrings);
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
if (Ix2[j][alpha] == -base.Ix2_max[j]) min_Ix2_max_busy[j] = true;
|
||||
if (Ix2[j][alpha] == base.Ix2_max[j]) plus_Ix2_max_busy[j] = true;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// State is not admissible if this is false: -N/2 + 1 \leq \sum I^j_{\alpha} \leq N
|
||||
// State is not admissible if this is false: -N/2 + 1 \leq \sum I^j_{\alpha} \leq N
|
||||
int sum_all_Ix2 = 0;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
sum_all_Ix2 += Ix2[j][alpha];
|
||||
}
|
||||
@@ -190,13 +189,13 @@ namespace JSC {
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
sum1 = 0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
sum1 += base[k] * (2 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
sum1 += base[k] * (2 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1 : 0));
|
||||
}
|
||||
// Define limits...
|
||||
//if (!((Nrap[j] + Ix2_max[j]) % 2)) Ix2_max[j] -= 1;
|
||||
|
||||
// This almost does it: only missing are the states with one on -PI/2 and one on PI/2
|
||||
if (base[j] >= 1 && (Ix2[j][0] <= -(chain.Nsites - sum1) ||
|
||||
if (base[j] >= 1 && (Ix2[j][0] <= -(chain.Nsites - sum1) ||
|
||||
(Ix2[j][base[j] - 1] - Ix2[j][0]) > 2*(chain.Nsites - sum1))) {
|
||||
//cout << "\tAn Ix2 is out of interval at level " << j << endl;
|
||||
//cout << Ix2[j][base[j] - 1] << "\t" << Ix2[j][0] << "\t" << chain.Nsites << "\t" << sum1 << endl;
|
||||
@@ -215,19 +214,19 @@ namespace JSC {
|
||||
/*
|
||||
// State is not admissible if all min_Ix2_max are busy simultaneously:
|
||||
bool any_min_Ix2_max_free = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && !min_Ix2_max_busy[j]) any_min_Ix2_max_free = true;
|
||||
if (!any_min_Ix2_max_free) return(false);
|
||||
*/
|
||||
/*
|
||||
// State is not admissible if -Ix2_max, -Ix2_max + 2, ..., -Ix2_max + 2*(Str_L - 1) are busy:
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][0] <= -base.Ix2_max[j] + 2*(chain.Str_L[j] - 1))
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][0] <= -base.Ix2_max[j] + 2*(chain.Str_L[j] - 1))
|
||||
return(false);
|
||||
// Almost correct with above !
|
||||
// Almost correct with above !
|
||||
// State is not admissible if Ix2_max - 2, ..., Ix2_max - 2*(Str_L - 2) are busy (NB: one slot more than on left):
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][base[j] - 1] >= base.Ix2_max[j] - 2*(chain.Str_L[j] - 2))
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
if (base[j] > 0 && Ix2[j][base[j] - 1] >= base.Ix2_max[j] - 2*(chain.Str_L[j] - 2))
|
||||
return(false);
|
||||
*/
|
||||
|
||||
@@ -242,9 +241,9 @@ namespace JSC {
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
// The following line puts answer to true if there is at least one higher string with zero Ix2
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] == 0) && (chain.Str_L[j] > 2) /*&& !(chain.Str_L[j] % 2)*/)
|
||||
higher_string_on_zero = true;
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (Ix2[j][alpha] == 0) Zero_at_level[j] = true;
|
||||
// NOTE: if base[j] == 0, Zero_at_level[j] remains false.
|
||||
}
|
||||
|
||||
@@ -254,7 +253,7 @@ namespace JSC {
|
||||
// Checks that we have strings of equal length modulo 2 and same parity with Ix2 == 0, so equal rapidities, and inadmissibility
|
||||
for (int j1 = 0; j1 < chain.Nstrings; ++j1) {
|
||||
for (int j2 = j1 + 1; j2 < chain.Nstrings; ++j2)
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
if (Zero_at_level[j1] && Zero_at_level[j2] && (!((chain.Str_L[j1] + chain.Str_L[j2])%2)))
|
||||
string_coincidence = true;
|
||||
}
|
||||
|
||||
@@ -274,8 +273,8 @@ namespace JSC {
|
||||
|
||||
// Now check that no Ix2 is equal to +N (since we take -N into account, and I + N == I by periodicity of exp)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if ((Ix2[j][alpha] < -chain.Nsites) || (Ix2[j][alpha] >= chain.Nsites)) answer = false;
|
||||
|
||||
if (!answer) {
|
||||
E = 0.0;
|
||||
@@ -296,26 +295,26 @@ namespace JSC {
|
||||
tanlambda[j][alpha] = tan(lambda[j][alpha]);
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI))
|
||||
- (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
}
|
||||
|
||||
void XXZ_gpd_Bethe_State::Compute_BE ()
|
||||
{
|
||||
@@ -324,29 +323,29 @@ namespace JSC {
|
||||
(*this).Compute_tanlambda();
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
|
||||
BE[j][alpha] = 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI))
|
||||
- (sumtheta + PI*Ix2[j][alpha])/chain.Nsites;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DP XXZ_gpd_Bethe_State::Iterate_BAE (int j, int alpha)
|
||||
@@ -354,17 +353,17 @@ namespace JSC {
|
||||
// Returns a new iteration value for lambda[j][alpha] given tanlambda[][] and BE[][]
|
||||
// Assumes that tanlambda[][] and BE[][] have been computed.
|
||||
|
||||
DP arg0 = 0.5 * (2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
DP arg0 = 0.5 * (2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI)) - BE[j][alpha]);
|
||||
DP arg = chain.ta_n_anis_over_2[chain.Str_L[j]] * tan(
|
||||
arg0
|
||||
//0.5 *
|
||||
//0.5 *
|
||||
//(PI * Ix2[j][alpha] + sumtheta)/chain.Nsites
|
||||
//(2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
//(2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
// + PI * floor(0.5 + lambda[j][alpha]/PI)) - BE[j][alpha])
|
||||
);
|
||||
|
||||
return(atan(arg)
|
||||
return(atan(arg)
|
||||
//+ PI * floor(0.5 + arg0)
|
||||
//0.5 * (Ix2[j][alpha] + sumtheta/PI)/(chain.Nsites)
|
||||
+ PI * floor(0.5 + arg0/PI)
|
||||
@@ -388,15 +387,15 @@ namespace JSC {
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
sumtheta += atan((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
@@ -449,27 +448,27 @@ namespace JSC {
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
for (int beta = 0; beta < base[k]; ++beta)
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1)) {
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
sumtheta += atan ((tanlambda[j][alpha] - tanlambda[k][beta])/((1.0 + tanlambda[j][alpha] * tanlambda[k][beta])
|
||||
* chain.ta_n_anis_over_2[2]))
|
||||
+ PI * floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
else sumtheta += 0.5 * Theta_XXZ_gpd((tanlambda[j][alpha] - tanlambda[k][beta])/(1.0 + tanlambda[j][alpha] * tanlambda[k][beta]),
|
||||
chain.Str_L[j], chain.Str_L[k], chain.ta_n_anis_over_2)
|
||||
+ PI * (2.0 * JSC::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
+ PI * (2.0 * ABACUS::min(chain.Str_L[j], chain.Str_L[k]) - ((j == k) ? 1.0 : 0))
|
||||
* floor(0.5 + (lambda[j][alpha] - lambda[k][beta])/PI);
|
||||
}
|
||||
sumtheta *= 2.0;
|
||||
|
||||
RHSBAE[index] = chain.Nsites * 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
RHSBAE[index] = chain.Nsites * 2.0 * (atan(tanlambda[j][alpha]/chain.ta_n_anis_over_2[chain.Str_L[j]])
|
||||
+ PI * floor(0.5 + lambda[j][alpha]/PI))
|
||||
// )
|
||||
- sumtheta - PI*Ix2[j][alpha];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
(*this).Build_Reduced_Gaudin_Matrix (Gaudin);
|
||||
|
||||
for (int i = 0; i < base.Nraptot; ++i) dlambda[i] = - RHSBAE[i];
|
||||
@@ -516,8 +515,8 @@ namespace JSC {
|
||||
bool nonan = true;
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (nonan) nonan = ((!is_nan(lambda[j][alpha]))
|
||||
//&& (lambda[j][alpha] > -0.5*PI*chain.Str_L[j])
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) if (nonan) nonan = ((!is_nan(lambda[j][alpha]))
|
||||
//&& (lambda[j][alpha] > -0.5*PI*chain.Str_L[j])
|
||||
//&& (lambda[j][alpha] <= 0.5*PI*chain.Str_L[j])
|
||||
);
|
||||
|
||||
@@ -557,53 +556,53 @@ namespace JSC {
|
||||
Vect_DP deltadiff(0.0, 1000); // contains |delta^{a, a+1}|
|
||||
|
||||
complex<DP> log_BAE_reg = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < (*this).chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < (*this).base[j]; ++alpha) {
|
||||
|
||||
ln_deltadiff = 0.0;
|
||||
|
||||
|
||||
for (int a = 1; a <= (*this).chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if ((*this).chain.Str_L[j] > 1) { // else the BAE are already 1
|
||||
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis
|
||||
log_BAE_reg = DP((*this).chain.Nsites) * log(sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis
|
||||
* ((*this).chain.Str_L[j] + 1.0 - 2.0 * a + 1.0))
|
||||
/sin((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
log_BAE_reg += log(sin(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
for (int k = 0; k < (*this).chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < (*this).base[k]; ++beta)
|
||||
for (int b = 1; b <= (*this).chain.Str_L[k]; ++b) {
|
||||
if ((j != k) || (alpha != beta) || (a != b - 1))
|
||||
|
||||
log_BAE_reg += log(sin(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
- II * (*this).chain.anis));
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
if ((j != k) || (alpha != beta) || (a != b + 1))
|
||||
|
||||
log_BAE_reg -= log(sin(((*this).lambda[j][alpha] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[j] + 1.0 - 2.0 * a ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
- ((*this).lambda[k][beta] + 0.5 * II * (*this).chain.anis * ((*this).chain.Str_L[k] + 1.0 - 2.0 * b ))
|
||||
+ II * (*this).chain.anis));
|
||||
}
|
||||
|
||||
// The regular LHS of BAE is now defined. Now sum up the deltas...
|
||||
|
||||
|
||||
if (a == 1) ln_deltadiff[0] = -real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a < (*this).chain.Str_L[j]) ln_deltadiff[a - 1] = ln_deltadiff[a-2] - real(log_BAE_reg);
|
||||
|
||||
|
||||
else if (a == (*this).chain.Str_L[j]) ln_deltadiff[a-1] = real(log_BAE_reg);
|
||||
|
||||
} // if ((*this).chain.Str_L[j] > 1)
|
||||
|
||||
|
||||
} // for (int a = 1; ...
|
||||
|
||||
for (int a = 0; a < (*this).chain.Str_L[j]; ++a) {
|
||||
deltadiff[a] = ln_deltadiff[a] != 0.0 ? exp(ln_deltadiff[a]) : 0.0;
|
||||
delta += fabs(deltadiff[a]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // alpha sum
|
||||
} // j sum
|
||||
|
||||
@@ -618,7 +617,7 @@ namespace JSC {
|
||||
void XXZ_gpd_Bethe_State::Compute_Energy ()
|
||||
{
|
||||
DP sum = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < base[j]; ++alpha) {
|
||||
sum += sinh(chain.Str_L[j] * chain.anis) / (cos(2.0 * lambda[j][alpha]) - cosh(chain.Str_L[j] * chain.anis));
|
||||
@@ -626,7 +625,7 @@ namespace JSC {
|
||||
}
|
||||
|
||||
sum *= chain.J * sinh(chain.anis);
|
||||
|
||||
|
||||
E = sum;
|
||||
|
||||
return;
|
||||
@@ -662,7 +661,7 @@ namespace JSC {
|
||||
void XXZ_gpd_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<complex<DP> >& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != base.Nraptot) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != base.Nraptot) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
int index_jalpha;
|
||||
int index_kbeta;
|
||||
@@ -687,24 +686,24 @@ namespace JSC {
|
||||
|
||||
for (int kp = 0; kp < chain.Nstrings; ++kp) {
|
||||
for (int betap = 0; betap < base[kp]; ++betap) {
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp],
|
||||
if (!((j == kp) && (alpha == betap)))
|
||||
sum_hbar_XXZ
|
||||
+= ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[kp][betap], chain.Str_L[j], chain.Str_L[kp],
|
||||
chain.si_n_anis_over_2);
|
||||
}
|
||||
}
|
||||
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
Gaudin_Red[index_jalpha][index_kbeta]
|
||||
= complex<DP> ( chain.Nsites * hbar_XXZ_gpd (lambda[j][alpha], chain.Str_L[j], chain.si_n_anis_over_2) - sum_hbar_XXZ);
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> (chain.si_n_anis_over_2[4]/(pow(sinlambda[j][alpha] * coslambda[k][beta]
|
||||
if ((chain.Str_L[j] == 1) && (chain.Str_L[k] == 1))
|
||||
Gaudin_Red[index_jalpha][index_kbeta] =
|
||||
complex<DP> (chain.si_n_anis_over_2[4]/(pow(sinlambda[j][alpha] * coslambda[k][beta]
|
||||
- coslambda[j][alpha] * sinlambda[k][beta], 2.0) + sinhetasq));
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j],
|
||||
else
|
||||
Gaudin_Red[index_jalpha][index_kbeta] = complex<DP> (ddlambda_Theta_XXZ_gpd (lambda[j][alpha] - lambda[k][beta], chain.Str_L[j],
|
||||
chain.Str_L[k], chain.si_n_anis_over_2));
|
||||
}
|
||||
index_kbeta++;
|
||||
@@ -732,12 +731,12 @@ namespace JSC {
|
||||
DP result;
|
||||
|
||||
if ((nj == 1) && (nk == 1)) result = fbar_XXZ_gpd(tanlambda, tanhnetaover2[2]);
|
||||
|
||||
|
||||
else {
|
||||
|
||||
result = (nj == nk) ? 0.0 : fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk)]);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk) + 2*a]);
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * fbar_XXZ_gpd(tanlambda, tanhnetaover2[fabs(nj - nk) + 2*a]);
|
||||
|
||||
result += fbar_XXZ_gpd(tanlambda, tanhnetaover2[nj + nk]);
|
||||
}
|
||||
@@ -749,12 +748,12 @@ namespace JSC {
|
||||
{
|
||||
return (si_n_anis_over_2[2*n]/(pow(sin(lambda), 2.0) + pow(si_n_anis_over_2[n], 2.0)));
|
||||
}
|
||||
|
||||
|
||||
DP ddlambda_Theta_XXZ_gpd (DP lambda, int nj, int nk, DP* si_n_anis_over_2)
|
||||
{
|
||||
DP result = (nj == nk) ? 0.0 : hbar_XXZ_gpd(lambda, fabs(nj - nk), si_n_anis_over_2);
|
||||
|
||||
for (int a = 1; a < JSC::min(nj, nk); ++a) result += 2.0 * hbar_XXZ_gpd(lambda, fabs(nj - nk) + 2*a, si_n_anis_over_2);
|
||||
for (int a = 1; a < ABACUS::min(nj, nk); ++a) result += 2.0 * hbar_XXZ_gpd(lambda, fabs(nj - nk) + 2*a, si_n_anis_over_2);
|
||||
|
||||
result += hbar_XXZ_gpd(lambda, nj + nk, si_n_anis_over_2);
|
||||
|
||||
@@ -764,8 +763,8 @@ namespace JSC {
|
||||
|
||||
XXZ_gpd_Bethe_State Add_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState)
|
||||
{
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
JSCerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
if (2*RefState.base.Mdown == RefState.chain.Nsites)
|
||||
ABACUSerror("Trying to add a down spin to a zero-magnetized chain in Add_Particle_at_Center.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] + 1;
|
||||
@@ -775,10 +774,10 @@ namespace JSC {
|
||||
XXZ_gpd_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index M[0]/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[0][RefState.base.Nrap[0]/2] = RefState.Ix2[0][RefState.base.Nrap[0]/2] - 1;
|
||||
for (int i = 0; i < RefState.base.Nrap[0] + 1; ++i)
|
||||
@@ -791,7 +790,7 @@ namespace JSC {
|
||||
XXZ_gpd_Bethe_State Remove_Particle_at_Center (const XXZ_gpd_Bethe_State& RefState)
|
||||
{
|
||||
if (RefState.base.Nrap[0] == 0)
|
||||
JSCerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
ABACUSerror("Trying to remove a down spin in an empty Nrap[0] state.");
|
||||
|
||||
Vect<int> newM = RefState.base.Nrap;
|
||||
newM[0] = newM[0] - 1;
|
||||
@@ -801,7 +800,7 @@ namespace JSC {
|
||||
XXZ_gpd_Bethe_State ReturnState (RefState.chain, newBase);
|
||||
|
||||
for (int il = 1; il < RefState.chain.Nstrings; ++il)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
for (int alpha = 0; alpha < RefState.base.Nrap[il]; ++alpha)
|
||||
ReturnState.Ix2[il][alpha] = RefState.Ix2[il][alpha];
|
||||
|
||||
// Remove midmost and shift quantum numbers by half-integer towards removed one:
|
||||
@@ -810,5 +809,5 @@ namespace JSC {
|
||||
|
||||
return(ReturnState);
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
+42
-37
@@ -1,18 +1,23 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Overlap_XXX.cc
|
||||
|
||||
Purpose: compute the overlap between an on-shell and an off-shell states
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -22,9 +27,9 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -71,7 +76,7 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
// The A and B states can contain strings.
|
||||
|
||||
// IMPORTANT ASSUMPTIONS:
|
||||
// - State B is an eigenstate of the model on which the overlap measure is defined
|
||||
// - State B is an eigenstate of the model on which the overlap measure is defined
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
@@ -92,12 +97,12 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
/*
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm((A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm((B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -121,8 +126,8 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
|
||||
// ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
|
||||
|
||||
@@ -132,7 +137,7 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
// ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
|
||||
|
||||
// Now proceed to build the Hm2P matrix
|
||||
@@ -153,12 +158,12 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
//two_over_A_lambda_sq_plus_1over2sq = 2.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
|
||||
// (A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
@@ -173,51 +178,51 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
//Prod_powerN = pow((B.lambda[k][beta] + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (B.chain.Nsites));
|
||||
Prod_powerN = pow((B.lambda[k][beta] + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (A.chain.Nsites)); // careful !
|
||||
Prod_powerN = pow((B.lambda[k][beta] + 0.5 * II)/(B.lambda[k][beta] - 0.5 * II), complex<DP> (A.chain.Nsites)); // careful !
|
||||
|
||||
Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2
|
||||
//- two_over_A_lambda_sq_plus_1over2sq * exp(II*im_ln_Fn_F_B_0[k][beta]);
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
//sum2 = 0.0;
|
||||
|
||||
|
||||
//for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1))); // include all string contributions F_B_0 in this term
|
||||
|
||||
//Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_lambda_sq_plus_1over2sq);
|
||||
Hm2P[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
@@ -232,22 +237,22 @@ complex<DP> ln_Overlap (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
/*
|
||||
complex<DP> ln_form_factor_sq = log(0.25 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
// + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
|
||||
// + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
|
||||
+ 2.0 * det
|
||||
- A.lnnorm - B.lnnorm;
|
||||
|
||||
//cout << "ln_SZ: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
//cout << "ln_SZ: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
// << "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
|
||||
|
||||
return(ln_form_factor_sq);
|
||||
*/
|
||||
complex<DP> ln_overlap = 0.5 * (-ln_prod3 + ln_prod4) + det - 0.5 * (A.lnnorm + B.lnnorm);
|
||||
|
||||
cout << "ln_overlap: " << endl << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
cout << "ln_overlap: " << endl << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
<< "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
|
||||
|
||||
return(ln_overlap);
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+55
-40
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Smin_ME_XXX.cc
|
||||
|
||||
Purpose: compute the S^- matrix elemment for XXX
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -12,12 +27,12 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
@@ -50,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -62,11 +77,11 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
// Check that the two states are compatible
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Smin matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Smin matrix element.");
|
||||
|
||||
// Check that A and B are Mdown-compatible:
|
||||
// Check that A and B are Mdown-compatible:
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 1) JSCerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown + 1) ABACUSerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
|
||||
// Some convenient arrays
|
||||
|
||||
@@ -82,12 +97,12 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -120,8 +135,8 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
|
||||
// ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
|
||||
|
||||
@@ -131,7 +146,7 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
// ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
|
||||
|
||||
// Now proceed to build the Hm matrix
|
||||
@@ -152,10 +167,10 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
one_over_A_lambda_sq_plus_1over2sq = 1.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
|
||||
|
||||
one_over_A_lambda_sq_plus_1over2sq = 1.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
|
||||
(A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
@@ -166,9 +181,9 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
Prod_powerN = pow((B.lambda[k][beta] + II * 0.5) /(B.lambda[k][beta] - II * 0.5), complex<DP> (B.chain.Nsites));
|
||||
@@ -176,54 +191,54 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
Hm[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2;
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
/*
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
*/
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)));
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)));
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
Hm[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
@@ -236,4 +251,4 @@ complex<DP> ln_Smin_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+67
-52
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Smin_ME_XXZ.cc
|
||||
|
||||
Purpose: compute the S^- matrix elemment for XXZ
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -25,19 +40,19 @@ inline complex<DP> ln_Fn_F (XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
|
||||
arg = B.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
absarg = abs(arg);
|
||||
/*
|
||||
/*
|
||||
prod_temp *= 0.5 * //done later...
|
||||
((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * (B.chain.par[k] - B.chain.par[j]))
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
+ B.chain.co_n_anis_over_2[absarg] * (B.chain.par[k] - B.chain.par[j])) );
|
||||
*/
|
||||
|
||||
prod_temp *= ((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= ((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * par_comb_1 - sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * par_comb_2)
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * par_comb_1 + B.chain.co_n_anis_over_2[absarg] * par_comb_2));
|
||||
}
|
||||
|
||||
@@ -73,16 +88,16 @@ inline complex<DP> ln_Fn_G (XXZ_Bethe_State& A, XXZ_Bethe_State& B, int k, int b
|
||||
absarg = abs(arg);
|
||||
/*
|
||||
prod_temp *= 0.5 * //done later...
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg] * (B.chain.par[k] - A.chain.par[j])) );
|
||||
*/
|
||||
prod_temp *= ((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= ((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg] * par_comb_1 - sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * par_comb_2)
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * par_comb_1 + A.chain.co_n_anis_over_2[absarg] * par_comb_2));
|
||||
|
||||
if (counter++ > 100) { // we do at most 100 products before taking a log
|
||||
@@ -103,17 +118,17 @@ inline complex<DP> Fn_K (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_
|
||||
int absarg2 = abs(arg2);
|
||||
|
||||
return(4.0/(
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg1] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg1) * A.chain.si_n_anis_over_2[absarg1] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg1) * A.chain.si_n_anis_over_2[absarg1] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg1] * (B.chain.par[k] - A.chain.par[j])) )
|
||||
*
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg2] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg2) * A.chain.si_n_anis_over_2[absarg2] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg2) * A.chain.si_n_anis_over_2[absarg2] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg2] * (B.chain.par[k] - A.chain.par[j])) )
|
||||
));
|
||||
@@ -123,8 +138,8 @@ inline complex<DP> Fn_K (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_
|
||||
inline complex<DP> Fn_L (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return (sinh(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
+ 0.25 * II * PI * complex<DP>(-A.chain.par[j] + B.chain.par[k])))
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
+ 0.25 * II * PI * complex<DP>(-A.chain.par[j] + B.chain.par[k])))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -135,14 +150,14 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
|
||||
// Check that the two states are compatible
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXZ_Chains in Smin matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXZ_Chains in Smin matrix element.");
|
||||
|
||||
// Check that A and B are Mdown-compatible:
|
||||
// Check that A and B are Mdown-compatible:
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 1) {
|
||||
cout << "A.base.Mdown = " << A.base.Mdown << "\tB.base.Mdown = " << B.base.Mdown << endl;
|
||||
cout << "A: " << A << endl << "B: " << B << endl;
|
||||
JSCerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
ABACUSerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
}
|
||||
|
||||
// Compute the sinh and cosh of rapidities
|
||||
@@ -166,13 +181,13 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(sinh(A.lambda[i][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[i]))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(sinh(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
@@ -199,7 +214,7 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1); // assume only one-strings here
|
||||
|
||||
ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.anis)));
|
||||
@@ -210,7 +225,7 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.anis)));
|
||||
|
||||
// Now proceed to build the Hm matrix
|
||||
@@ -232,11 +247,11 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
one_over_A_sinhlambda_sq_plus_sinzetaover2sq = 1.0/((sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
* (sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ pow(sin(0.5*A.chain.anis), 2.0));
|
||||
@@ -249,12 +264,12 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
|
||||
// use simplified code for one-string here: original form of Hm matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
:
|
||||
@@ -265,59 +280,59 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
Hm[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2;
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
/*
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
*/
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]] + logabssinzeta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinzeta);
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinzeta);
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
Hm[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_sinhlambda_sq_plus_sinzetaover2sq;
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_sinhlambda_sq_plus_sinzetaover2sq;
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
complex<DP> ln_ME_sq = log(1.0 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
complex<DP> ln_ME_sq = log(1.0 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
+ 2.0 * real(lndet_LU_CX_dstry(Hm)) + logabssinzeta - A.lnnorm - B.lnnorm;
|
||||
|
||||
//return(ln_ME_sq);
|
||||
@@ -325,4 +340,4 @@ complex<DP> ln_Smin_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Smin_ME_XXZ_gpd.cc
|
||||
|
||||
Purpose: compute the S^- matrix elemment for XXX_gpd
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXZ_gpd_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -14,7 +29,7 @@ inline complex<DP> ln_Fn_F (XXZ_gpd_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
/*
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(-II * sin(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.eta * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b))));
|
||||
*/
|
||||
@@ -23,10 +38,10 @@ inline complex<DP> ln_Fn_F (XXZ_gpd_Bethe_State& B, int k, int beta, int b)
|
||||
|
||||
// arg = B.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
// absarg = abs(arg);
|
||||
|
||||
|
||||
prod_temp *= -II * (B.sinlambda[j][alpha] * B.coslambda[k][beta] - B.coslambda[j][alpha] * B.sinlambda[k][beta])
|
||||
* cosh(0.5 * B.chain.anis * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b))) +
|
||||
(B.coslambda[j][alpha] * B.coslambda[k][beta] + B.sinlambda[j][alpha] * B.sinlambda[k][beta])
|
||||
(B.coslambda[j][alpha] * B.coslambda[k][beta] + B.sinlambda[j][alpha] * B.sinlambda[k][beta])
|
||||
* sinh(0.5 * B.chain.anis * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
|
||||
}
|
||||
@@ -81,7 +96,7 @@ inline complex<DP> Fn_K (XXZ_gpd_Bethe_State& A, int j, int alpha, int a, XXZ_gp
|
||||
{
|
||||
/*
|
||||
return(-1.0/(sin(A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)))
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)))
|
||||
* sin(A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 1.0)))));
|
||||
*/
|
||||
@@ -107,12 +122,12 @@ inline complex<DP> Fn_L (XXZ_gpd_Bethe_State& A, int j, int alpha, int a, XXZ_gp
|
||||
{
|
||||
/*
|
||||
complex<DP> ans = -II * sin(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))));
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))));
|
||||
|
||||
return (ans * pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
*/
|
||||
return (-II * sin(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))))
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -123,11 +138,11 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
|
||||
// Check that the two states refer to the same XXZ_gpd_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXZ_gpd_Chains in Smin matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXZ_gpd_Chains in Smin matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 1) JSCerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown + 1) ABACUSerror("Incompatible Mdown between the two states in Smin matrix element!");
|
||||
|
||||
// Compute the sin and cos of rapidities
|
||||
|
||||
@@ -150,12 +165,12 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(sin(A.lambda[i][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(sin(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -182,8 +197,8 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
|
||||
ln_prod3 -= A.base.Mdown * log(abs(sinh(A.chain.anis)));
|
||||
|
||||
@@ -193,7 +208,7 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
ln_prod4 -= B.base.Mdown * log(abs(sinh(B.chain.anis)));
|
||||
|
||||
// Now proceed to build the Hm matrix
|
||||
@@ -214,15 +229,15 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
one_over_A_sinlambda_sq_plus_sinhetaover2sq = -1.0/((sin(A.lambda[j][alpha] // minus sign: from 1/(sinh^2... to -1/(sin^2...
|
||||
+ 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a))) *
|
||||
(sin(A.lambda[j][alpha] // minus sign: from 1/(sinh^2... to -1/(sin^2...
|
||||
+ 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)))
|
||||
+ 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)))
|
||||
+ pow(sinh(0.5*A.chain.anis), 2.0));
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
@@ -231,63 +246,63 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinheta);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinheta);
|
||||
|
||||
Prod_powerN = pow((B.sinlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.coslambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.sinlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coslambda[k][beta] * B.chain.si_n_anis_over_2[1]),
|
||||
/(B.sinlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coslambda[k][beta] * B.chain.si_n_anis_over_2[1]),
|
||||
complex<DP> (B.chain.Nsites));
|
||||
|
||||
Hm[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
/*
|
||||
/*
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
*/
|
||||
*/
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]] + logabssinheta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinheta);
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinheta);
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
Hm[index_a][index_b] = prod_num * sum1;
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_sinlambda_sq_plus_sinhetaover2sq;
|
||||
Hm[index_a][B.base.Mdown] = one_over_A_sinlambda_sq_plus_sinhetaover2sq;
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
@@ -300,4 +315,4 @@ complex<DP> ln_Smin_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+72
-57
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Smm_ME_XXX.cc
|
||||
|
||||
Purpose: compute the S^-_j S^-_{j+1} matrix elemment for XXX
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
inline complex<DP> phi(complex<DP> x){return x;}
|
||||
inline complex<DP> a(complex<DP> x){return 1;}
|
||||
inline complex<DP> b(complex<DP> x,complex<DP> y, complex<DP> eta){ return phi(x-y)/phi(x-y+complex<DP>(0.0,1.0)*eta);}
|
||||
@@ -17,12 +32,12 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
@@ -53,14 +68,14 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)))
|
||||
* (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 1.0)) )));
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -79,12 +94,12 @@ const DP real_dev=1.0e-14;
|
||||
|
||||
// Check that the two states refer to the same XXX_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Smm matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Smm matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 2) JSCerror("Incompatible Mdown between the two states in Smm matrix element!");
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 2) ABACUSerror("Incompatible Mdown between the two states in Smm matrix element!");
|
||||
|
||||
//if(B.String_delta()> HEIS_deltaprec) return(complex<DP>(-300.0)); // DEPRECATED in ++T_9
|
||||
|
||||
|
||||
@@ -95,29 +110,29 @@ const DP real_dev=1.0e-14;
|
||||
complex<DP> ln_prod = complex<DP>(0.0,0.0);
|
||||
complex<DP> result=-300;
|
||||
complex<DP> prev_result=-300;
|
||||
|
||||
|
||||
XXX_Bethe_State B_origin; B_origin=B;
|
||||
bool zero_string=false;
|
||||
for (int j = 0; j < B_origin.chain.Nstrings; ++j)
|
||||
for (int j = 0; j < B_origin.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < B_origin.base.Nrap[j]; ++alpha)
|
||||
if(abs(B_origin.lambda[j][alpha])<Zero_Center_Thres) zero_string=true;
|
||||
|
||||
|
||||
// Some convenient arrays
|
||||
bool real_dev_conv=false;
|
||||
int dev=-1;
|
||||
while(!real_dev_conv){
|
||||
real_dev_conv=true;
|
||||
|
||||
|
||||
dev++;
|
||||
//add a delta to the origin of the centered strings
|
||||
if(zero_string){
|
||||
real_dev_conv=false;
|
||||
for (int j = 0; j < B.chain.Nstrings; ++j)
|
||||
real_dev_conv=false;
|
||||
for (int j = 0; j < B.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha)
|
||||
if(abs(B_origin.lambda[j][alpha])<Zero_Center_Thres)
|
||||
B.lambda[j][alpha]=real_dev*pow(10.0,dev);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
prev_result=result;
|
||||
|
||||
|
||||
@@ -126,16 +141,16 @@ XXX_Bethe_State B_origin; B_origin=B;
|
||||
|
||||
int sizeA=0;
|
||||
int sizeB=0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
sizeA+=A.base.Nrap[i]*A.chain.Str_L[i];
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
sizeB+=B.base.Nrap[i]*B.chain.Str_L[i];
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
sizeB+=B.base.Nrap[i]*B.chain.Str_L[i];
|
||||
|
||||
complex<DP>* mu = new complex<DP>[sizeA];
|
||||
complex<DP>* lam = new complex<DP>[sizeB];
|
||||
int index=0;
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
{
|
||||
@@ -144,7 +159,7 @@ int sizeB=0;
|
||||
}
|
||||
|
||||
index=0;
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
{
|
||||
@@ -166,7 +181,7 @@ for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
re_ln_Fn_G_0[j][alpha] = real(ln_Fn_G(A, B, j, alpha, 0));
|
||||
im_ln_Fn_G_0[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 0));
|
||||
re_ln_Fn_G_2[j][alpha] = real(ln_Fn_G(A, B, j, alpha, 2));
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,12 +190,12 @@ for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -189,15 +204,15 @@ for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
// Define regularized products in prefactors
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta)
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
}
|
||||
result += 2.0*real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4) - A.lnnorm - B.lnnorm;
|
||||
// Define the F ones earlier...
|
||||
|
||||
@@ -209,23 +224,23 @@ for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
//A -> mu, B -> lam
|
||||
SQMat_CX H(0.0, A.base.Mdown);
|
||||
index_a = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
complex<DP> Da;
|
||||
complex<DP> Ca;
|
||||
Da=eta/((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5));
|
||||
Ca=eta*((mu[index_a]-eta*0.5)+(mu[index_a]+eta*0.5))/pow(((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5)),2.0);
|
||||
|
||||
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
|
||||
|
||||
if (B.chain.Str_L[k] == 1) {
|
||||
|
||||
|
||||
@@ -238,49 +253,49 @@ SQMat_CX H(0.0, A.base.Mdown);
|
||||
|
||||
prodminus = Fn_K (A, j, alpha, a, B, k, beta, 1);// 1.0/ (phi(mu[l]-lam[k]) phi(mu[l]-lam[k]-eta) )
|
||||
prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]-eta)/ prod_l!=k | phi(lam[l]-lam[k]) |;
|
||||
|
||||
|
||||
Prod_powerN = pow((B.lambda[k][beta] - eta*0.5) /(B.lambda[k][beta] + eta*0.5), complex<DP> (B.chain.Nsites));
|
||||
H[index_a][index_b] =eta*(prodplus-prodminus*Prod_powerN);
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
// */{
|
||||
|
||||
if (b > 1){
|
||||
|
||||
if (b > 1){
|
||||
H[index_a][index_b] = eta* Fn_K(A, j, alpha, a, B, k, beta, b-1)*exp(ln_Fn_G(A,B,k,beta,b-1))*exp(-real(ln_Fn_F(B, k, beta, b - 1)));//.../ prod_l!=k | phi(lam[l]-lam[k]) |
|
||||
}
|
||||
else if (b == 1) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
complex<DP> sum1 = complex<DP>(0.0,0.0);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1]
|
||||
- ln_FunctionF[0] - ln_FunctionF[1]);//sum term when i=0
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp( ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]); //sum term when i=n
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) {
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) {
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
H[index_a][index_b] = eta * exp(ln_FunctionF[0]+ ln_FunctionF[1] - ln_FunctionG[1]) * sum1 * exp( - real(ln_Fn_F(B, k, beta, b - 1))); //the absolute value prod_l!=k phi(lam[l]-lam[k]) : real(ln_...)
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
|
||||
// now define the elements H[a][M] & H[a][M-1]
|
||||
H[index_a][B.base.Mdown]=Da;
|
||||
H[index_a][B.base.Mdown]=Da;
|
||||
H[index_a][B.base.Mdown+1]=Ca;
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
@@ -290,7 +305,7 @@ SQMat_CX H(0.0, A.base.Mdown);
|
||||
result+=log(2.0)-log((A.chain.Nsites-A.base.Mdown*2+3.0)*((A.chain.Nsites-A.base.Mdown*2+4.0)));
|
||||
if (!(real_dev_conv) && abs(exp(result)-exp(prev_result))<abs( Diff_ME_Thres*exp(result)))
|
||||
real_dev_conv=true;
|
||||
|
||||
|
||||
if (!(real_dev_conv) && dev >20){
|
||||
result=-300;
|
||||
real_dev_conv=true;
|
||||
@@ -303,5 +318,5 @@ SQMat_CX H(0.0, A.base.Mdown);
|
||||
//return(result);
|
||||
return(0.5 * result); // Return ME, not MEsq
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
+41
-36
@@ -1,18 +1,23 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c)
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Sz_ME_XXX.cc
|
||||
|
||||
Purpose: compute the S^z matrix elemment for XXX
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace JSC;
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -22,9 +27,9 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,8 +65,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -72,11 +77,11 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
// Check that the two states refer to the same XXX_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Sz matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Sz matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown) JSCerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown) ABACUSerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
|
||||
//if (A.iK == B.iK && (A.label != B.label))
|
||||
if (A.iK == B.iK && (A.label.compare(B.label) != 0))
|
||||
@@ -96,12 +101,12 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm((A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm((B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -124,8 +129,8 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
|
||||
// ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.zeta)));
|
||||
|
||||
@@ -135,7 +140,7 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
// ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.zeta)));
|
||||
|
||||
// Now proceed to build the Hm2P matrix
|
||||
@@ -156,12 +161,12 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
two_over_A_lambda_sq_plus_1over2sq = 2.0/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
|
||||
(A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
@@ -181,44 +186,44 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
- two_over_A_lambda_sq_plus_1over2sq * exp(II*im_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]]);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1))); // include all string contributions F_B_0 in this term
|
||||
|
||||
Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_lambda_sq_plus_1over2sq);
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
@@ -232,11 +237,11 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
DP det = real(lndet_LU_CX_dstry(Hm2P));
|
||||
|
||||
complex<DP> ln_ME_sq = log(0.25 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
// + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
|
||||
// + 2.0 * real(lndet_LU_CX_dstry(Hm2P))
|
||||
+ 2.0 * det
|
||||
- A.lnnorm - B.lnnorm;
|
||||
|
||||
//cout << "ln_Sz: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
//cout << "ln_Sz: " << endl << ln_prod1 << "\t" << -ln_prod2 << "\t" << -ln_prod3 << "\t" << ln_prod4 << "\t" << 2.0 * det
|
||||
// << "\t" << -A.lnnorm << "\t" << -B.lnnorm << endl;
|
||||
|
||||
//return(ln_ME_sq);
|
||||
@@ -244,4 +249,4 @@ complex<DP> ln_Sz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+205
-190
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Sz_ME_XXZ.cc
|
||||
|
||||
Purpose: compute the S^z matrix elemment for XXZ
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -12,48 +27,48 @@ namespace JSC {
|
||||
int arg = 0;
|
||||
int absarg = 0;
|
||||
int par_comb_1, par_comb_2;
|
||||
|
||||
|
||||
for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
|
||||
|
||||
par_comb_1 = B.chain.par[j] == B.chain.par[k] ? 1 : 0;
|
||||
par_comb_2 = B.chain.par[k] == B.chain.par[j] ? 0 : B.chain.par[k];
|
||||
|
||||
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
|
||||
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b))) {
|
||||
|
||||
|
||||
arg = B.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
absarg = abs(arg);
|
||||
/*
|
||||
prod_temp *= 0.5 *
|
||||
((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= 0.5 *
|
||||
((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * (B.chain.par[k] - B.chain.par[j]))
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg)
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg)
|
||||
* B.chain.si_n_anis_over_2[absarg] * (1.0 + B.chain.par[j] * B.chain.par[k])
|
||||
+ B.chain.co_n_anis_over_2[absarg] * (B.chain.par[k] - B.chain.par[j])) );
|
||||
*/
|
||||
prod_temp *= ((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= ((B.sinhlambda[j][alpha] * B.coshlambda[k][beta] - B.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (B.chain.co_n_anis_over_2[absarg] * par_comb_1 - sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * par_comb_2)
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (B.coshlambda[j][alpha] * B.coshlambda[k][beta] - B.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * B.chain.si_n_anis_over_2[absarg] * par_comb_1 + B.chain.co_n_anis_over_2[absarg] * par_comb_2));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (counter++ > 100) { // we do at most 100 products before taking a log
|
||||
ans += log(prod_temp);
|
||||
prod_temp = 1.0;
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
return(ans + log(prod_temp));
|
||||
}
|
||||
|
||||
|
||||
inline complex<DP> ln_Fn_G (XXZ_Bethe_State& A, XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
complex<DP> ans = 0.0;
|
||||
@@ -62,138 +77,138 @@ namespace JSC {
|
||||
int arg = 0;
|
||||
int absarg = 0;
|
||||
int par_comb_1, par_comb_2;
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
|
||||
|
||||
par_comb_1 = A.chain.par[j] == B.chain.par[k] ? 1 : 0;
|
||||
par_comb_2 = B.chain.par[k] == A.chain.par[j] ? 0 : B.chain.par[k];
|
||||
|
||||
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
|
||||
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
arg = A.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
absarg = abs(arg);
|
||||
|
||||
|
||||
/*
|
||||
prod_temp *= 0.5 *
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= 0.5 *
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg] * (B.chain.par[k] - A.chain.par[j])) );
|
||||
*/
|
||||
prod_temp *= ((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
prod_temp *= ((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg] * par_comb_1 - sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * par_comb_2)
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg) * A.chain.si_n_anis_over_2[absarg] * par_comb_1 + A.chain.co_n_anis_over_2[absarg] * par_comb_2));
|
||||
|
||||
|
||||
if (counter++ > 100) { // we do at most 100 products before taking a log
|
||||
ans += log(prod_temp);
|
||||
prod_temp = 1.0;
|
||||
counter = 0;
|
||||
}
|
||||
}}}
|
||||
|
||||
|
||||
return(ans + log(prod_temp));
|
||||
}
|
||||
|
||||
|
||||
inline complex<DP> Fn_K (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
int arg1 = A.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
int absarg1 = abs(arg1);
|
||||
int arg2 = arg1 + 2;
|
||||
int absarg2 = abs(arg2);
|
||||
|
||||
|
||||
return(4.0/(
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg1] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg1) * A.chain.si_n_anis_over_2[absarg1] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg1) * A.chain.si_n_anis_over_2[absarg1] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg1] * (B.chain.par[k] - A.chain.par[j])) )
|
||||
*
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
((A.sinhlambda[j][alpha] * B.coshlambda[k][beta] - A.coshlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (A.chain.co_n_anis_over_2[absarg2] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
- sgn_int(arg2) * A.chain.si_n_anis_over_2[absarg2] * (B.chain.par[k] - A.chain.par[j]))
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
+ II * (A.coshlambda[j][alpha] * B.coshlambda[k][beta] - A.sinhlambda[j][alpha] * B.sinhlambda[k][beta])
|
||||
* (sgn_int(arg2) * A.chain.si_n_anis_over_2[absarg2] * (1.0 + A.chain.par[j] * B.chain.par[k])
|
||||
+ A.chain.co_n_anis_over_2[absarg2] * (B.chain.par[k] - A.chain.par[j])) )
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline complex<DP> Fn_L (XXZ_Bethe_State& A, int j, int alpha, int a, XXZ_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return (sinh(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
+ 0.25 * II * PI * complex<DP>(-A.chain.par[j] + B.chain.par[k])))
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
+ 0.25 * II * PI * complex<DP>(-A.chain.par[j] + B.chain.par[k])))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Version without phases:
|
||||
complex<DP> ln_Sz_ME (XXZ_Bethe_State& A, XXZ_Bethe_State& B)
|
||||
{
|
||||
// This function returns the natural log of the S^z operator matrix element.
|
||||
// The A and B states can contain strings.
|
||||
|
||||
|
||||
// Check that the two states refer to the same XXZ_Chain
|
||||
|
||||
|
||||
if (A.chain != B.chain) {
|
||||
JSCerror("Incompatible XXZ_Chains in Sz matrix element.");
|
||||
ABACUSerror("Incompatible XXZ_Chains in Sz matrix element.");
|
||||
}
|
||||
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown) {
|
||||
cout << "Bra state: " << endl << A << endl;
|
||||
cout << "Ket state: " << endl << B << endl;
|
||||
cout << A.base.Mdown << "\t" << B.base.Mdown << endl;
|
||||
JSCerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
ABACUSerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
}
|
||||
|
||||
|
||||
if (A.iK == B.iK && (A.label != B.label))
|
||||
return(-300.0); // matrix element identically vanishes
|
||||
|
||||
|
||||
// Compute the sinh and cosh of rapidities
|
||||
|
||||
|
||||
A.Compute_sinhlambda();
|
||||
A.Compute_coshlambda();
|
||||
B.Compute_sinhlambda();
|
||||
B.Compute_coshlambda();
|
||||
|
||||
|
||||
// Some convenient arrays
|
||||
|
||||
|
||||
Lambda re_ln_Fn_F_B_0(B.chain, B.base);
|
||||
Lambda im_ln_Fn_F_B_0(B.chain, B.base);
|
||||
Lambda re_ln_Fn_G_0(B.chain, B.base);
|
||||
Lambda im_ln_Fn_G_0(B.chain, B.base);
|
||||
Lambda re_ln_Fn_G_2(B.chain, B.base);
|
||||
Lambda im_ln_Fn_G_2(B.chain, B.base);
|
||||
|
||||
|
||||
complex<DP> ln_prod1 = 0.0;
|
||||
complex<DP> ln_prod2 = 0.0;
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(sinh(A.lambda[i][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[i]))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(sinh(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - B.chain.par[i]))) > 100.0 * MACHINE_EPS_SQ)
|
||||
ln_prod2 += log(norm(sinh(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - B.chain.par[i]))));
|
||||
|
||||
|
||||
// Define the F ones earlier...
|
||||
|
||||
|
||||
complex<DP> ln_Fn_F_B_0;
|
||||
for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
@@ -208,35 +223,35 @@ namespace JSC {
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DP logabssinzeta = log(abs(sin(A.chain.anis)));
|
||||
|
||||
|
||||
// Define regularized products in prefactors
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
}
|
||||
|
||||
|
||||
ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.anis)));
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta)
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.anis)));
|
||||
|
||||
|
||||
// Now proceed to build the Hm2P matrix
|
||||
|
||||
|
||||
SQMat_CX Hm2P(0.0, A.base.Mdown);
|
||||
|
||||
|
||||
int index_a = 0;
|
||||
int index_b = 0;
|
||||
|
||||
|
||||
complex<DP> sum1 = 0.0;
|
||||
complex<DP> sum2 = 0.0;
|
||||
complex<DP> prod_num = 0.0;
|
||||
@@ -244,103 +259,103 @@ namespace JSC {
|
||||
complex<DP> Prod_powerN = 0.0;
|
||||
complex<DP> Fn_K_1_G_2 = 0.0;
|
||||
complex<DP> two_over_A_sinhlambda_sq_plus_sinzetaover2sq;
|
||||
|
||||
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
two_over_A_sinhlambda_sq_plus_sinzetaover2sq = 2.0/((sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
* (sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ pow(sin(0.5*A.chain.anis), 2.0));
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
|
||||
|
||||
if (B.chain.Str_L[k] == 1) {
|
||||
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
:
|
||||
(B.coshlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.sinhlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.coshlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.sinhlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
, complex<DP> (B.chain.Nsites));
|
||||
|
||||
|
||||
//cout << "Prod_powerN = " << Prod_powerN << "\t" << abs(Prod_powerN) << endl;
|
||||
|
||||
|
||||
Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2 - two_over_A_sinhlambda_sq_plus_sinzetaover2sq
|
||||
* exp(II*im_ln_Fn_F_B_0[k][beta] + logabssinzeta);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]] + logabssinzeta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_FunctionF[jsum - 1]) + logabssinzeta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_FunctionF[jsum - 1]) + logabssinzeta);
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
|
||||
Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_sinhlambda_sq_plus_sinzetaover2sq);
|
||||
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
|
||||
DP re_ln_det = real(lndet_LU_CX_dstry(Hm2P));
|
||||
|
||||
|
||||
complex<DP> ln_ME_sq = log(0.25 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
+ 2.0 * /*real(lndet_LU_CX_dstry(Hm2P))*/ re_ln_det - A.lnnorm - B.lnnorm;
|
||||
|
||||
//cout << endl << ln_prod1 << "\t" << ln_prod2 << "\t" << ln_prod3 << "\t" << ln_prod4 << "\t" << A.lnnorm << "\t" << B.lnnorm
|
||||
|
||||
//cout << endl << ln_prod1 << "\t" << ln_prod2 << "\t" << ln_prod3 << "\t" << ln_prod4 << "\t" << A.lnnorm << "\t" << B.lnnorm
|
||||
//<< "\t" << re_ln_det << "\t" << ln_ME_sq << endl;
|
||||
|
||||
|
||||
//return(ln_ME_sq);
|
||||
return(0.5 * ln_ME_sq); // Return ME, not MEsq
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Version with phases:
|
||||
@@ -348,52 +363,52 @@ namespace JSC {
|
||||
{
|
||||
// This function returns the natural log of the S^z operator matrix element.
|
||||
// The A and B states can contain strings.
|
||||
|
||||
|
||||
// Check that the two states refer to the same XXZ_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXZ_Chains in Sz matrix element.");
|
||||
|
||||
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXZ_Chains in Sz matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown) {
|
||||
cout << "Bra state: " << endl << A << endl;
|
||||
cout << "Ket state: " << endl << B << endl;
|
||||
cout << A.base.Mdown << "\t" << B.base.Mdown << endl;
|
||||
JSCerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
ABACUSerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
}
|
||||
|
||||
|
||||
if (A.iK == B.iK && (A.label != B.label))
|
||||
return(-300.0); // matrix element identically vanishes
|
||||
|
||||
|
||||
// Compute the sinh and cosh of rapidities
|
||||
|
||||
|
||||
A.Compute_sinhlambda();
|
||||
A.Compute_coshlambda();
|
||||
B.Compute_sinhlambda();
|
||||
B.Compute_coshlambda();
|
||||
|
||||
|
||||
// Some convenient arrays
|
||||
|
||||
|
||||
Lambda re_ln_Fn_F_B_0(B.chain, B.base);
|
||||
Lambda im_ln_Fn_F_B_0(B.chain, B.base);
|
||||
Lambda re_ln_Fn_G_0(B.chain, B.base);
|
||||
Lambda im_ln_Fn_G_0(B.chain, B.base);
|
||||
Lambda re_ln_Fn_G_2(B.chain, B.base);
|
||||
Lambda im_ln_Fn_G_2(B.chain, B.base);
|
||||
|
||||
|
||||
complex<DP> ln_prod1 = 0.0;
|
||||
complex<DP> ln_prod2 = 0.0;
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(sinh(A.lambda[i][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[i])));
|
||||
|
||||
complex<DP> shB;
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(shB = sinh(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
@@ -401,9 +416,9 @@ namespace JSC {
|
||||
//ln_prod2 += log(norm(sinh(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)
|
||||
// + 0.25 * II * PI * (1.0 - B.chain.par[i]))));
|
||||
ln_prod2 += log(shB);
|
||||
|
||||
|
||||
// Define the F ones earlier...
|
||||
|
||||
|
||||
complex<DP> ln_Fn_F_B_0, ln_Fn_G_0, ln_Fn_G_2;
|
||||
for (int j = 0; j < B.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
@@ -424,37 +439,37 @@ namespace JSC {
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G_2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DP logsinzeta = log(sin(A.chain.anis));
|
||||
|
||||
|
||||
// Define regularized products in prefactors
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
ln_prod3 += ln_Fn_F (A, j, alpha, a - 1);
|
||||
}
|
||||
|
||||
|
||||
//ln_prod3 -= A.base.Mdown * log(abs(sin(A.chain.anis)));
|
||||
ln_prod3 -= A.base.Mdown * logsinzeta;
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k)
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta)
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
//ln_prod4 -= B.base.Mdown * log(abs(sin(B.chain.anis)));
|
||||
ln_prod4 -= B.base.Mdown * logsinzeta;
|
||||
|
||||
|
||||
// Now proceed to build the Hm2P matrix
|
||||
|
||||
|
||||
SQMat_CX Hm2P(0.0, A.base.Mdown);
|
||||
|
||||
|
||||
int index_a = 0;
|
||||
int index_b = 0;
|
||||
|
||||
|
||||
complex<DP> sum1 = 0.0;
|
||||
complex<DP> sum2 = 0.0;
|
||||
complex<DP> prod_num = 0.0;
|
||||
@@ -462,102 +477,102 @@ namespace JSC {
|
||||
complex<DP> Prod_powerN = 0.0;
|
||||
complex<DP> Fn_K_1_G_2 = 0.0;
|
||||
complex<DP> two_over_A_sinhlambda_sq_plus_sinzetaover2sq;
|
||||
|
||||
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
two_over_A_sinhlambda_sq_plus_sinzetaover2sq = 2.0/((sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
* (sinh(A.lambda[j][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ 0.25 * II * PI * (1.0 - A.chain.par[j])))
|
||||
+ pow(sin(0.5*A.chain.anis), 2.0));
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
|
||||
|
||||
if (B.chain.Str_L[k] == 1) {
|
||||
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta] + logsinzeta);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta] + logsinzeta);
|
||||
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
|
||||
Prod_powerN = pow( B.chain.par[k] == 1 ?
|
||||
(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.sinhlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coshlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
:
|
||||
(B.coshlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.sinhlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.coshlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.sinhlambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
, complex<DP> (B.chain.Nsites));
|
||||
|
||||
|
||||
//cout << "Prod_powerN = " << Prod_powerN << "\t" << abs(Prod_powerN) << endl;
|
||||
|
||||
|
||||
Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2 - two_over_A_sinhlambda_sq_plus_sinzetaover2sq
|
||||
* exp(II*im_ln_Fn_F_B_0[k][beta] + logsinzeta);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]] + logsinzeta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_FunctionF[jsum - 1]) + logsinzeta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_FunctionF[jsum - 1]) + logsinzeta);
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
|
||||
Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_sinhlambda_sq_plus_sinzetaover2sq);
|
||||
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
|
||||
complex<DP> ln_det = lndet_LU_CX_dstry(Hm2P);
|
||||
|
||||
|
||||
complex<DP> ln_ME = log(0.5 * sqrt(A.chain.Nsites)) + ln_prod1 - ln_prod2 - ln_prod3 + ln_prod4 + 2.0 * ln_det - A.lnnorm - B.lnnorm;
|
||||
|
||||
//cout << endl << ln_prod1 << "\t" << ln_prod2 << "\t" << ln_prod3 << "\t" << ln_prod4 << "\t" << A.lnnorm << "\t" << B.lnnorm
|
||||
|
||||
//cout << endl << ln_prod1 << "\t" << ln_prod2 << "\t" << ln_prod3 << "\t" << ln_prod4 << "\t" << A.lnnorm << "\t" << B.lnnorm
|
||||
//<< "\t" << re_ln_det << "\t" << ln_form_factor_sq << endl;
|
||||
|
||||
|
||||
//return(ln_ME_sq);
|
||||
return(ln_ME); // Return ME, not MEsq
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Sz_ME_XXZ_gpd.cc
|
||||
|
||||
Purpose: compute the S^z matrix elemment for XXZ_gpd
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
inline complex<DP> ln_Fn_F (XXZ_gpd_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
@@ -14,7 +29,7 @@ inline complex<DP> ln_Fn_F (XXZ_gpd_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
/*
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(-II * sin(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.eta * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b))));
|
||||
*/
|
||||
@@ -23,10 +38,10 @@ inline complex<DP> ln_Fn_F (XXZ_gpd_Bethe_State& B, int k, int beta, int b)
|
||||
|
||||
// arg = B.chain.Str_L[j] - B.chain.Str_L[k] - 2 * (a - b);
|
||||
// absarg = abs(arg);
|
||||
|
||||
|
||||
prod_temp *= -II * (B.sinlambda[j][alpha] * B.coslambda[k][beta] - B.coslambda[j][alpha] * B.sinlambda[k][beta])
|
||||
* cosh(0.5 * B.chain.anis * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b))) +
|
||||
(B.coslambda[j][alpha] * B.coslambda[k][beta] + B.sinlambda[j][alpha] * B.sinlambda[k][beta])
|
||||
(B.coslambda[j][alpha] * B.coslambda[k][beta] + B.sinlambda[j][alpha] * B.sinlambda[k][beta])
|
||||
* sinh(0.5 * B.chain.anis * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
|
||||
}
|
||||
@@ -81,7 +96,7 @@ inline complex<DP> Fn_K (XXZ_gpd_Bethe_State& A, int j, int alpha, int a, XXZ_gp
|
||||
{
|
||||
/*
|
||||
return(-1.0/(sin(A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)))
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)))
|
||||
* sin(A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 1.0)))));
|
||||
*/
|
||||
@@ -107,12 +122,12 @@ inline complex<DP> Fn_L (XXZ_gpd_Bethe_State& A, int j, int alpha, int a, XXZ_gp
|
||||
{
|
||||
/*
|
||||
complex<DP> ans = -II * sin(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))));
|
||||
+ 0.5 * II * B.chain.zeta * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))));
|
||||
|
||||
return (ans * pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
*/
|
||||
return (-II * sin(2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))))
|
||||
+ 0.5 * II * B.chain.anis * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -123,11 +138,11 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
|
||||
// Check that the two states refer to the same XXZ_gpd_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXZ_gpd_Chains in Sz matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXZ_gpd_Chains in Sz matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown) JSCerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown) ABACUSerror("Incompatible Mdown between the two states in Sz matrix element!");
|
||||
|
||||
if (A.iK == B.iK && (A.label != B.label))
|
||||
return(-300.0); // matrix element identically vanishes
|
||||
@@ -153,12 +168,12 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(sin(A.lambda[i][alpha] + 0.5 * II * A.chain.anis * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(sin(B.lambda[i][alpha] + 0.5 * II * B.chain.anis * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0))) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -184,7 +199,7 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a)
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
ln_prod3 += ln_Fn_F(A, j, alpha, a - 1);
|
||||
|
||||
ln_prod3 -= A.base.Mdown * log(abs(sinh(A.chain.anis)));
|
||||
|
||||
@@ -194,7 +209,7 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
ln_prod4 -= B.base.Mdown * log(abs(sinh(B.chain.anis)));
|
||||
|
||||
// Now proceed to build the Hm2P matrix
|
||||
@@ -215,11 +230,11 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
two_over_A_sinlambda_sq_plus_sinhetaover2sq = -2.0/((sin(A.lambda[j][alpha] // minus sign: from 1/(sinh^2... to -1/(sin^2...
|
||||
+ 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a))) *
|
||||
+ 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a))) *
|
||||
(sin(A.lambda[j][alpha] // minus sign: from 1/(sinh^2... to -1/(sin^2...
|
||||
+ 0.5 * II * A.chain.anis * (A.chain.Str_L[j] + 1.0 - 2.0 * a)))
|
||||
+ pow(sinh(0.5*A.chain.anis), 2.0));
|
||||
@@ -232,58 +247,58 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
Fn_K_0_G_0 = Fn_K (A, j, alpha, a, B, k, beta, 0) *
|
||||
exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinheta);
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
Fn_K_1_G_2 = Fn_K (A, j, alpha, a, B, k, beta, 1) *
|
||||
exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta] + logabssinheta);
|
||||
|
||||
Prod_powerN = pow((B.sinlambda[k][beta] * B.chain.co_n_anis_over_2[1] + II * B.coslambda[k][beta] * B.chain.si_n_anis_over_2[1])
|
||||
/(B.sinlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coslambda[k][beta] * B.chain.si_n_anis_over_2[1]),
|
||||
/(B.sinlambda[k][beta] * B.chain.co_n_anis_over_2[1] - II * B.coslambda[k][beta] * B.chain.si_n_anis_over_2[1]),
|
||||
complex<DP> (B.chain.Nsites));
|
||||
|
||||
Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2
|
||||
Hm2P[index_a][index_b] = Fn_K_0_G_0 - Prod_powerN * Fn_K_1_G_2
|
||||
- two_over_A_sinlambda_sq_plus_sinhetaover2sq * exp(II*im_ln_Fn_F_B_0[k][beta] + logabssinheta);
|
||||
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b <= B.chain.Str_L[k] - 1) Hm2P[index_a][index_b] = Fn_K(A, j, alpha, a, B, k, beta, b);
|
||||
else if (b == B.chain.Str_L[k]) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
sum1 = 0.0;
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) * exp(ln_FunctionG[0] + ln_FunctionG[1] - ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp(ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
sum2 = 0.0;
|
||||
|
||||
|
||||
for (int jsum = 1; jsum <= B.chain.Str_L[k]; ++jsum) sum2 += exp(ln_FunctionG[jsum] - ln_FunctionF[jsum]);
|
||||
|
||||
|
||||
prod_num = exp(II * im_ln_Fn_F_B_0[k][beta] + ln_FunctionF[1] - ln_FunctionG[B.chain.Str_L[k]] + logabssinheta);
|
||||
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinheta);
|
||||
for (int jsum = 2; jsum <= B.chain.Str_L[k]; ++jsum)
|
||||
prod_num *= exp(ln_FunctionG[jsum] - real(ln_Fn_F(B, k, beta, jsum - 1)) + logabssinheta);
|
||||
// include all string contributions F_B_0 in this term
|
||||
|
||||
Hm2P[index_a][index_b] = prod_num * (sum1 - sum2 * two_over_A_sinlambda_sq_plus_sinhetaover2sq);
|
||||
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
@@ -293,12 +308,12 @@ complex<DP> ln_Sz_ME (XXZ_gpd_Bethe_State& A, XXZ_gpd_Bethe_State& B)
|
||||
complex<DP> ln_ME_sq = log(0.25 * A.chain.Nsites) + real(ln_prod1 - ln_prod2) - real(ln_prod3) + real(ln_prod4)
|
||||
+ 2.0 * real(lndet_LU_CX_dstry(Hm2P)) - A.lnnorm - B.lnnorm;
|
||||
|
||||
//cout << endl << ln_prod1 << "\t" << ln_prod2 << "\t" << ln_prod3 << "\t" << ln_prod4 << "\t" << A.lnnorm << "\t" << B.lnnorm << "\t"
|
||||
//cout << endl << ln_prod1 << "\t" << ln_prod2 << "\t" << ln_prod3 << "\t" << ln_prod4 << "\t" << A.lnnorm << "\t" << B.lnnorm << "\t"
|
||||
// << lndet_LU_CX(Hm2P) << endl;
|
||||
|
||||
|
||||
//return(ln_ME_sq);
|
||||
return(0.5 * ln_ME_sq); // Return ME, not MEsq
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+123
-107
@@ -1,9 +1,25 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Szm_p_Smz_ME_XXX.cc
|
||||
|
||||
Purpose: compute the S^z_j S^-_{j+1} + S^m_j S^z_{j+1}
|
||||
matrix elemment for XXX
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
inline complex<DP> phi(complex<DP> x){return x;}
|
||||
inline complex<DP> a(complex<DP> x){return 1;}
|
||||
inline complex<DP> b(complex<DP> x,complex<DP> y, complex<DP> eta){ return phi(x-y)/phi(x-y+complex<DP>(0.0,1.0)*eta);}
|
||||
@@ -18,12 +34,12 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
@@ -56,8 +72,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -72,25 +88,25 @@ complex<DP> ln_Szm_p_Smz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
// Check that the two states refer to the same XXX_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Szm_p_Smz matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Szm_p_Smz matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown + 1) JSCerror("Incompatible Mdown between the two states in SzSm_p_SmSz matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown + 1) ABACUSerror("Incompatible Mdown between the two states in SzSm_p_SmSz matrix element!");
|
||||
|
||||
//if (B.type_id > 999999LL) return(complex<DP>(-300.0));
|
||||
|
||||
//add a delta to the origin of the centered strings
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
if(abs(A.lambda[i][alpha])<5.55112e-12)A.lambda[i][alpha]=5.55112e-12;
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
if(abs(A.lambda[i][alpha])<5.55112e-12)A.lambda[i][alpha]=5.55112e-12;
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
if(abs(B.lambda[i][alpha])<5.55112e-5)B.lambda[i][alpha]=5.55112e-5;
|
||||
|
||||
// Some convenient arrays
|
||||
|
||||
complex<DP> i=complex<DP>(0.0,1.0);
|
||||
complex<DP> i=complex<DP>(0.0,1.0);
|
||||
complex<DP> eta=-i;
|
||||
complex<DP> ln_prod = complex<DP>(0.0,0.0);
|
||||
complex<DP> result;
|
||||
@@ -98,16 +114,16 @@ complex<DP> ln_Szm_p_Smz_ME (XXX_Bethe_State& A, XXX_Bethe_State& B)
|
||||
|
||||
int sizeA=0;
|
||||
int sizeB=0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
sizeA+=A.base.Nrap[i]*A.chain.Str_L[i];
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
sizeB+=B.base.Nrap[i]*B.chain.Str_L[i];
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
sizeB+=B.base.Nrap[i]*B.chain.Str_L[i];
|
||||
|
||||
complex<DP>* mu = new complex<DP>[sizeA];
|
||||
complex<DP>* lam = new complex<DP>[sizeB];
|
||||
int index=0;
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
{
|
||||
@@ -117,7 +133,7 @@ int sizeB=0;
|
||||
}
|
||||
|
||||
index=0;
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
{
|
||||
@@ -138,12 +154,12 @@ index=0;
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -158,34 +174,34 @@ index=0;
|
||||
re_ln_Fn_G_0[j][alpha] = real(ln_Fn_G(A, B, j, alpha, 0));
|
||||
im_ln_Fn_G_0[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 0));
|
||||
re_ln_Fn_G_2[j][alpha] = real(ln_Fn_G(A, B, j, alpha, 2));
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
// for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
// for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
// for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
// ln_prod+=log(abs(phi((A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a))+eta*0.5)))
|
||||
|
||||
// for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
// for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
// for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
// for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
// ln_prod+=-log(abs(phi(-(B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a))+eta*0.5)));
|
||||
|
||||
// for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
// for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
// for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
// for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
// for (int j = 0; j < B.chain.Nstrings; ++j)
|
||||
// for (int j = 0; j < B.chain.Nstrings; ++j)
|
||||
// for (int beta = 0; beta < B.base.Nrap[j]; ++beta)
|
||||
// for (int b = 1; b <= B.chain.Str_L[j]; ++b)
|
||||
// if(i!=j || alpha!=beta ||a!=b)ln_prod3+=-0.5*log(abs(phi((B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a))-(B.lambda[j][beta] + 0.5 * II * (B.chain.Str_L[j] + 1.0 - 2.0 * b))-eta)));
|
||||
|
||||
// for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
// for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
// for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
// for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
// for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
// for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
// for (int beta = 0; beta < A.base.Nrap[j]; ++beta)
|
||||
// for (int b = 1; b <= A.chain.Str_L[j]; ++b)
|
||||
// if(abs((A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a))-(A.lambda[j][beta] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * b))-eta)!=0 && (i!=j && alpha!=beta && a!=b))
|
||||
@@ -197,20 +213,20 @@ index=0;
|
||||
//A -> mu, B -> lam
|
||||
complex<DP> prod=complex<DP>(1.0,0.0);
|
||||
complex<DP> prod2=complex<DP>(1.0,0.0);
|
||||
complex<DP> prod3=complex<DP>(1.0,0.0);
|
||||
complex<DP> prod3=complex<DP>(1.0,0.0);
|
||||
for(int l=0; l<sizeA;l++) prod*=phi(mu[l]+eta*0.5);
|
||||
for(int l=0; l<sizeB;l++) prod/=phi(lam[l]+eta*0.5);
|
||||
|
||||
|
||||
for(int l=0; l<sizeA;l++)
|
||||
for(int m=0; m<sizeA;m++)
|
||||
if(l!=m)prod2*=1.0/sqrt(abs(phi(mu[m]-mu[l]-eta)));
|
||||
for(int m=0; m<sizeA;m++)
|
||||
if(l!=m)prod2*=1.0/sqrt(abs(phi(mu[m]-mu[l]-eta)));
|
||||
for(int l=0; l<sizeB;l++)
|
||||
for(int m=0; m<sizeB;m++)
|
||||
for(int m=0; m<sizeB;m++)
|
||||
if(abs(lam[m]-lam[l]-eta)!=0 && l!=m)prod3*=1.0/sqrt(abs(phi(lam[m]-lam[l]-eta)));
|
||||
|
||||
result+=2.0*log(abs(prod))-2.0*log(prod3)+2.0*log(prod2) - A.lnnorm - B.lnnorm;// a factor prod3^2 is inserted in the determinant!
|
||||
// cout<<"prod:"<<prod<<endl;
|
||||
SQMat_CX Hm(0.0, A.base.Mdown);
|
||||
SQMat_CX Hm(0.0, A.base.Mdown);
|
||||
//complex<DP> H[sizeA][sizeA];
|
||||
// cout<<"mu[l]:";
|
||||
// for(int l=0; l<sizeA;l++)
|
||||
@@ -220,92 +236,92 @@ complex<DP> prod3=complex<DP>(1.0,0.0);
|
||||
// for(int l=0; l<sizeB;l++)
|
||||
// cout<<lam[l]<<", ";
|
||||
// cout<<endl;
|
||||
|
||||
|
||||
int index_a = 0;
|
||||
int index_b = 0;
|
||||
complex<DP> Prod_powerN;
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
|
||||
|
||||
if (B.chain.Str_L[k] == 1) {
|
||||
|
||||
|
||||
complex<DP> prodplus= complex<DP>(1.0,0.0);
|
||||
complex<DP> prodminus= complex<DP>(1.0,0.0);
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
|
||||
|
||||
prodplus = Fn_K (A, j, alpha, a, B, k, beta, 0);// 1.0/ (phi(mu[l]-lam[k]) phi(mu[l]-lam[k]+eta) )
|
||||
prodplus*= exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]+eta) / prod_l!=k |phi(lam[l]-lam[k]) |;
|
||||
prodminus = Fn_K (A, j, alpha, a, B, k, beta, 1);// 1.0/ (phi(mu[l]-lam[k]) phi(mu[l]-lam[k]-eta) )
|
||||
prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]-eta)/ prod_l!=k | phi(lam[l]-lam[k]) |;
|
||||
|
||||
|
||||
Prod_powerN = pow((B.lambda[k][beta] -eta*0.5) /(B.lambda[k][beta] +eta*0.5), complex<DP> (B.chain.Nsites));
|
||||
|
||||
|
||||
Hm[index_a][index_b] =eta*(prodplus-prodminus*Prod_powerN);
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b > 1) Hm[index_a][index_b] = eta* Fn_K(A, j, alpha, a, B, k, beta, b-1)*exp(ln_Fn_G(A,B,k,beta,b-1))*exp(-real(ln_Fn_F(B, k, beta, b - 1)));//.../ prod_l!=k | phi(lam[l]-lam[k]) |
|
||||
else if (b == 1) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
complex<DP> sum1 = complex<DP>(0.0,0.0);
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1] //sum term when i=0
|
||||
- ln_FunctionF[0] - ln_FunctionF[1]);
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k]) //sum term when i=n
|
||||
* exp( ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]);
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum)
|
||||
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
|
||||
|
||||
|
||||
Hm[index_a][index_b] = eta * exp(ln_FunctionF[0]+ ln_FunctionF[1] - ln_FunctionG[1]) * sum1 * exp( - real(ln_Fn_F(B, k, beta, b - 1))); //the absolute value prod_l!=k phi(lam[l]-lam[k]) : real(ln_...)
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
//Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
|
||||
//Hm[index_a][B.base.Mdown] = eta/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
|
||||
|
||||
//Hm[index_a][B.base.Mdown] = one_over_A_lambda_sq_plus_1over2sq;
|
||||
//Hm[index_a][B.base.Mdown] = eta/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) *
|
||||
// (A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
Hm[index_a][B.base.Mdown] = eta/((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5));
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
|
||||
// cout<<"Hm:";
|
||||
// for(int j=0; j<sizeA;j++){
|
||||
// for(int k=0; k<sizeA;k++) cout<<"Hm["<<j<<"]["<<k<<"]:"<<Hm[j][k]<<", ";
|
||||
// cout<<endl;
|
||||
// cout<<endl;
|
||||
// }
|
||||
|
||||
|
||||
complex<DP> F= complex<DP>(0.0,0.0);
|
||||
|
||||
|
||||
complex<DP> detmatrix;
|
||||
detmatrix=exp(lndet_LU_CX_dstry(Hm));
|
||||
//cout<<"exp(lndet_LU_CX(Hm)):"<<abs(detmatrix)<<endl;
|
||||
// cout<<"exp(i*(A.K-B.K))+1.0):"<<exp(i*(A.K-B.K))+1.0<<"det(matrix):"<<detmatrix<<endl;
|
||||
// cout<<"exp(i*(A.K-B.K))+1.0):"<<exp(i*(A.K-B.K))+1.0<<"det(matrix):"<<detmatrix<<endl;
|
||||
//F=-(exp(-i*(A.K-B.K))+1.0)*detmatrix;
|
||||
|
||||
//mu is the ground state!
|
||||
@@ -313,30 +329,30 @@ complex<DP> prod3=complex<DP>(1.0,0.0);
|
||||
SQMat_CX G(0.0, A.base.Mdown);
|
||||
SQMat_CX BbDa(0.0, A.base.Mdown);
|
||||
index_a = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
complex<DP> Da;
|
||||
complex<DP> Ca;
|
||||
Da=eta/((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5));
|
||||
Ca=eta*((mu[index_a]-eta*0.5)+(mu[index_a]+eta*0.5))/pow(((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5)),2.0);
|
||||
|
||||
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
|
||||
|
||||
/*if (B.chain.Str_L[k] == 1) {
|
||||
|
||||
complex<DP> Bb;
|
||||
Bb=-(phi(lam[index_b]+eta*0.5)+phi(lam[index_b]-eta*0.5));
|
||||
Bb=-(phi(lam[index_b]+eta*0.5)+phi(lam[index_b]-eta*0.5));
|
||||
complex<DP> product=complex<DP>(1.0,0.0);
|
||||
for(int o=0; o<sizeB;o++)product*=phi(lam[o]-lam[index_b]+eta);
|
||||
Bb*=product;
|
||||
for(int o=0; o<sizeB;o++)product*=phi(lam[o]-lam[index_b]+eta);
|
||||
Bb*=product;
|
||||
|
||||
complex<DP> prodplus= complex<DP>(1.0,0.0);
|
||||
complex<DP> prodminus= complex<DP>(1.0,0.0);
|
||||
@@ -348,44 +364,44 @@ SQMat_CX BbDa(0.0, A.base.Mdown);
|
||||
prodminus = Fn_K (A, j, alpha, a, B, k, beta, 1);// 1.0/ (phi(mu[l]-lam[k]) phi(mu[l]-lam[k]-eta) )
|
||||
prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]-eta)/ prod_l!=k | phi(lam[l]-lam[k]) |;
|
||||
// prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta]);// - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]-eta)/ prod_l!=k | phi(lam[l]-lam[k]) |;
|
||||
|
||||
|
||||
Prod_powerN = pow((B.lambda[k][beta] - eta*0.5) /(B.lambda[k][beta] + eta*0.5), complex<DP> (B.chain.Nsites));
|
||||
|
||||
|
||||
G[index_a][index_b] =eta*(prodplus-prodminus*Prod_powerN);
|
||||
BbDa[index_a][index_b]=Bb*Da*exp(- re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
*/{
|
||||
|
||||
if (b > 1){
|
||||
|
||||
if (b > 1){
|
||||
G[index_a][index_b] = eta* Fn_K(A, j, alpha, a, B, k, beta, b-1)*exp(ln_Fn_G(A,B,k,beta,b-1))*exp(-real(ln_Fn_F(B, k, beta, b - 1)));//.../ prod_l!=k | phi(lam[l]-lam[k]) |
|
||||
BbDa[index_a][index_b] =0 ;
|
||||
}
|
||||
else if (b == 1) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
complex<DP> sum1 = complex<DP>(0.0,0.0);
|
||||
complex<DP> sum2 = complex<DP>(0.0,0.0);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1]
|
||||
- ln_FunctionF[0] - ln_FunctionF[1]);//sum term when i=0
|
||||
//sum2 doesn't have a i=0 term
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp( ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]); //sum term when i=n
|
||||
sum2 += exp(ln_FunctionG[B.chain.Str_L[k]]- ln_FunctionF[B.chain.Str_L[k]] )
|
||||
* (phi((B.lambda[k][beta] + 0.5 * II * (B.chain.Str_L[k] + 1.0 - 2.0 * B.chain.Str_L[k]))-eta*0.5)
|
||||
+ phi((B.lambda[k][beta] + 0.5 * II * (B.chain.Str_L[k] + 1.0 - 2.0 * B.chain.Str_L[k]))+eta*0.5) ); //sum term when i=n
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) {
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) {
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
sum2 += exp(ln_FunctionG[jsum]- ln_FunctionF[jsum] )
|
||||
@@ -396,12 +412,12 @@ SQMat_CX BbDa(0.0, A.base.Mdown);
|
||||
G[index_a][index_b] = eta * exp(ln_FunctionF[0]+ ln_FunctionF[1] - ln_FunctionG[1]) * sum1 * exp( - real(ln_Fn_F(B, k, beta, b - 1))); //the absolute value prod_l!=k phi(lam[l]-lam[k]) : real(ln_...)
|
||||
BbDa[index_a][index_b] = - Da* exp(ln_FunctionF[0]+ ln_FunctionF[1] - ln_FunctionG[1]) * sum2 * exp( - real(ln_Fn_F(B, k, beta, b - 1)));//the absolute value prod_l!=k phi(lam[l]-lam[k]) : real(ln_...)
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
|
||||
// now define the elements Hm[a][M]
|
||||
|
||||
|
||||
|
||||
//Hm[index_a][B.base.Mdown] = eta/((A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) * (A.lambda[j][alpha] + 0.5 * II * (A.chain.Str_L[j] + 1.0 - 2.0 * a)) + 0.25);
|
||||
G[index_a][B.base.Mdown]=Ca;
|
||||
@@ -409,7 +425,7 @@ SQMat_CX BbDa(0.0, A.base.Mdown);
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
for(int a=0; a<sizeA;a++)
|
||||
for(int b=0; b<sizeA;b++)
|
||||
matrix[a][b]=G[a][b]+BbDa[a][b];
|
||||
@@ -417,25 +433,25 @@ SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
// cout<<"matrix:";
|
||||
// for(int j=0; j<sizeA;j++){
|
||||
// for(int k=0; k<sizeA;k++) cout<<"matrix["<<j<<"]["<<k<<"]:"<<matrix[j][k]<<", ";
|
||||
// cout<<endl;
|
||||
// cout<<endl;
|
||||
// }
|
||||
// cout<<"matrixtest:";
|
||||
// for(int j=0; j<sizeA;j++){
|
||||
// for(int k=0; k<sizeA;k++) cout<<"matrixtest["<<j<<"]["<<k<<"]:"<<matrixtest[j][k]<<", ";
|
||||
// cout<<endl;
|
||||
// cout<<endl;
|
||||
// }
|
||||
|
||||
|
||||
// cout<<"BbDa[a][b]:";
|
||||
// for(int j=0; j<sizeA;j++){
|
||||
// for(int k=0; k<sizeA;k++) cout<<"BbDa["<<j<<"]["<<k<<"]:"<<BbDa[j][k]<<", ";
|
||||
// cout<<endl;
|
||||
// cout<<endl;
|
||||
// }
|
||||
// cout<<"Bn[b]*Da[a]:";
|
||||
// for(int j=0; j<sizeA;j++){
|
||||
// for(int k=0; k<sizeA;k++) cout<<"test["<<j<<"]["<<k<<"]:"<<Bn[k]*Da[j]<<", ";
|
||||
// cout<<endl;
|
||||
// cout<<endl;
|
||||
// }
|
||||
|
||||
|
||||
// cout<<"prod:"<<prod<<endl;
|
||||
// cout<<"(exp(lndet_LU_CX_dstry(matrix))-exp(lndet_LU_CX_dstry(G))):"<<(exp(lndet_LU_CX(matrix))-exp(lndet_LU_CX(G)))<<endl;
|
||||
// cout<<"(exp(lndet_LU_CX_dstry(matrix)):"<<(exp(lndet_LU_CX(matrix)))<<endl;
|
||||
@@ -447,13 +463,13 @@ SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
//cout<<"an(n):"<< an(n)<< "det(matrix):"<<det(matrix)<<" det(Gn):"<<det(Gn)<<endl;
|
||||
|
||||
//sum_nm_test=(0.5*(lam[0]-lam[1])*(eta*eta+4.0*lam[0]*lam[1]))/pow((lam[0]-eta/2.0)*(lam[0]+eta/2.0)*(lam[1]-eta/2.0)*(lam[1]+eta/2.0),2.0)*(0.5*(mu[0]-mu[1])*(eta*eta+4.0*mu[0]*mu[1]))/pow((mu[0]-eta/2.0)*(mu[0]+eta/2.0)*(mu[1]-eta/2.0)*(mu[1]+eta/2.0),2.0);
|
||||
//sum_nm_test=(0.5*(lam[0]-lam[1])*(eta*eta+4.0*lam[0]*lam[1]))*(0.5*(mu[0]-mu[1])*(eta*eta+4.0*mu[0]*mu[1]))/pow((mu[0]-eta/2.0)*(mu[0]+eta/2.0)*(mu[1]-eta/2.0)*(mu[1]+eta/2.0),2.0);
|
||||
//sum_nm_test=(0.5*(lam[0]-lam[1])*(eta*eta+4.0*lam[0]*lam[1]))*(0.5*(mu[0]-mu[1])*(eta*eta+4.0*mu[0]*mu[1]))/pow((mu[0]-eta/2.0)*(mu[0]+eta/2.0)*(mu[1]-eta/2.0)*(mu[1]+eta/2.0),2.0);
|
||||
//cout<<"F1:"<<F<<endl;
|
||||
// F+=4.0*pow(prod,2)*exp(i*(qlam+qmu))*sum_n;
|
||||
|
||||
|
||||
// F+=+2.0*exp(i*(A.K-B.K))*sum;
|
||||
|
||||
complex<DP> F2=exp(eta*(B.K-A.K))*(-2.0*sum);
|
||||
complex<DP> F2=exp(eta*(B.K-A.K))*(-2.0*sum);
|
||||
complex<DP> F3=(exp(eta*(B.K-A.K)))*(detmatrix);
|
||||
F=detmatrix;
|
||||
// cout<<"F1:"<<F*sqrt(exp(result))<<" F2:"<<F2*sqrt(exp(result))<<" F3:"<<F3*sqrt(exp(result))<<endl;
|
||||
@@ -474,17 +490,17 @@ SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
//result*=pow(abs(2.0*exp(i*(A.K-B.K))*sum),2);
|
||||
//result/=(B.chain.Nsites)*1/16.0;
|
||||
//cout<<"TEST::::::::::::::::::::::"<<"A.Check_Admissibility('a'):"<<A.Check_Admissibility('a')<<endl;
|
||||
//cout<<"mu:"<<mu<<" lam:"<<lam<<endl;
|
||||
// cout<<"an(n):"<<an<<endl;
|
||||
//cout<<"mu:"<<mu<<" lam:"<<lam<<endl;
|
||||
// cout<<"an(n):"<<an<<endl;
|
||||
// cout<<"prod^2:"<<pow(abs(prod),2)<<endl;
|
||||
// cout<<"prod3:"<<prod3<<endl;
|
||||
// cout<<"prod2:"<<prod2<<endl;
|
||||
|
||||
|
||||
// cout<<"normlam"<<"normmu:"<<(exp(A.lnnorm))<<":"<<(exp(B.lnnorm))<<endl;
|
||||
|
||||
|
||||
// cout<<"normlam"<<"normmu:"<<(exp(A.lnnorm))<<":"<<(exp(B.lnnorm))<<endl;
|
||||
// cout<<"abs(prod*prod*prod2*sum_n):"<<abs(prod*prod*prod2*sum_n)<<endl;
|
||||
|
||||
|
||||
|
||||
|
||||
//cout<<"computation time for Szm:"<<clock()-start_time_local<<endl;
|
||||
complex<DP> ln_ME_sq = result;
|
||||
|
||||
@@ -499,4 +515,4 @@ complex<DP> ln_ME_sq = result;
|
||||
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+99
-84
@@ -1,8 +1,23 @@
|
||||
#include "JSC.h"
|
||||
/**********************************************************
|
||||
|
||||
using namespace JSC;
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
namespace JSC {
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: ln_Szz_ME_XXX.cc
|
||||
|
||||
Purpose: compute the S^z_j S^z_{j+1} matrix elemment for XXX
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
complex<DP> phi(complex<DP> x){return x;}
|
||||
complex<DP> a(complex<DP> x){return 1;}
|
||||
@@ -18,12 +33,12 @@ inline complex<DP> ln_Fn_F (XXX_Bethe_State& B, int k, int beta, int b)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= B.chain.Str_L[j]; ++a) {
|
||||
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
if (!((j == k) && (alpha == beta) && (a == b)))
|
||||
ans += log(B.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
+ 0.5 * II * (B.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(ans);
|
||||
}
|
||||
@@ -56,8 +71,8 @@ inline complex<DP> Fn_K (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_State& B, int k, int beta, int b)
|
||||
{
|
||||
return ((2.0 * (A.lambda[j][alpha] - B.lambda[k][beta]
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
+ 0.5 * II * (A.chain.Str_L[j] - B.chain.Str_L[k] - 2.0 * (a - b - 0.5))
|
||||
))
|
||||
* pow(Fn_K (A, j, alpha, a, B, k, beta, b), 2.0));
|
||||
}
|
||||
|
||||
@@ -73,11 +88,11 @@ inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
|
||||
// Check that the two states refer to the same XXX_Chain
|
||||
|
||||
if (A.chain != B.chain) JSCerror("Incompatible XXX_Chains in Szz matrix element.");
|
||||
if (A.chain != B.chain) ABACUSerror("Incompatible XXX_Chains in Szz matrix element.");
|
||||
|
||||
// Check that A and B are compatible: same Mdown
|
||||
|
||||
if (A.base.Mdown != B.base.Mdown) JSCerror("Incompatible Mdown between the two states in Szz matrix element!");
|
||||
if (A.base.Mdown != B.base.Mdown) ABACUSerror("Incompatible Mdown between the two states in Szz matrix element!");
|
||||
|
||||
complex<DP> eta=-II;
|
||||
complex<DP> ln_prod = complex<DP>(0.0,0.0);
|
||||
@@ -85,54 +100,54 @@ inline complex<DP> Fn_L (XXX_Bethe_State& A, int j, int alpha, int a, XXX_Bethe_
|
||||
complex<DP> prev_result=-300;
|
||||
|
||||
//if(A.String_delta()> HEIS_deltaprec) return(complex<DP>(-300.0)); // DEPRECATED in ++T_9
|
||||
|
||||
|
||||
if((A.E)==(B.E) && B.chain.Nsites ==B.base.Mdown*2){
|
||||
return(2*log(abs((B.E+(B.chain.Nsites)/4.0)/(3.0*sqrt(B.chain.Nsites)))));
|
||||
}
|
||||
|
||||
XXX_Bethe_State A_origin; A_origin=A;
|
||||
bool zero_string=false;
|
||||
for (int j = 0; j < A_origin.chain.Nstrings; ++j)
|
||||
for (int j = 0; j < A_origin.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A_origin.base.Nrap[j]; ++alpha)
|
||||
if(abs(A_origin.lambda[j][alpha])<Zero_Center_Thres) zero_string=true;
|
||||
|
||||
|
||||
// Some convenient arrays
|
||||
bool real_dev_conv=false;
|
||||
int dev=-1;
|
||||
while(!real_dev_conv){
|
||||
real_dev_conv=true;
|
||||
|
||||
|
||||
dev++;
|
||||
|
||||
|
||||
//add a delta to the origin of the centered strings
|
||||
if(zero_string){
|
||||
real_dev_conv=false;
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
real_dev_conv=false;
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha)
|
||||
if(abs(A_origin.lambda[j][alpha])<Zero_Center_Thres)
|
||||
A.lambda[j][alpha]=real_dev*pow(10.0,dev);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
prev_result=result;
|
||||
|
||||
//add manualy the ground state value
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int sizeA=0;
|
||||
int sizeB=0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
sizeA+=A.base.Nrap[i]*A.chain.Str_L[i];
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
sizeB+=B.base.Nrap[i]*B.chain.Str_L[i];
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
sizeB+=B.base.Nrap[i]*B.chain.Str_L[i];
|
||||
|
||||
complex<DP>* mu = new complex<DP>[sizeA];
|
||||
complex<DP>* lam = new complex<DP>[sizeB];
|
||||
int index=0;
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
{
|
||||
@@ -141,7 +156,7 @@ int sizeB=0;
|
||||
}
|
||||
|
||||
index=0;
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
{
|
||||
@@ -163,12 +178,12 @@ index=0;
|
||||
complex<DP> ln_prod3 = 0.0;
|
||||
complex<DP> ln_prod4 = 0.0;
|
||||
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < A.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < A.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= A.chain.Str_L[i]; ++a)
|
||||
ln_prod1 += log(norm(A.lambda[i][alpha] + 0.5 * II * (A.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)));
|
||||
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int i = 0; i < B.chain.Nstrings; ++i)
|
||||
for (int alpha = 0; alpha < B.base.Nrap[i]; ++alpha)
|
||||
for (int a = 1; a <= B.chain.Str_L[i]; ++a)
|
||||
if (norm(B.lambda[i][alpha] + 0.5 * II * (B.chain.Str_L[i] + 1.0 - 2.0 * a - 1.0)) > 100.0 * MACHINE_EPS_SQ)
|
||||
@@ -189,7 +204,7 @@ index=0;
|
||||
re_ln_Fn_G_0[j][alpha] = real(ln_Fn_G(A, B, j, alpha, 0));
|
||||
im_ln_Fn_G_0[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 0));
|
||||
re_ln_Fn_G_2[j][alpha] = real(ln_Fn_G(A, B, j, alpha, 2));
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
im_ln_Fn_G_2[j][alpha] = imag(ln_Fn_G(A, B, j, alpha, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +223,7 @@ for (int k = 0; k < A.chain.Nstrings; ++k)
|
||||
if (b == 1) ln_prod4 += re_ln_Fn_F_B_0[k][beta];
|
||||
else if (b > 1) ln_prod4 += ln_Fn_F(B, k, beta, b - 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
complex<DP> prod=complex<DP>(1.0,0.0);
|
||||
for(int l=0; l<sizeA;l++) prod*=phi(mu[l]+eta*0.5);
|
||||
@@ -216,83 +231,83 @@ complex<DP> prod=complex<DP>(1.0,0.0);
|
||||
|
||||
double factor = log((B.chain.Nsites)*1/16.0);
|
||||
factor +=(2.0*log(abs(prod)) - real(ln_prod3) + real(ln_prod4) - A.lnnorm - B.lnnorm);// a factor prod4^-2 is inserted in the determinant!
|
||||
|
||||
|
||||
|
||||
|
||||
int index_a = 0;
|
||||
int index_b = 0;
|
||||
complex<DP> Prod_powerN;
|
||||
|
||||
|
||||
|
||||
SQMat_CX H(0.0, A.base.Mdown);
|
||||
SQMat_CX P(0.0, A.base.Mdown);
|
||||
index_a = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
complex<DP> Da;
|
||||
complex<DP> Ca;
|
||||
Da=eta/((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5));
|
||||
|
||||
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
|
||||
|
||||
if (B.chain.Str_L[k] == 1) {
|
||||
|
||||
complex<DP> Bb=complex<DP>(1.0,0.0);
|
||||
for(int o=0; o<sizeB;o++)Bb*=phi(lam[o]-lam[index_b]+eta);
|
||||
for(int o=0; o<sizeB;o++)Bb*=phi(lam[o]-lam[index_b]+eta);
|
||||
|
||||
complex<DP> prodplus= complex<DP>(1.0,0.0);
|
||||
complex<DP> prodminus= complex<DP>(1.0,0.0);
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
prodplus = Fn_K (A, j, alpha, a, B, k, beta, 0);
|
||||
|
||||
|
||||
prodplus*= exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
|
||||
prodminus = Fn_K (A, j, alpha, a, B, k, beta, 1);
|
||||
|
||||
prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
|
||||
prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
Prod_powerN = pow((B.lambda[k][beta] - eta*0.5) /(B.lambda[k][beta] + eta*0.5), complex<DP> (B.chain.Nsites));
|
||||
|
||||
|
||||
H[index_a][index_b] = eta*(prodplus-prodminus*Prod_powerN);
|
||||
P[index_a][index_b] = Bb*Da*exp(- re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else {
|
||||
|
||||
if (b > 1){
|
||||
if (b > 1){
|
||||
H[index_a][index_b] = eta* Fn_K(A, j, alpha, a, B, k, beta, b-1)*exp(ln_Fn_G(A,B,k,beta,b-1))*exp(-real(ln_Fn_F(B, k, beta, b - 1)));//.../ prod_l!=k | phi(lam[l]-lam[k]) |
|
||||
P[index_a][index_b] =0 ;
|
||||
}
|
||||
else if (b == 1) {
|
||||
|
||||
|
||||
Vect_CX ln_FunctionF(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionF[i] = ln_Fn_F (B, k, beta, i);
|
||||
|
||||
|
||||
Vect_CX ln_FunctionG(B.chain.Str_L[k] + 2);
|
||||
for (int i = 0; i < B.chain.Str_L[k] + 2; ++i) ln_FunctionG[i] = ln_Fn_G (A, B, k, beta, i);
|
||||
|
||||
|
||||
complex<DP> sum1 = complex<DP>(0.0,0.0);
|
||||
complex<DP> sum2 = complex<DP>(0.0,0.0);
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1]
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, 0) *exp(ln_FunctionG[0]+ ln_FunctionG[1]
|
||||
- ln_FunctionF[0] - ln_FunctionF[1]);//sum term when i=0
|
||||
//sum2 doesn't have a i=0 term
|
||||
|
||||
|
||||
sum1 += Fn_K (A, j, alpha, a, B, k, beta, B.chain.Str_L[k])
|
||||
* exp( ln_FunctionG[B.chain.Str_L[k]] + ln_FunctionG[B.chain.Str_L[k] + 1]
|
||||
- ln_FunctionF[B.chain.Str_L[k]] - ln_FunctionF[B.chain.Str_L[k] + 1]); //sum term when i=n
|
||||
sum2 += exp(ln_FunctionG[B.chain.Str_L[k]]- ln_FunctionF[B.chain.Str_L[k]] ); //sum term when i=n
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) {
|
||||
|
||||
for (int jsum = 1; jsum < B.chain.Str_L[k]; ++jsum) {
|
||||
sum1 -= Fn_L (A, j, alpha, a, B, k, beta, jsum) *
|
||||
exp(ln_FunctionG[jsum] + ln_FunctionG[jsum + 1] - ln_FunctionF[jsum] - ln_FunctionF[jsum + 1]);
|
||||
sum2 += exp(ln_FunctionG[jsum]- ln_FunctionF[jsum] );
|
||||
@@ -301,21 +316,21 @@ SQMat_CX P(0.0, A.base.Mdown);
|
||||
H[index_a][index_b] = eta * exp(ln_FunctionF[0]+ ln_FunctionF[1] - ln_FunctionG[1]) * sum1 * exp( - real(ln_Fn_F(B, k, beta, b - 1))); //the absolute value prod_l!=k phi(lam[l]-lam[k]) : real(ln_...)
|
||||
P[index_a][index_b] = - Da* exp(ln_FunctionF[0]+ ln_FunctionF[1] - ln_FunctionG[1]) * sum2 * exp( - real(ln_Fn_F(B, k, beta, b - 1)));//the absolute value prod_l!=k phi(lam[l]-lam[k]) : real(ln_...)
|
||||
} // else if (b == B.chain.Str_L[k])
|
||||
} // else
|
||||
} // else
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
complex<DP> F= complex<DP>(0.0,0.0);
|
||||
|
||||
|
||||
|
||||
SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
for(int j=0; j<sizeA;j++)
|
||||
for(int k=0; k<sizeA;k++){
|
||||
matrix[j][k]=(H[j][k]-2.0*P[j][k]);
|
||||
}
|
||||
}
|
||||
complex<DP> detmatrix;
|
||||
detmatrix=exp(lndet_LU_CX_dstry(matrix)+0.5*factor);
|
||||
|
||||
@@ -331,59 +346,59 @@ SQMat_CX Gn(0.0, A.base.Mdown);
|
||||
SQMat_CX Gn(0.0, A.base.Mdown);
|
||||
SQMat_CX BnbDa(0.0, A.base.Mdown);
|
||||
index_a = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < A.chain.Nstrings; ++j) {
|
||||
for (int alpha = 0; alpha < A.base.Nrap[j]; ++alpha) {
|
||||
for (int a = 1; a <= A.chain.Str_L[j]; ++a) {
|
||||
|
||||
|
||||
index_b = 0;
|
||||
|
||||
|
||||
complex<DP> Da;
|
||||
complex<DP> Ca;
|
||||
Da=eta/((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5));
|
||||
Ca=(eta)*((mu[index_a]-eta*0.5)+(mu[index_a]+eta*0.5))/pow(((mu[index_a]-eta*0.5)*(mu[index_a]+eta*0.5)),2.0);
|
||||
|
||||
|
||||
for (int k = 0; k < B.chain.Nstrings; ++k) {
|
||||
for (int beta = 0; beta < B.base.Nrap[k]; ++beta) {
|
||||
for (int b = 1; b <= B.chain.Str_L[k]; ++b) {
|
||||
if(index_b==n){
|
||||
if(index_b==n){
|
||||
Gn[index_a][index_b] = Ca*exp(-real(ln_Fn_F(B, k, beta, b - 1)));
|
||||
BnbDa[index_a][index_b] = 0;
|
||||
} // else (index_b!=n)
|
||||
else if (B.chain.Str_L[k] == 1) {
|
||||
complex<DP> Bnb;
|
||||
Bnb=-phi(lam[index_b]+eta*0.5)/phi(lam[n]-lam[index_b]-eta);
|
||||
Bnb=-phi(lam[index_b]+eta*0.5)/phi(lam[n]-lam[index_b]-eta);
|
||||
complex<DP> product=complex<DP>(1.0,0.0);
|
||||
for(int o=0; o<sizeB;o++)product*=phi(lam[o]-lam[index_b]+eta);
|
||||
Bnb*=product;
|
||||
|
||||
for(int o=0; o<sizeB;o++)product*=phi(lam[o]-lam[index_b]+eta);
|
||||
Bnb*=product;
|
||||
|
||||
complex<DP> prodplus= complex<DP>(1.0,0.0);
|
||||
complex<DP> prodminus= complex<DP>(1.0,0.0);
|
||||
|
||||
|
||||
// use simplified code for one-string here: original form of Hm2P matrix
|
||||
prodplus = Fn_K (A, j, alpha, a, B, k, beta, 0);// 1.0/ (phi(mu[l]-lam[k]) phi(mu[l]-lam[k]+eta) )
|
||||
prodplus*= exp(re_ln_Fn_G_0[k][beta] + II * im_ln_Fn_G_0[k][beta] - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]+eta) / prod_l!=k |phi(lam[l]-lam[k]) |;
|
||||
prodminus = Fn_K (A, j, alpha, a, B, k, beta, 1);// 1.0/ (phi(mu[l]-lam[k]) phi(mu[l]-lam[k]-eta) )
|
||||
prodminus*= exp(re_ln_Fn_G_2[k][beta] + II * im_ln_Fn_G_2[k][beta] - re_ln_Fn_F_B_0[k][beta]);//Prod phi(mu[l]-lam[k]-eta)/ prod_l!=k | phi(lam[l]-lam[k]) |;
|
||||
|
||||
|
||||
Prod_powerN = pow((B.lambda[k][beta] - eta*0.5) /(B.lambda[k][beta] + eta*0.5), complex<DP> (B.chain.Nsites));
|
||||
|
||||
|
||||
Gn[index_a][index_b] =eta*(prodplus-prodminus*Prod_powerN);
|
||||
BnbDa[index_a][index_b]=Bnb*Da*exp(- re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
BnbDa[index_a][index_b]=Bnb*Da*exp(- re_ln_Fn_F_B_0[k][beta]);
|
||||
|
||||
} // if (B.chain.Str_L == 1)
|
||||
|
||||
|
||||
else{
|
||||
JSCerror("The Szz matrix element computation is not able to handle string states in the B.state (second argument). This is in development...");
|
||||
|
||||
} // else
|
||||
ABACUSerror("The Szz matrix element computation is not able to handle string states in the B.state (second argument). This is in development...");
|
||||
|
||||
} // else
|
||||
index_b++;
|
||||
}}} // sums over k, beta, b
|
||||
|
||||
index_a++;
|
||||
}}} // sums over j, alpha, a
|
||||
|
||||
SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
|
||||
SQMat_CX matrix(0.0, A.base.Mdown);
|
||||
for(int a=0; a<sizeA;a++)
|
||||
for(int b=0; b<sizeA;b++)
|
||||
matrix[a][b]=Gn[a][b]+BnbDa[a][b];
|
||||
@@ -398,7 +413,7 @@ result=2*log(abs(F));
|
||||
|
||||
if (!(real_dev_conv) && abs(exp(result)-exp(prev_result))<abs( Diff_ME_Thres*exp(result))){
|
||||
real_dev_conv=true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(real_dev_conv) && dev >20){
|
||||
result=-300;
|
||||
@@ -409,9 +424,9 @@ result=2*log(abs(F));
|
||||
delete[] lam;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//return(result);
|
||||
return(0.5 * result); // Return ME, not MEsq
|
||||
}
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**********************************************************
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS++ library.
|
||||
|
||||
Copyright (c)
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: Infprec.cc
|
||||
|
||||
Purpose: Definitions for infinite precision arithmetic classes.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
|
||||
//***************************************************************************************************
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
+231
-232
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's C++ library.
|
||||
|
||||
Copyright (c) 2006.
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,16 +10,14 @@ Integration_par.cc
|
||||
|
||||
Defines all functions to perform integration of functions, parallel (MPI).
|
||||
|
||||
LAST MODIFIED: 30/10/06
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
#include "mpi.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
void Improve_estimate_par (MPI_Comm comm, Integral_data& integdat, DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, int max_nr_pts)
|
||||
{
|
||||
@@ -44,10 +42,10 @@ namespace JSC {
|
||||
threei = 3 * i;
|
||||
|
||||
if (integdat.abs_d2f_dx[i] <= 0.1 * integdat.max_abs_d2f_dx || index_new + integdat.integ_res.n_vals - threei > max_nr_pts) {
|
||||
|
||||
|
||||
// simply transfer the data points into new_data
|
||||
new_abs_d2f_dx[index_new/3] = integdat.abs_d2f_dx[i];
|
||||
new_max_abs_d2f_dx = JSC::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3]);
|
||||
new_max_abs_d2f_dx = ABACUS::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3]);
|
||||
for (j = 0; j < 3; ++j) {
|
||||
new_data[index_new].x = integdat.data[threei + j].x;
|
||||
new_data[index_new].f = integdat.data[threei + j].f;
|
||||
@@ -98,12 +96,12 @@ namespace JSC {
|
||||
new_abs_d2f_dx[index_new/3 + 1] = fabs(new_data[index_new].dx * (new_data[index_new + 3].f - 2.0 * new_data[index_new + 4].f + new_data[index_new + 5].f));
|
||||
new_abs_d2f_dx[index_new/3 + 2] = fabs(new_data[index_new].dx * (new_data[index_new + 6].f - 2.0 * new_data[index_new + 7].f + new_data[index_new + 8].f));
|
||||
|
||||
new_max_abs_d2f_dx = JSC::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3]);
|
||||
new_max_abs_d2f_dx = JSC::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3 + 1]);
|
||||
new_max_abs_d2f_dx = JSC::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3 + 2]);
|
||||
new_max_abs_d2f_dx = ABACUS::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3]);
|
||||
new_max_abs_d2f_dx = ABACUS::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3 + 1]);
|
||||
new_max_abs_d2f_dx = ABACUS::max(new_max_abs_d2f_dx, new_abs_d2f_dx[index_new/3 + 2]);
|
||||
|
||||
integdat.integ_res.integ_est += new_data[index_new].dx * (new_data[index_new].f + new_data[index_new + 1].f + new_data[index_new + 2].f
|
||||
+ new_data[index_new + 3].f + new_data[index_new + 4].f + new_data[index_new + 5].f
|
||||
+ new_data[index_new + 3].f + new_data[index_new + 4].f + new_data[index_new + 5].f
|
||||
+ new_data[index_new + 6].f + new_data[index_new + 7].f + new_data[index_new + 8].f);
|
||||
|
||||
integdat.integ_res.abs_prec += new_abs_d2f_dx[index_new/3] + new_abs_d2f_dx[index_new/3 + 1] + new_abs_d2f_dx[index_new/3 + 2];
|
||||
@@ -130,10 +128,10 @@ namespace JSC {
|
||||
}
|
||||
|
||||
|
||||
Integral_result Integrate_optimal_par_using_table (MPI_Comm comm, DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ,
|
||||
Integral_result Integrate_optimal_par_using_table (MPI_Comm comm, DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ,
|
||||
I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, ofstream& outfile)
|
||||
{
|
||||
if (xmax < xmin) JSCerror("Use xmax > xmin in Integrate.");
|
||||
if (xmax < xmin) ABACUSerror("Use xmax > xmin in Integrate.");
|
||||
|
||||
Integral_data integ_dat (function, args, arg_to_integ, Itable, xmin, xmax);
|
||||
|
||||
@@ -149,4 +147,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,11 +12,11 @@ Purpose: Definitions for LiebLin_Bethe_State class.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//***************************************************************************************************
|
||||
|
||||
@@ -24,27 +24,27 @@ namespace JSC {
|
||||
|
||||
LiebLin_Bethe_State::LiebLin_Bethe_State ()
|
||||
: c_int (0.0), L(0.0), cxL(0.0), N(0),
|
||||
//OriginStateIxe(Vect<int>(0,1)),
|
||||
//OriginStateIxe(Vect<int>(0,1)),
|
||||
Ix2_available(Vect<int>(0, 1)), index_first_hole_to_right (Vect<int>(0,1)), displacement (Vect<int>(0,1)),
|
||||
Ix2(Vect<int>(0, 1)), lambdaoc(Vect<DP>(0.0, 1)), //BE(Vect<DP>(0.0, 1)),
|
||||
S(Vect<DP>(0.0, 1)), dSdlambdaoc(Vect<DP>(0.0, 1)),
|
||||
diffsq(0.0), prec(ITER_REQ_PREC_LIEBLIN), conv(0), iter_Newton(0), E(0.0), iK(0), K(0.0), lnnorm(-100.0)
|
||||
{
|
||||
stringstream Nout; Nout << N; label = Nout.str() + LABELSEP + JSCcoding[0] + LABELSEP;//"_0_";
|
||||
stringstream Nout; Nout << N; label = Nout.str() + LABELSEP + ABACUScoding[0] + LABELSEP;//"_0_";
|
||||
}
|
||||
|
||||
LiebLin_Bethe_State::LiebLin_Bethe_State (DP c_int_ref, DP L_ref, int N_ref)
|
||||
LiebLin_Bethe_State::LiebLin_Bethe_State (DP c_int_ref, DP L_ref, int N_ref)
|
||||
: c_int(c_int_ref), L(L_ref), cxL(c_int_ref * L_ref), N(N_ref),
|
||||
//OriginStateIx2(Vect<int>(0,N),
|
||||
//OriginStateIx2(Vect<int>(0,N),
|
||||
Ix2_available(Vect<int>(0, 2)), index_first_hole_to_right (Vect<int>(0,N)), displacement (Vect<int>(0,N)),
|
||||
Ix2(Vect<int>(0, N)), lambdaoc(Vect<DP>(0.0, N)), //BE(Vect<DP>(0.0, N)),
|
||||
S(Vect<DP>(0.0, N)), dSdlambdaoc(Vect<DP>(0.0, N)),
|
||||
diffsq(0.0), prec(JSC::max(1.0, 1.0/(c_int * c_int)) * ITER_REQ_PREC_LIEBLIN), conv(0), iter_Newton(0), E(0.0), iK(0), K(0.0), lnnorm(-100.0)
|
||||
diffsq(0.0), prec(ABACUS::max(1.0, 1.0/(c_int * c_int)) * ITER_REQ_PREC_LIEBLIN), conv(0), iter_Newton(0), E(0.0), iK(0), K(0.0), lnnorm(-100.0)
|
||||
{
|
||||
if (c_int < 0.0) JSCerror("You must use a positive interaction parameter !");
|
||||
if (N < 0) JSCerror("Particle number must be strictly positive.");
|
||||
if (c_int < 0.0) ABACUSerror("You must use a positive interaction parameter !");
|
||||
if (N < 0) ABACUSerror("Particle number must be strictly positive.");
|
||||
|
||||
stringstream Nout; Nout << N; label = Nout.str() + LABELSEP + JSCcoding[0] + LABELSEP;//+ "_0_";
|
||||
stringstream Nout; Nout << N; label = Nout.str() + LABELSEP + ABACUScoding[0] + LABELSEP;//+ "_0_";
|
||||
|
||||
// Set quantum numbers to ground-state configuration:
|
||||
for (int i = 0; i < N; ++i) Ix2[i] = -(N-1) + 2*i;
|
||||
@@ -91,12 +91,12 @@ namespace JSC {
|
||||
if (N != labeldata.M[0]) {
|
||||
cout << label_ref << endl;
|
||||
cout << labeldata.M << endl;
|
||||
JSCerror("Trying to set an incorrect label on LiebLin_Bethe_State: N != M[0].");
|
||||
ABACUSerror("Trying to set an incorrect label on LiebLin_Bethe_State: N != M[0].");
|
||||
}
|
||||
if (N != OriginStateIx2.size()) {
|
||||
cout << label_ref << endl;
|
||||
cout << labeldata.M << endl;
|
||||
JSCerror("Trying to set an incorrect label on LiebLin_Bethe_State: N != OriginStateIx2.size().");
|
||||
ABACUSerror("Trying to set an incorrect label on LiebLin_Bethe_State: N != OriginStateIx2.size().");
|
||||
}
|
||||
|
||||
label = label_ref;
|
||||
@@ -136,7 +136,7 @@ namespace JSC {
|
||||
{
|
||||
// This function does not assume any ordering of the Ix2.
|
||||
|
||||
if (N != OriginStateIx2.size()) JSCerror("N != OriginStateIx2.size() in Set_Label_from_Ix2.");
|
||||
if (N != OriginStateIx2.size()) ABACUSerror("N != OriginStateIx2.size() in Set_Label_from_Ix2.");
|
||||
|
||||
//cout << "Setting label on Ix2 " << endl << Ix2 << endl;
|
||||
|
||||
@@ -148,11 +148,11 @@ namespace JSC {
|
||||
for (int i = 0; i < N; ++i) if (!OriginStateIx2.includes(Ix2[i])) nexc_ref[0] += 1;
|
||||
Vect<Vect<int> > Ix2old_ref(1);
|
||||
Vect<Vect<int> > Ix2exc_ref(1);
|
||||
Ix2old_ref[0] = Vect<int>(JSC::max(nexc_ref[0],1));
|
||||
Ix2exc_ref[0] = Vect<int>(JSC::max(nexc_ref[0],1));
|
||||
Ix2old_ref[0] = Vect<int>(ABACUS::max(nexc_ref[0],1));
|
||||
Ix2exc_ref[0] = Vect<int>(ABACUS::max(nexc_ref[0],1));
|
||||
int nexccheck = 0;
|
||||
for (int i = 0; i < N; ++i) if (!OriginStateIx2.includes(Ix2[i])) Ix2exc_ref[0][nexccheck++] = Ix2[i];
|
||||
if (nexccheck != nexc_ref[0]) JSCerror("Counting excitations wrong (1) in LiebLin_Bethe_State::Set_Label_from_Ix2");
|
||||
if (nexccheck != nexc_ref[0]) ABACUSerror("Counting excitations wrong (1) in LiebLin_Bethe_State::Set_Label_from_Ix2");
|
||||
nexccheck = 0;
|
||||
for (int i = 0; i < N; ++i) if (!Ix2.includes (OriginStateIx2[i])) Ix2old_ref[0][nexccheck++] = OriginStateIx2[i];
|
||||
if (nexccheck != nexc_ref[0]) {
|
||||
@@ -162,7 +162,7 @@ namespace JSC {
|
||||
cout << nexc_ref[0] << endl;
|
||||
cout << Ix2old_ref[0] << endl;
|
||||
cout << Ix2exc_ref[0] << endl;
|
||||
JSCerror("Counting excitations wrong (2) in LiebLin_Bethe_State::Set_Label_from_Ix2");
|
||||
ABACUSerror("Counting excitations wrong (2) in LiebLin_Bethe_State::Set_Label_from_Ix2");
|
||||
}
|
||||
// Now order the Ix2old_ref and Ix2exc_ref:
|
||||
Ix2old_ref[0].QuickSort();
|
||||
@@ -176,10 +176,10 @@ namespace JSC {
|
||||
/*
|
||||
void LiebLin_Bethe_State::Set_Label_from_Ix2 (const Vect<int>& OriginStateIx2)
|
||||
{
|
||||
// This function was deprecated since it assumed that the Ix2 of the state were
|
||||
// This function was deprecated since it assumed that the Ix2 of the state were
|
||||
// in a particular order mirroring the indices of OriginStateIx2.
|
||||
|
||||
if (N != OriginStateIx2.size()) JSCerror("N != OriginStateIx2.size() in Set_Label_from_Ix2.");
|
||||
if (N != OriginStateIx2.size()) ABACUSerror("N != OriginStateIx2.size() in Set_Label_from_Ix2.");
|
||||
|
||||
Vect<int> OriginStateIx2ordered = OriginStateIx2;
|
||||
OriginStateIx2ordered.QuickSort();
|
||||
@@ -192,10 +192,10 @@ namespace JSC {
|
||||
for (int i = 0; i < N; ++i) if (Ix2[i] != OriginStateIx2ordered[i]) nexc_ref[0] += 1;
|
||||
Vect<Vect<int> > Ix2old_ref(1);
|
||||
Vect<Vect<int> > Ix2exc_ref(1);
|
||||
Ix2old_ref[0] = Vect<int>(JSC::max(nexc_ref[0],1));
|
||||
Ix2exc_ref[0] = Vect<int>(JSC::max(nexc_ref[0],1));
|
||||
Ix2old_ref[0] = Vect<int>(ABACUS::max(nexc_ref[0],1));
|
||||
Ix2exc_ref[0] = Vect<int>(ABACUS::max(nexc_ref[0],1));
|
||||
int nexccheck = 0;
|
||||
for (int i = 0; i < N; ++i)
|
||||
for (int i = 0; i < N; ++i)
|
||||
if (Ix2[i] != OriginStateIx2ordered[i]) {
|
||||
Ix2old_ref[0][nexccheck] = OriginStateIx2ordered[i];
|
||||
Ix2exc_ref[0][nexccheck++] = Ix2[i];
|
||||
@@ -209,9 +209,9 @@ namespace JSC {
|
||||
|
||||
void LiebLin_Bethe_State::Set_Label_Internals_from_Ix2 (const Vect<int>& OriginStateIx2)
|
||||
{
|
||||
//JSCerror("LiebLin_Bethe_State::Set_Label_Internals_from_Ix2 deprecated 20110604");
|
||||
//ABACUSerror("LiebLin_Bethe_State::Set_Label_Internals_from_Ix2 deprecated 20110604");
|
||||
|
||||
if (N != OriginStateIx2.size()) JSCerror("N != OriginStateIx2.size() in Set_Label_Internals_from_Ix2.");
|
||||
if (N != OriginStateIx2.size()) ABACUSerror("N != OriginStateIx2.size() in Set_Label_Internals_from_Ix2.");
|
||||
|
||||
Vect<int> OriginStateIx2ordered = OriginStateIx2;
|
||||
OriginStateIx2ordered.QuickSort();
|
||||
@@ -224,10 +224,10 @@ namespace JSC {
|
||||
for (int i = 0; i < N; ++i) if (!OriginStateIx2.includes(Ix2[i])) nexc_ref[0] += 1;
|
||||
Vect<Vect<int> > Ix2old_ref(1);
|
||||
Vect<Vect<int> > Ix2exc_ref(1);
|
||||
Ix2old_ref[0] = Vect<int>(JSC::max(nexc_ref[0],1));
|
||||
Ix2exc_ref[0] = Vect<int>(JSC::max(nexc_ref[0],1));
|
||||
Ix2old_ref[0] = Vect<int>(ABACUS::max(nexc_ref[0],1));
|
||||
Ix2exc_ref[0] = Vect<int>(ABACUS::max(nexc_ref[0],1));
|
||||
int nexccheck = 0;
|
||||
for (int i = 0; i < N; ++i)
|
||||
for (int i = 0; i < N; ++i)
|
||||
if (Ix2[i] != OriginStateIx2ordered[i]) {
|
||||
Ix2old_ref[0][nexccheck] = OriginStateIx2ordered[i];
|
||||
Ix2exc_ref[0][nexccheck++] = Ix2[i];
|
||||
@@ -238,13 +238,13 @@ namespace JSC {
|
||||
label = Return_State_Label (labeldata, OriginStateIx2);
|
||||
|
||||
// Construct the Ix2_available vector: we give one more quantum number on left and right:
|
||||
int navailable = 2 + (JSC::max(Ix2.max(), OriginStateIx2.max()) - JSC::min(Ix2.min(), OriginStateIx2.min()))/2 - N + 1;
|
||||
int navailable = 2 + (ABACUS::max(Ix2.max(), OriginStateIx2.max()) - ABACUS::min(Ix2.min(), OriginStateIx2.min()))/2 - N + 1;
|
||||
Ix2_available = Vect<int>(navailable);
|
||||
index_first_hole_to_right = Vect<int>(N);
|
||||
|
||||
// First set Ix2_available to all holes from left
|
||||
for (int i = 0; i < Ix2_available.size(); ++i) Ix2_available[i] = JSC::min(Ix2.min(), OriginStateIx2.min()) - 2 + 2*i;
|
||||
|
||||
for (int i = 0; i < Ix2_available.size(); ++i) Ix2_available[i] = ABACUS::min(Ix2.min(), OriginStateIx2.min()) - 2 + 2*i;
|
||||
|
||||
// Now shift according to Ix2 of OriginState:
|
||||
for (int j = 0; j < N; ++j) {
|
||||
int i = 0;
|
||||
@@ -255,7 +255,7 @@ namespace JSC {
|
||||
}
|
||||
// Ix2_available and index_first_hole_to_right are now fully defined.
|
||||
|
||||
// Now set displacement vector:
|
||||
// Now set displacement vector:
|
||||
displacement = Vect<int>(0, N);
|
||||
// Set displacement vector from the Ix2:
|
||||
for (int j = 0; j < N; ++j) {
|
||||
@@ -266,7 +266,7 @@ namespace JSC {
|
||||
//cout << j << "\t" << index_first_hole_to_right[j] << "\t" << displacement[j] << "\t" << Ix2_available[index_first_hole_to_right[j] + displacement[j] ] << endl;
|
||||
if (index_first_hole_to_right[j] + displacement[j] == 0) {
|
||||
cout << label << endl << j << endl << OriginStateIx2 << endl << Ix2 << endl << Ix2_available << endl << index_first_hole_to_right << endl << displacement << endl;
|
||||
JSCerror("Going down too far in Set_Label_Internals...");
|
||||
ABACUSerror("Going down too far in Set_Label_Internals...");
|
||||
}
|
||||
displacement[j]--;
|
||||
}
|
||||
@@ -279,13 +279,13 @@ namespace JSC {
|
||||
//cout << j << "\t" << index_first_hole_to_right[j] << "\t" << displacement[j] << "\t" << Ix2_available[index_first_hole_to_right[j] + displacement[j] ] << endl;
|
||||
if (index_first_hole_to_right[j] + displacement[j] == Ix2_available.size() - 1) {
|
||||
cout << label << endl << j << endl << OriginStateIx2 << endl << Ix2 << endl << Ix2_available << endl << index_first_hole_to_right << endl << displacement << endl;
|
||||
JSCerror("Going up too far in Set_Label_Internals...");
|
||||
ABACUSerror("Going up too far in Set_Label_Internals...");
|
||||
}
|
||||
displacement[j]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//cout << "label " << label << endl;
|
||||
//cout << "label " << label << endl;
|
||||
//cout << "Ix2: " << Ix2 << endl << "Ix2_available: " << Ix2_available << endl << "index...: " << index_first_hole_to_right << endl << "displacement: " << displacement << endl;
|
||||
//char a; cin >> a;
|
||||
|
||||
@@ -352,7 +352,7 @@ namespace JSC {
|
||||
bool nonan = true;
|
||||
|
||||
for (int j = 0; j < N; ++j) nonan *= !is_nan(lambdaoc[j]);
|
||||
|
||||
|
||||
return nonan;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace JSC {
|
||||
|
||||
bool LiebLin_Bethe_State::Check_Symmetry ()
|
||||
{
|
||||
// Checks whether the I's are symmetrically distributed.
|
||||
// Checks whether the I's are symmetrically distributed.
|
||||
|
||||
bool symmetric_state = true;
|
||||
|
||||
@@ -379,15 +379,15 @@ namespace JSC {
|
||||
void LiebLin_Bethe_State::Compute_lnnorm ()
|
||||
{
|
||||
if (lnnorm == -100.0) { // else Gaudin part already calculated by Newton method
|
||||
|
||||
|
||||
SQMat_DP Gaudin_Red(N);
|
||||
|
||||
(*this).Build_Reduced_Gaudin_Matrix(Gaudin_Red);
|
||||
|
||||
|
||||
lnnorm = real(lndet_LU_dstry(Gaudin_Red));
|
||||
|
||||
// Add the pieces outside of Gaudin determinant
|
||||
|
||||
|
||||
for (int j = 0; j < N - 1; ++j) for (int k = j+1; k < N; ++k) lnnorm += log(1.0 + 1.0/pow(lambdaoc[j] - lambdaoc[k], 2.0));
|
||||
|
||||
}
|
||||
@@ -408,14 +408,14 @@ namespace JSC {
|
||||
|
||||
void LiebLin_Bethe_State::Set_Free_lambdaocs()
|
||||
{
|
||||
if (cxL >= 1.0)
|
||||
if (cxL >= 1.0)
|
||||
for (int a = 0; a < N; ++a) lambdaoc[a] = PI * Ix2[a]/cxL;
|
||||
|
||||
// For small values of c, use better approximation using approximate zeroes of Hermite polynomials: see Gaudin eqn 4.71.
|
||||
if (cxL < 1.0) {
|
||||
//DP sqrtcL = pow(cxL, 0.5);
|
||||
DP oneoversqrtcLN = 1.0/pow(cxL * N, 0.5);
|
||||
for (int a = 0; a < N; ++a) lambdaoc[a] = oneoversqrtcLN * PI * Ix2[a];
|
||||
for (int a = 0; a < N; ++a) lambdaoc[a] = oneoversqrtcLN * PI * Ix2[a];
|
||||
|
||||
//for (int a = 0; a < N; ++a) lambdaoc[a] = sqrtcL * PI * Ix2[a]; // wrong values, correct scaling with c
|
||||
//for (int a = 0; a < N; ++a) lambdaoc[a] = PI * Ix2[a]/(cxL + 2.0 * N); // set to minimal distance lattice
|
||||
@@ -430,12 +430,12 @@ namespace JSC {
|
||||
// does one step of simple iterations
|
||||
|
||||
DP sumtheta = 0.0;
|
||||
Vect_DP dlambdaoc (0.0, N);
|
||||
Vect_DP dlambdaoc (0.0, N);
|
||||
|
||||
for (int j = 0; j < N; ++j) {
|
||||
|
||||
sumtheta = 0.0;
|
||||
for (int k = 0; k < N; ++k) sumtheta += atan((lambdaoc[j] - lambdaoc[k]));
|
||||
for (int k = 0; k < N; ++k) sumtheta += atan((lambdaoc[j] - lambdaoc[k]));
|
||||
sumtheta *= 2.0;
|
||||
|
||||
dlambdaoc[j] = damping * ((PI*Ix2[j] - sumtheta)/cxL - lambdaoc[j]);
|
||||
@@ -456,7 +456,7 @@ namespace JSC {
|
||||
}
|
||||
diffsq /= DP(N);
|
||||
//diffsq /= sqrt(sumsq) * DP(N);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -465,19 +465,19 @@ namespace JSC {
|
||||
// This is essentially Newton's method but only in one variable.
|
||||
// The logic is that the derivative of the LHS of the BE_j w/r to lambdaoc_j is much larger than with respect to lambdaoc_l with l != j.
|
||||
|
||||
Vect_DP dlambdaoc (0.0, N);
|
||||
Vect_DP dlambdaoc (0.0, N);
|
||||
|
||||
// Start by calculating S and dSdlambdaoc:
|
||||
for (int j = 0; j < N; ++j) {
|
||||
|
||||
S[j] = 0.0;
|
||||
for (int k = 0; k < N; ++k) S[j] += atan((lambdaoc[j] - lambdaoc[k]));
|
||||
for (int k = 0; k < N; ++k) S[j] += atan((lambdaoc[j] - lambdaoc[k]));
|
||||
S[j] *= 2.0/cxL;
|
||||
|
||||
dSdlambdaoc[j] = 0.0;
|
||||
for (int k = 0; k < N; ++k) dSdlambdaoc[j] += 1.0/((lambdaoc[j] - lambdaoc[k]) * (lambdaoc[j] - lambdaoc[k]) + 1.0);
|
||||
for (int k = 0; k < N; ++k) dSdlambdaoc[j] += 1.0/((lambdaoc[j] - lambdaoc[k]) * (lambdaoc[j] - lambdaoc[k]) + 1.0);
|
||||
dSdlambdaoc[j] *= 2.0/(PI * cxL);
|
||||
|
||||
|
||||
dlambdaoc[j] = (PI*Ix2[j]/cxL - S[j] + lambdaoc[j] * dSdlambdaoc[j])/(1.0 + dSdlambdaoc[j]) - lambdaoc[j];
|
||||
|
||||
}
|
||||
@@ -490,7 +490,7 @@ namespace JSC {
|
||||
else diffsq += cxL * cxL * dlambdaoc[i] * dlambdaoc[i]/(lambdaoc[i] * lambdaoc[i] + 1.0e-6);
|
||||
}
|
||||
diffsq /= DP(N);
|
||||
|
||||
|
||||
iter_Newton++;
|
||||
|
||||
return;
|
||||
@@ -515,9 +515,9 @@ namespace JSC {
|
||||
sumtheta = 0.0;
|
||||
atanintshift = 0;
|
||||
for (int k = 0; k < N; ++k)
|
||||
if (j != k) { // otherwise 0
|
||||
if (j != k) { // otherwise 0
|
||||
if (fabs(lambdahere = lambdaoc[j] - lambdaoc[k]) < 1.0) { // use straight atan
|
||||
sumtheta += atan(lambdahere);
|
||||
sumtheta += atan(lambdahere);
|
||||
}
|
||||
else { // for large rapidities, use dual form of atan, extracting pi/2 factors
|
||||
atanintshift += sgn_DP(lambdahere);
|
||||
@@ -530,7 +530,7 @@ namespace JSC {
|
||||
|
||||
RHSBAE[j] = cxL * lambdaoc[j] + sumtheta - PI*(Ix2[j] - atanintshift);
|
||||
}
|
||||
|
||||
|
||||
(*this).Build_Reduced_Gaudin_Matrix (Gaudin);
|
||||
|
||||
for (int j = 0; j < N; ++j) dlambdaoc[j] = - RHSBAE[j];
|
||||
@@ -553,17 +553,17 @@ namespace JSC {
|
||||
DP maxdlambdaoc = 0.0;
|
||||
do {
|
||||
ordering_still_changed = false;
|
||||
if (dlambdaoc[0] < 0.0 && fabs(dlambdaoc[0]) > (maxdlambdaoc = 10.0*JSC::max(fabs(lambdaoc[0]), fabs(lambdaoc[N-1]))))
|
||||
if (dlambdaoc[0] < 0.0 && fabs(dlambdaoc[0]) > (maxdlambdaoc = 10.0*ABACUS::max(fabs(lambdaoc[0]), fabs(lambdaoc[N-1]))))
|
||||
dlambdaoc[0] = -maxdlambdaoc;
|
||||
if (lambdaoc[0] + dlambdaoc[0] > lambdaoc[1] + dlambdaoc[1]) {
|
||||
dlambdaoc[0] = 0.25 * (lambdaoc[1] + dlambdaoc[1] - lambdaoc[0] ); // max quarter distance
|
||||
ordering_still_changed = true;
|
||||
//cout << "reason 1" << endl;
|
||||
}
|
||||
if (dlambdaoc[N-1] > 0.0 && fabs(dlambdaoc[N-1]) > (maxdlambdaoc = 10.0*JSC::max(fabs(lambdaoc[0]), fabs(lambdaoc[N-1]))))
|
||||
if (dlambdaoc[N-1] > 0.0 && fabs(dlambdaoc[N-1]) > (maxdlambdaoc = 10.0*ABACUS::max(fabs(lambdaoc[0]), fabs(lambdaoc[N-1]))))
|
||||
dlambdaoc[N-1] = maxdlambdaoc;
|
||||
if (lambdaoc[N-1] + dlambdaoc[N-1] < lambdaoc[N-2] + dlambdaoc[N-2]) {
|
||||
dlambdaoc[N-1] = 0.25 * (lambdaoc[N-2] + dlambdaoc[N-2] - lambdaoc[N-1]);
|
||||
dlambdaoc[N-1] = 0.25 * (lambdaoc[N-2] + dlambdaoc[N-2] - lambdaoc[N-1]);
|
||||
ordering_still_changed = true;
|
||||
//cout << "reason 2" << endl;
|
||||
}
|
||||
@@ -583,7 +583,7 @@ namespace JSC {
|
||||
}
|
||||
|
||||
//if (ordering_changed) cout << "dlambdaoc post checking = " << dlambdaoc << endl;
|
||||
|
||||
|
||||
/*
|
||||
bool orderingchanged = false;
|
||||
//bool dlambdaexceedsmaxrapdiff = false;
|
||||
@@ -593,10 +593,10 @@ namespace JSC {
|
||||
orderingchanged = true;
|
||||
// We must damp the dlambda such that the ordering is unchanged:
|
||||
// the condition is lambdaoc[j] + damping*dlambdaoc[j] < lambdaoc[j+1] + damping*dlambdaoc[j+1]
|
||||
damping_to_use = JSC::min(damping_to_use, 0.5 * (lambdaoc[j+1] - lambdaoc[j])/(dlambdaoc[j] - dlambdaoc[j+1]));
|
||||
damping_to_use = ABACUS::min(damping_to_use, 0.5 * (lambdaoc[j+1] - lambdaoc[j])/(dlambdaoc[j] - dlambdaoc[j+1]));
|
||||
}
|
||||
*/
|
||||
//for (int j = 0; j < N; ++j)
|
||||
//for (int j = 0; j < N; ++j)
|
||||
//if (fabs(dlambdaoc[j]) > maxrapdiff) dlambdaexceedsmaxrapdiff = true;
|
||||
/*
|
||||
// The dlambdaoc must be smaller than the distance to neighbouring rapidities:
|
||||
@@ -663,11 +663,11 @@ namespace JSC {
|
||||
if (iK % 2) {
|
||||
cout << Ix2 << endl;
|
||||
cout << iK << "\t" << iK % 2 << endl;
|
||||
JSCerror("Sum of Ix2 is not even: inconsistency.");
|
||||
ABACUSerror("Sum of Ix2 is not even: inconsistency.");
|
||||
}
|
||||
iK /= 2; // sum of Ix2 is guaranteed even.
|
||||
|
||||
K = 2.0 * iK * PI/L;
|
||||
K = 2.0 * iK * PI/L;
|
||||
}
|
||||
|
||||
DP LiebLin_Bethe_State::Kernel (int a, int b)
|
||||
@@ -683,11 +683,11 @@ namespace JSC {
|
||||
void LiebLin_Bethe_State::Build_Reduced_Gaudin_Matrix (SQMat<DP>& Gaudin_Red)
|
||||
{
|
||||
|
||||
if (Gaudin_Red.size() != N) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
if (Gaudin_Red.size() != N) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
DP sum_Kernel = 0.0;
|
||||
|
||||
for (int j = 0; j < N; ++j)
|
||||
for (int j = 0; j < N; ++j)
|
||||
for (int k = 0; k < N; ++k) {
|
||||
|
||||
if (j == k) {
|
||||
@@ -695,9 +695,9 @@ namespace JSC {
|
||||
for (int kp = 0; kp < N; ++kp) if (j != kp) sum_Kernel += Kernel (lambdaoc[j] - lambdaoc[kp]);
|
||||
Gaudin_Red[j][k] = cxL + sum_Kernel;
|
||||
}
|
||||
|
||||
|
||||
else Gaudin_Red[j][k] = - Kernel (lambdaoc[j] - lambdaoc[k]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -706,34 +706,34 @@ namespace JSC {
|
||||
void LiebLin_Bethe_State::Build_Reduced_BEC_Quench_Gaudin_Matrix (SQMat<DP>& Gaudin_Red)
|
||||
{
|
||||
// Passing a matrix of dimension N/2
|
||||
|
||||
if (N % 2 != 0) JSCerror("Choose a state with even numer of particles please");
|
||||
|
||||
|
||||
if (N % 2 != 0) ABACUSerror("Choose a state with even numer of particles please");
|
||||
|
||||
// Check Parity invariant
|
||||
|
||||
|
||||
bool ck = true;
|
||||
|
||||
|
||||
for (int j = 0; j < N/2; ++j){ if(Ix2[j] != - Ix2[N-j-1]) ck = false;}
|
||||
|
||||
if (!ck) JSCerror("Choose a parity invariant state please");
|
||||
|
||||
if (Gaudin_Red.size() != N/2) JSCerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
|
||||
if (!ck) ABACUSerror("Choose a parity invariant state please");
|
||||
|
||||
if (Gaudin_Red.size() != N/2) ABACUSerror("Passing matrix of wrong size in Build_Reduced_Gaudin_Matrix.");
|
||||
|
||||
DP sum_Kernel = 0.0;
|
||||
|
||||
|
||||
for (int j = 0; j < N/2; ++j)
|
||||
for (int k = 0; k < N/2; ++k) {
|
||||
|
||||
|
||||
if (j == k) {
|
||||
sum_Kernel = 0.0;
|
||||
for (int kp = N/2; kp < N; ++kp) if (j + N/2 != kp) sum_Kernel += Kernel (lambdaoc[j+N/2] - lambdaoc[kp]) + Kernel (lambdaoc[j+N/2] + lambdaoc[kp]);
|
||||
Gaudin_Red[j][k] = cxL + sum_Kernel;
|
||||
}
|
||||
|
||||
|
||||
else Gaudin_Red[j][k] = - (Kernel (lambdaoc[j+ N/2] - lambdaoc[k+ N/2]) + Kernel (lambdaoc[j+ N/2] + lambdaoc[k+ N/2]) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -748,9 +748,9 @@ namespace JSC {
|
||||
State_Label_Data currentdata = Read_State_Label ((*this).label, OriginStateIx2);
|
||||
//cout << "current Ix2old " << currentdata.Ix2old[0] << endl;
|
||||
//cout << "current Ix2exc " << currentdata.Ix2exc[0] << endl;
|
||||
|
||||
if (ipart >= currentdata.nexc[0]) JSCerror("Particle label too large in LiebLin_Bethe_State::Annihilate_ph_pair.");
|
||||
if (ihole >= currentdata.nexc[0]) JSCerror("Hole label too large in LiebLin_Bethe_State::Annihilate_ph_pair.");
|
||||
|
||||
if (ipart >= currentdata.nexc[0]) ABACUSerror("Particle label too large in LiebLin_Bethe_State::Annihilate_ph_pair.");
|
||||
if (ihole >= currentdata.nexc[0]) ABACUSerror("Hole label too large in LiebLin_Bethe_State::Annihilate_ph_pair.");
|
||||
|
||||
// Simply remove the given pair:
|
||||
Vect<int> type_new = currentdata.type;
|
||||
@@ -760,19 +760,19 @@ namespace JSC {
|
||||
int ntypespresent = 1; // only one type for LiebLin
|
||||
Vect<Vect<int> > Ix2old_new(ntypespresent);
|
||||
Vect<Vect<int> > Ix2exc_new(ntypespresent);
|
||||
for (int it = 0; it < ntypespresent; ++it) Ix2old_new[it] = Vect<int>(JSC::max(nexc_new[it],1));
|
||||
for (int it = 0; it < ntypespresent; ++it) Ix2exc_new[it] = Vect<int>(JSC::max(nexc_new[it],1));
|
||||
|
||||
for (int it = 0; it < ntypespresent; ++it) Ix2old_new[it] = Vect<int>(ABACUS::max(nexc_new[it],1));
|
||||
for (int it = 0; it < ntypespresent; ++it) Ix2exc_new[it] = Vect<int>(ABACUS::max(nexc_new[it],1));
|
||||
|
||||
// Copy earlier data in, leaving out ipart and ihole:
|
||||
for (int it = 0; it < ntypespresent; ++it) {
|
||||
for (int i = 0; i < nexc_new[it]; ++i) {
|
||||
Ix2old_new[it][i] = currentdata.Ix2old[it][i + (i >= ihole)];
|
||||
Ix2exc_new[it][i] = currentdata.Ix2exc[it][i + (i >= ipart)];
|
||||
Ix2old_new[it][i] = currentdata.Ix2old[it][i + (i >= ihole)];
|
||||
Ix2exc_new[it][i] = currentdata.Ix2exc[it][i + (i >= ipart)];
|
||||
}
|
||||
}
|
||||
//cout << "Ix2old_new " << Ix2old_new[0] << endl;
|
||||
//cout << "Ix2exc_new " << Ix2exc_new[0] << endl;
|
||||
|
||||
|
||||
State_Label_Data newdata (type_new, M_new, nexc_new, Ix2old_new, Ix2exc_new);
|
||||
|
||||
(*this).Set_to_Label (Return_State_Label(newdata, OriginStateIx2));
|
||||
@@ -793,7 +793,7 @@ namespace JSC {
|
||||
|
||||
std::ostream& operator<< (std::ostream& s, const LiebLin_Bethe_State& state)
|
||||
{
|
||||
s << endl << "******** State for c = " << state.c_int << " L = " << state.L << " N = " << state.N
|
||||
s << endl << "******** State for c = " << state.c_int << " L = " << state.L << " N = " << state.N
|
||||
<< " with label " << state.label << " ********" << endl;
|
||||
s << "Ix2:" << endl;
|
||||
for (int j = 0; j < state.N; ++j) s << state.Ix2[j] << " ";
|
||||
@@ -806,4 +806,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,19 +12,19 @@ Purpose: calculates the chemical potential.
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
DP Chemical_Potential (LiebLin_Bethe_State& RefState)
|
||||
DP Chemical_Potential (LiebLin_Bethe_State& RefState)
|
||||
{
|
||||
// RefState is used here to provide the c_int, L and N parameters.
|
||||
|
||||
LiebLin_Bethe_State Nplus1State(RefState.c_int, RefState.L, RefState.N + 1);
|
||||
//LiebLin_Bethe_State NState(RefState.c_int, RefState.L, RefState.N);
|
||||
LiebLin_Bethe_State Nplus1State(RefState.c_int, RefState.L, RefState.N + 1);
|
||||
//LiebLin_Bethe_State NState(RefState.c_int, RefState.L, RefState.N);
|
||||
LiebLin_Bethe_State Nmin1State(RefState.c_int, RefState.L, RefState.N - 1);
|
||||
|
||||
Nplus1State.Compute_All(true);
|
||||
@@ -35,4 +35,4 @@ namespace JSC {
|
||||
return(0.5 * (Nplus1State.E - Nmin1State.E));
|
||||
}
|
||||
|
||||
} // 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.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,15 +10,14 @@ File: src/LIEBLIN/LiebLin_Matrix_Element_Contrib.cc
|
||||
|
||||
Purpose: handles the generic call for a Lieb-Liniger matrix element contribution.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//DP Compute_Matrix_Element_Contrib (char whichDSF, bool fixed_iK, LiebLin_Bethe_State& LeftState,
|
||||
// LiebLin_Bethe_State& RefState, DP Chem_Pot, fstream& DAT_outfile)
|
||||
@@ -60,7 +59,7 @@ namespace JSC {
|
||||
ME_CX = exp(2.0* ln_Overlap_with_BEC (LeftState)); // overlap sq part
|
||||
ME = 0.0;
|
||||
}
|
||||
else JSCerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
else ABACUSerror("Wrong whichDSF in Compute_Matrix_Element_Contrib.");
|
||||
|
||||
if (is_nan(ME)) ME = (whichDSF == 'Z') ? 1.0e+200 : 0.0;
|
||||
if (is_nan(norm(ME_CX))) ME_CX = -100.0;
|
||||
@@ -131,7 +130,7 @@ namespace JSC {
|
||||
/*
|
||||
// use omega * MEsq/iK^2
|
||||
//data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot)
|
||||
// MEsq/JSC::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK))
|
||||
// MEsq/ABACUS::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK))
|
||||
//: 0.0;
|
||||
*/
|
||||
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState DEPRECATED ++G_1, USE abs_data_value
|
||||
@@ -143,7 +142,7 @@ namespace JSC {
|
||||
//data_value = ME * ME;
|
||||
// use omega * MEsq/iK^2
|
||||
// Careful: use fabs(E) since this must also work with Tgt0 or arbitrary RefState DEPRECATED ++G_1, USE abs_data_value
|
||||
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME/JSC::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK));
|
||||
data_value = (LeftState.E - RefState.E - (LeftState.N - RefState.N) * Chem_Pot) * ME * ME/ABACUS::max(1, (LeftState.iK - RefState.iK) * (LeftState.iK - RefState.iK));
|
||||
}
|
||||
else if (whichDSF == 'g' || whichDSF == 'o') {
|
||||
if (fixed_iK)
|
||||
@@ -182,4 +181,4 @@ namespace JSC {
|
||||
return(data_value);
|
||||
}
|
||||
|
||||
} // 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.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,15 +10,14 @@ File: LiebLin_State_Ensemble.cc
|
||||
|
||||
Purpose: State ensembles for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
// Constructors:
|
||||
|
||||
@@ -35,12 +34,12 @@ namespace JSC {
|
||||
LiebLin_Diagonal_State_Ensemble::LiebLin_Diagonal_State_Ensemble (const LiebLin_Bethe_State& RefState, int nstates_req, const Vect<DP>& weight_ref)
|
||||
: nstates(nstates_req), state(Vect<LiebLin_Bethe_State>(RefState, nstates_req)), weight(weight_ref)
|
||||
{
|
||||
if (weight_ref.size() != nstates_req) JSCerror("Incompatible vector size in LiebLin_Diagonal_State_Ensemble constructor.");
|
||||
if (weight_ref.size() != nstates_req) ABACUSerror("Incompatible vector size in LiebLin_Diagonal_State_Ensemble constructor.");
|
||||
}
|
||||
*/
|
||||
|
||||
// Recursively go through all arbitrary-order type 2 descendents
|
||||
void Generate_type_2_descendents (LiebLin_Bethe_State& ActualState, int* ndesc_ptr, const LiebLin_Bethe_State& OriginState)
|
||||
void Generate_type_2_descendents (LiebLin_Bethe_State& ActualState, int* ndesc_ptr, const LiebLin_Bethe_State& OriginState)
|
||||
{
|
||||
int type_required = 3;
|
||||
Vect<string> desc_label = Descendents (ActualState, OriginState, type_required);
|
||||
@@ -64,16 +63,16 @@ namespace JSC {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//LiebLin_Diagonal_State_Ensemble::LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho, int nstates_req)
|
||||
//: nstates(nstates_req)
|
||||
LiebLin_Diagonal_State_Ensemble::LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho)
|
||||
{
|
||||
//version with 4 states in ensemble
|
||||
|
||||
|
||||
Root_Density x(rho.Npts, rho.lambdamax);
|
||||
|
||||
for(int ix=0; ix<x.Npts; ++ix) {
|
||||
@@ -85,7 +84,7 @@ namespace JSC {
|
||||
|
||||
//cout << x.lambda[ix] << "\t" << x.value[ix] << "\t" << rho.lambda[ix] "\t" << rho.value[ix] <<endl;
|
||||
}
|
||||
|
||||
|
||||
// Now carry on as per Discretized_LiebLin_Bethe_State:
|
||||
// Each time N \int_{-\infty}^\lambda d\lambda' \rho(\lambda') crosses a half integer, add a particle:
|
||||
DP integral = 0.0;
|
||||
@@ -94,10 +93,10 @@ namespace JSC {
|
||||
Vect<DP> Ix2_found(0.0, N);
|
||||
int Ix2_left, Ix2_right;
|
||||
Vect<int> Ix2(N);
|
||||
|
||||
|
||||
|
||||
|
||||
LiebLin_Bethe_State rhostate(c_int, N, L);
|
||||
|
||||
|
||||
nstates = 4;
|
||||
state = Vect<LiebLin_Bethe_State>(rhostate, nstates);
|
||||
weight = Vect<DP>(nstates);
|
||||
@@ -105,10 +104,10 @@ namespace JSC {
|
||||
weight[1] = 1.0/nstates;
|
||||
weight[2] = 1.0/nstates;
|
||||
weight[3] = 1.0/nstates;
|
||||
|
||||
|
||||
int n_moves = 0;
|
||||
bool change = true;
|
||||
|
||||
|
||||
for (int i = 0; i < rho.Npts; ++i) {
|
||||
integral_prev = integral;
|
||||
integral += L * rho.value[i] * rho.dlambda[i];
|
||||
@@ -116,24 +115,24 @@ namespace JSC {
|
||||
if (integral > Nfound + 0.5) {
|
||||
// Subtle error: if the rho is too discontinuous, i.e. if more than one rapidity is found, must correct for this.
|
||||
if (integral > Nfound + 1.5 && integral < Nfound + 2.5) { // found two rapidities
|
||||
JSCerror("The distribution of particles is too discontinous for discretisation");
|
||||
ABACUSerror("The distribution of particles is too discontinous for discretisation");
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
// few variables to clarify the computations, they do not need to be vectors, not used outside this loop
|
||||
//Ix2_found[Nfound] = 2.0 * L * (x.value[i] * (integral - Nfound - 0.5) + x.value[i-1] * (Nfound + 0.5 - integral_prev))/(integral - integral_prev);
|
||||
Ix2_found[Nfound] = 2.0 * L * x.Return_Value(rho.lambda[i]);
|
||||
|
||||
|
||||
Ix2_left = floor(Ix2_found[Nfound]);
|
||||
Ix2_left -= (Ix2_left + N + 1)%2 ? 1 : 0; //adjust parity
|
||||
|
||||
|
||||
Ix2_right = ceil(Ix2_found[Nfound]);
|
||||
Ix2_right += (Ix2_right + N + 1)%2 ? 1 : 0; //adjust parity
|
||||
|
||||
|
||||
int Ix2_in = (Ix2_found[Nfound] > 0 ? Ix2_left : Ix2_right);
|
||||
int Ix2_out = (Ix2_found[Nfound] > 0 ? Ix2_right : Ix2_left);
|
||||
cout << rho.lambda[i] << "\t" << x.Return_Value(rho.lambda[i]) << "\t" << Ix2_found[Nfound] << endl;
|
||||
|
||||
|
||||
//choose the saddle point state and remember the uncertain choices
|
||||
if(Ix2_found[Nfound] - Ix2_left < 0.5) {
|
||||
state[0].Ix2[Nfound] = Ix2_left;
|
||||
@@ -152,16 +151,16 @@ namespace JSC {
|
||||
state[1].Ix2[Nfound] = Ix2_out;
|
||||
state[2+change].Ix2[Nfound] = Ix2_left;
|
||||
state[2+!change].Ix2[Nfound] = Ix2_right;
|
||||
change = !change;
|
||||
change = !change;
|
||||
++n_moves;
|
||||
}
|
||||
Nfound++;
|
||||
}
|
||||
}
|
||||
//cout << "\ti = " << i << "\tintegral = " << integral << "\tNfound = " << Nfound << endl;
|
||||
}
|
||||
}
|
||||
//cout << endl;
|
||||
|
||||
|
||||
//fix state[3] and state[4]
|
||||
for(int i=0; i<N-1; ++i) {
|
||||
if(state[2].Ix2[i] == state[2].Ix2[i+1]) {
|
||||
@@ -175,52 +174,52 @@ namespace JSC {
|
||||
}
|
||||
|
||||
bool all_Diff = true;
|
||||
//check that all 'ns' states are different, we assume that Ix2 are ordered
|
||||
for(int i=0; i<nstates; ++i)
|
||||
//check that all 'ns' states are different, we assume that Ix2 are ordered
|
||||
for(int i=0; i<nstates; ++i)
|
||||
for(int j=i+1; j<nstates; ++j) {
|
||||
if(state[i].Ix2 == state[j].Ix2)
|
||||
if(state[i].Ix2 == state[j].Ix2)
|
||||
all_Diff = false;
|
||||
}
|
||||
|
||||
if(!all_Diff) {
|
||||
//check if the first two states are different
|
||||
if(state[0].Ix2 == state[1].Ix2)
|
||||
JSCerror("Cannot create 4 (nor 2) different states in LiebLin_Diagonal_State_Ensemble. Consider increasing system size");
|
||||
ABACUSerror("Cannot create 4 (nor 2) different states in LiebLin_Diagonal_State_Ensemble. Consider increasing system size");
|
||||
else {
|
||||
nstates = 2;
|
||||
weight[0] = 0.5;
|
||||
weight[1] = 0.5;
|
||||
}
|
||||
}
|
||||
//set the weights accordingly to the distance between the states.
|
||||
//set the weights accordingly to the distance between the states.
|
||||
// int n_moves_2 = 0, n_moves_3 = 0;
|
||||
// for(int i=0; i < N; ++i) {
|
||||
// if (!state[0].Ix2.is_in(state[2].Ix2[i])) ++n_moves_2;
|
||||
// if (!state[0].Ix2.is_in(state[3].Ix2[i])) ++n_moves_3;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// n_moves_2 = min(n_moves_2, n_moves - n_moves_2);
|
||||
// n_moves_3 = min(n_moves_3, n_moves - n_moves_3);
|
||||
//
|
||||
//
|
||||
// weight[2] *= 2.0*n_moves_2/n_moves;
|
||||
// weight[3] *= 2.0*n_moves_3/n_moves;
|
||||
//
|
||||
//
|
||||
// DP sum_weight = weight[0] + weight[1] + weight[2] + weight[3];
|
||||
|
||||
|
||||
for(int i=0; i<nstates; ++i) {
|
||||
//weight[i] /= sum_weight;
|
||||
state[i].Set_Label_from_Ix2(state[0].Ix2);
|
||||
state[i].Compute_All(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
cout << weight[0] << "\t" << state[0].Ix2 << endl << weight[0] << "\t" << state[1].Ix2 << endl;// << state[2].Ix2 << endl << state[3].Ix2 << endl;
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
|
||||
//old working version but not enough to saturate +fsumrule
|
||||
/*
|
||||
/*
|
||||
Root_Density x = rho;
|
||||
for(int ix=0; ix<x.Npts; ++ix) {
|
||||
x.value[ix] = x.lambda[ix];
|
||||
@@ -229,7 +228,7 @@ namespace JSC {
|
||||
}
|
||||
x.value[ix] /= 2.0*PI; //normalization
|
||||
}
|
||||
|
||||
|
||||
// Now carry on as per Discretized_LiebLin_Bethe_State:
|
||||
// Each time N \int_{-\infty}^\lambda d\lambda' \rho(\lambda') crosses a half integer, add a particle:
|
||||
DP integral = 0.0;
|
||||
@@ -241,7 +240,7 @@ namespace JSC {
|
||||
Vect<int> Ix2_uncertain(0, N);
|
||||
Vect<int> index_uncertain(0, N);
|
||||
int n_uncertain = 0, n_states_raw = 1;
|
||||
|
||||
|
||||
for (int i = 0; i < rho.Npts; ++i) {
|
||||
integral_prev = integral;
|
||||
integral += L * rho.value[i] * rho.dlambda[i];
|
||||
@@ -249,21 +248,21 @@ namespace JSC {
|
||||
if (integral > Nfound + 0.5) {
|
||||
// Subtle error: if the rho is too discontinuous, i.e. if more than one rapidity is found, must correct for this.
|
||||
if (integral > Nfound + 1.5 && integral < Nfound + 2.5) { // found two rapidities
|
||||
JSCerror("The distribution of particles is too discontinous for discretisation");
|
||||
ABACUSerror("The distribution of particles is too discontinous for discretisation");
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
// few variables to clarify the computations, they do not need to be vectors, not used outside this loop
|
||||
Ix2_found[Nfound] = 2.0 * L * (x.value[i] * (integral - Nfound - 0.5) + x.value[i-1] * (Nfound + 0.5 - integral_prev))/(integral - integral_prev);
|
||||
|
||||
|
||||
Ix2_left = floor(Ix2_found[Nfound]);
|
||||
Ix2_left -= (Ix2_left + N + 1)%2 ? 1 : 0; //adjust parity
|
||||
|
||||
|
||||
Ix2_right = ceil(Ix2_found[Nfound]);
|
||||
Ix2_right += (Ix2_right + N + 1)%2 ? 1 : 0; //adjust parity
|
||||
|
||||
|
||||
//cout << Ix2_found[Nfound] << "\t";
|
||||
|
||||
|
||||
//choose the saddle point state and remember the uncertain choices
|
||||
if(Ix2_found[Nfound] - Ix2_left < 1) {
|
||||
Ix2[Nfound] = Ix2_left;
|
||||
@@ -283,20 +282,20 @@ namespace JSC {
|
||||
n_states_raw *= 2;
|
||||
}
|
||||
}
|
||||
else JSCerror("Cannot deduce a quantum number from x(lambda)");
|
||||
else ABACUSerror("Cannot deduce a quantum number from x(lambda)");
|
||||
Nfound++;
|
||||
}
|
||||
}
|
||||
//cout << "\ti = " << i << "\tintegral = " << integral << "\tNfound = " << Nfound << endl;
|
||||
}
|
||||
}
|
||||
//cout << endl;
|
||||
|
||||
|
||||
//cout << Ix2 << endl;
|
||||
|
||||
|
||||
// create ensamble of states and compute its weights with respect to exact Ix2 saddle point
|
||||
Vect<Vect<int> > Ix2states(Ix2, n_states_raw);
|
||||
Vect<DP> Ix2weight(0.0, n_states_raw);
|
||||
|
||||
|
||||
// Ix2states[0] = Ix2;
|
||||
// Ix2weight[0] = ;
|
||||
int n_states_proper = 0;
|
||||
@@ -311,7 +310,7 @@ namespace JSC {
|
||||
//check if it's a proper set of quantum numbers
|
||||
bool OK = true;
|
||||
for(int j=0; j<N-1; ++j) if(Ix2states[n_states_proper][j] == Ix2states[n_states_proper][j+1]) OK = false;
|
||||
|
||||
|
||||
if(OK) {
|
||||
DP sum = 0;
|
||||
for(int j=0; j<N; ++j) sum += abs(Ix2_found[j] - Ix2states[n_states_proper][j]);
|
||||
@@ -320,26 +319,26 @@ namespace JSC {
|
||||
}
|
||||
else Ix2states[n_states_proper] = Ix2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//sort the states in increasing weight order;
|
||||
Vect<int> index(0, n_states_raw);
|
||||
for (int nrs = 0; nrs < n_states_raw; ++nrs) index[nrs] = nrs;
|
||||
Ix2weight.QuickSort(index);
|
||||
|
||||
|
||||
//cut the number of states if above 21 <- arbitrary number for now
|
||||
nstates = min(n_states_proper, 21);
|
||||
cout << n_states_raw << "\t" << n_states_proper << "\t" << nstates << endl;
|
||||
|
||||
|
||||
//create ensamble of states with normalised weights and ordered accordingly
|
||||
LiebLin_Bethe_State rhostate(c_int, N, L);
|
||||
rhostate.Ix2 = Ix2;
|
||||
rhostate.Compute_All(true);
|
||||
|
||||
|
||||
state = Vect<LiebLin_Bethe_State>(rhostate, nstates);
|
||||
weight = Vect<DP>(nstates);
|
||||
|
||||
|
||||
DP sum_weight = 0.0;
|
||||
for(int i=0; i<nstates; ++i) {
|
||||
state[i].Ix2 = Ix2states[index[n_states_raw - i - 1]];
|
||||
@@ -347,22 +346,22 @@ namespace JSC {
|
||||
weight[i] = Ix2weight[n_states_raw - i - 1];
|
||||
sum_weight += weight[i];
|
||||
}
|
||||
|
||||
|
||||
//renormalise
|
||||
for(int i=0; i<nstates; ++i) weight[i] /= sum_weight;
|
||||
|
||||
|
||||
// for(int i=0; i<nstates; ++i) {
|
||||
// cout << weight[i] << "\t" << state[i].Ix2 << endl;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
return;
|
||||
*/
|
||||
//cout << rho_t.value << endl;
|
||||
|
||||
|
||||
// different attempts - to delete soon
|
||||
// JSCerror("Stop here.");
|
||||
// ABACUSerror("Stop here.");
|
||||
/*
|
||||
|
||||
|
||||
// This function returns a state ensemble matching the continuous density rho.
|
||||
// The logic closely resembles the one used in Discretized_LiebLin_Bethe_State.
|
||||
|
||||
@@ -372,7 +371,7 @@ namespace JSC {
|
||||
DP integral_prev = 0.0;
|
||||
int Nfound = 0;
|
||||
Vect<DP> lambda_found(0.0, 2*N);
|
||||
|
||||
|
||||
for (int i = 0; i < rho.Npts; ++i) {
|
||||
integral_prev = integral;
|
||||
integral += L * rho.value[i] * rho.dlambda[i];
|
||||
@@ -395,45 +394,45 @@ namespace JSC {
|
||||
//cout << "\ti = " << i << "\tintegral = " << integral << "\tNfound = " << Nfound << endl;
|
||||
}
|
||||
//cout << "rho: " << rho.Npts << " points" << endl << rho.value << endl;
|
||||
//cout << "sym: " << rho.value[0] << " " << rho.value[rho.value.size() - 1]
|
||||
//cout << "sym: " << rho.value[0] << " " << rho.value[rho.value.size() - 1]
|
||||
// << "\t" << rho.value[rho.value.size()/2] << " " << rho.value[rho.value.size()/2 + 1] << endl;
|
||||
//cout << "Found " << Nfound << " particles." << endl;
|
||||
//cout << "lambda_found = " << lambda_found << endl;
|
||||
|
||||
Vect<DP> lambda(N);
|
||||
// Fill up the found rapidities:
|
||||
for (int il = 0; il < JSC::min(N, Nfound); ++il) lambda[il] = lambda_found[il];
|
||||
for (int il = 0; il < ABACUS::min(N, Nfound); ++il) lambda[il] = lambda_found[il];
|
||||
// If there are missing ones, put them at the end; ideally, this should never be called
|
||||
for (int il = Nfound; il < N; ++il) lambda[il] = lambda_found[Nfound-1] + (il - Nfound + 1) * (lambda_found[Nfound-1] - lambda_found[Nfound-2]);
|
||||
|
||||
//cout << lambda << endl;
|
||||
*/
|
||||
*/
|
||||
//try a different method
|
||||
//first determine bins, that is intervals in lambda which contain a single rapidity
|
||||
/*
|
||||
/*
|
||||
Vect<int> lambda_bin(0.0, N+1);
|
||||
integral = 0.0;
|
||||
Nfound = 0;
|
||||
|
||||
|
||||
lambda_bin[0] = 0;
|
||||
lambda_bin[N] = rho.Npts-1;
|
||||
for(int i=0; i<rho.Npts; ++i) {
|
||||
integral += L * rho.value[i] * rho.dlambda[i];
|
||||
if (integral > Nfound + 1.0) lambda_bin[++Nfound] = i - (rho.lambda[i]>0);
|
||||
}
|
||||
|
||||
|
||||
//put rapidity at the mean value of the distribution inside the bin
|
||||
for(int ib=0; ib < N; ++ib) {
|
||||
lambda_found[ib] = 0.0;
|
||||
for(int i=lambda_bin[ib]; i<lambda_bin[ib+1]; ++i) lambda_found[ib] += L * rho.value[i] * rho.lambda[i] * rho.dlambda[i];
|
||||
}
|
||||
|
||||
|
||||
//cout << lambda_found << endl;
|
||||
|
||||
|
||||
for(int i=0; i<N; ++i) cout << L*lambda[i]/PI << "\t" << L*lambda_found[i]/PI << endl;
|
||||
|
||||
|
||||
JSCerror("Stop here.");
|
||||
ABACUSerror("Stop here.");
|
||||
*/
|
||||
/*
|
||||
// Calculate quantum numbers: 2\pi * (L lambda + \sum_j 2 atan((lambda - lambda_j)/c)) = I_j
|
||||
@@ -447,10 +446,10 @@ namespace JSC {
|
||||
Ix2_left[i] -= (Ix2_left[i] + N + 1)%2 ? 1 : 0;
|
||||
Ix2_right[i] = ceil(Ix2_exact[i]);
|
||||
Ix2_right[i] += (Ix2_right[i] + N + 1)%2 ? 1 : 0;
|
||||
|
||||
|
||||
//cout << Ix2_left[i] << "\t" << Ix2_exact[i] << "\t" << Ix2_right[i] << endl;
|
||||
//Ix2[i] = 2.0* int((L * lambda[i] + sum)/twoPI) + (N % 2) - 1;
|
||||
// For N is even/odd, we want to round off to the nearest odd/even integer.
|
||||
// For N is even/odd, we want to round off to the nearest odd/even integer.
|
||||
//Ix2[i] = 2.0 * floor((L* lambda[i] + sum)/twoPI + 0.5 * (N%2 ? 1 : 2)) + (N%2) - 1;
|
||||
}
|
||||
//cout << "Found quantum numbers " << endl << Ix2 << endl;
|
||||
@@ -461,7 +460,7 @@ namespace JSC {
|
||||
Vect<int> Ix2(N);
|
||||
Vect<float> holes(0.0, N);
|
||||
for(int i=0; i < N; ++i) {
|
||||
if(Ix2_found[i] - Ix2_left[i] < 1) {
|
||||
if(Ix2_found[i] - Ix2_left[i] < 1) {
|
||||
Ix2[i] = Ix2_left[i];
|
||||
if(Ix2_found[i] - Ix2_left[i] > 0.75) holes[i] = -1;
|
||||
}
|
||||
@@ -470,29 +469,29 @@ namespace JSC {
|
||||
if(Ix2_right[i] - Ix2_found[i] > 0.75) holes[i] = 1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
// cout << endl << Ix2 << endl;
|
||||
// cout << endl << holes << endl;
|
||||
/*
|
||||
//count number of possible states
|
||||
/*
|
||||
//count number of possible states
|
||||
int n = 0;
|
||||
for(int i=0; i < N; ++i) {
|
||||
if(holes[i] != 0) ++n;
|
||||
}
|
||||
int n_states_raw = 1;
|
||||
*/
|
||||
*/
|
||||
/* only symmetric modifications
|
||||
for(int i=0; i<0.5*n; ++i) n_states_raw *= 2.0; //we count only symmetric modiications
|
||||
|
||||
Vect<Vect<int> > Ix2states(Ix2, n_states_raw);
|
||||
|
||||
|
||||
Vect<int> hole_position(0, 0.5*n);
|
||||
int hole_index = 0;
|
||||
for(int i=N/2 + N%2; i<N; ++i) {
|
||||
if(holes[i] != 0) hole_position[hole_index++] = i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//create modifications, we use bit representation of integers between 0 and n_states-1 treating zero as no change and 1 as mutltiplication by -1
|
||||
int state_index = 1;
|
||||
for(int i=1; i < n_states_raw; ++i) {
|
||||
@@ -506,7 +505,7 @@ namespace JSC {
|
||||
//check if it's a proper set of quantum numbers
|
||||
bool OK = true;
|
||||
for(int j=0; j<N-1; ++j) if(Ix2states[state_index][j] == Ix2states[state_index][j+1]) OK = false;
|
||||
|
||||
|
||||
if(OK) state_index++;
|
||||
else Ix2states[state_index] = Ix2;
|
||||
}
|
||||
@@ -515,14 +514,14 @@ namespace JSC {
|
||||
for(int i=0; i<n; ++i) n_states_raw *= 2.0; //we count all posibilities
|
||||
|
||||
Vect<Vect<int> > Ix2states(Ix2, n_states_raw);
|
||||
|
||||
|
||||
Vect<int> hole_position(0, n);
|
||||
int hole_index = 0;
|
||||
for(int i=0; i<N; ++i) {
|
||||
if(holes[i] != 0) hole_position[hole_index++] = i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//create modifications, we use bit representation of integers between 0 and n_states-1 treating zero as no change and 1 as mutltiplication by -1
|
||||
int state_index = 1;
|
||||
for(int i=1; i < n_states_raw; ++i) {
|
||||
@@ -536,16 +535,16 @@ namespace JSC {
|
||||
//check if it's a proper set of quantum numbers
|
||||
bool OK = true;
|
||||
for(int j=0; j<N-1; ++j) if(Ix2states[state_index][j] == Ix2states[state_index][j+1]) OK = false;
|
||||
|
||||
|
||||
if(OK) state_index++;
|
||||
else Ix2states[state_index] = Ix2;
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
*/
|
||||
/*
|
||||
n_states_raw = state_index;
|
||||
// for(int i=0; i<n_states; ++i) cout << Ix2states[i] << endl;
|
||||
|
||||
|
||||
LiebLin_Bethe_State rhostate(c_int, N, L);
|
||||
rhostate.Ix2 = Ix2;
|
||||
rhostate.Compute_All(true);
|
||||
@@ -554,14 +553,14 @@ namespace JSC {
|
||||
Vect<DP> weight_raw(0.0, n_states_raw);
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
DP energy_rho = 0;
|
||||
for (int i = 0; i < rho.Npts; ++i) {
|
||||
energy_rho += L * rho.value[i] * rho.dlambda[i] * rho.lambda[i] * rho.lambda[i];
|
||||
}
|
||||
|
||||
|
||||
cout << energy_rho << endl;
|
||||
|
||||
|
||||
DP energy_discrete = 0;
|
||||
for (int i=0; i < N; ++i) {
|
||||
energy_discrete += lambda[i] * lambda[i];
|
||||
@@ -578,27 +577,27 @@ namespace JSC {
|
||||
DP sum = 0;
|
||||
for(int j=0; j<N; ++j) sum += fabs(Ix2states[i][j] - Ix2_found[j]);
|
||||
weight_raw[i] = exp(sum)/L;
|
||||
|
||||
|
||||
sum_weight_raw += weight_raw[i];
|
||||
}
|
||||
|
||||
|
||||
for(int i=0; i<n_states_raw; ++i) weight_raw[i] /= sum_weight_raw;
|
||||
|
||||
|
||||
// Order the weights in decreasing value:
|
||||
Vect<int> index(n_states_raw);
|
||||
for (int nrs = 0; nrs < n_states_raw; ++nrs) index[nrs] = nrs;
|
||||
weight_raw.QuickSort(index);
|
||||
|
||||
|
||||
//nstates = 0;
|
||||
//for(int i=0; i<n_states_raw; ++i) if (weight_raw[i] > 0.01) ++nstates;
|
||||
|
||||
nstates = JSC::min(n_states_raw, 21);
|
||||
|
||||
|
||||
nstates = ABACUS::min(n_states_raw, 21);
|
||||
|
||||
cout << nstates << endl;
|
||||
|
||||
|
||||
state = Vect<LiebLin_Bethe_State>(rhostate, nstates);
|
||||
weight = Vect<DP>(nstates);
|
||||
|
||||
|
||||
DP sum_weight = 0.0;
|
||||
for(int i=0; i<nstates; ++i) {
|
||||
state[i].Ix2 = Ix2states[index[i]];
|
||||
@@ -606,18 +605,18 @@ namespace JSC {
|
||||
weight[i] = weight_raw[index[i]];
|
||||
sum_weight += weight[i];
|
||||
}
|
||||
|
||||
|
||||
//renormalise
|
||||
for(int i=0; i<nstates; ++i) weight[i] /= sum_weight;
|
||||
|
||||
|
||||
for(int i=0; i<nstates; ++i) {
|
||||
cout << weight[i] << "\t" << state[i].Ix2 << endl;
|
||||
}
|
||||
*/
|
||||
//JSCerror("Stop here.");
|
||||
|
||||
//ABACUSerror("Stop here.");
|
||||
|
||||
// end of different attempts
|
||||
/*
|
||||
/*
|
||||
// Check that the quantum numbers are all distinct:
|
||||
bool allOK = false;
|
||||
while (!allOK) {
|
||||
@@ -641,7 +640,7 @@ namespace JSC {
|
||||
|
||||
|
||||
cout << "Found " << ndesc_type2 << " descendents for state " << rhostate << endl;
|
||||
//JSCerror("Stop here...");
|
||||
//ABACUSerror("Stop here...");
|
||||
|
||||
// Now try to construct states in the vicinity.
|
||||
int nrstates1mod = 1;
|
||||
@@ -649,7 +648,7 @@ namespace JSC {
|
||||
if (i == 0 || Ix2[i-1] < Ix2[i] - 2) nrstates1mod++;
|
||||
if (i == N-1 || Ix2[i+1] > Ix2[i] + 2) nrstates1mod++;
|
||||
}
|
||||
//if (nrstates1mod < nstates_req) JSCerror("nrstates1mod < nstates_req in LiebLin_Diagonal_State_Ensemble.");
|
||||
//if (nrstates1mod < nstates_req) ABACUSerror("nrstates1mod < nstates_req in LiebLin_Diagonal_State_Ensemble.");
|
||||
nstates = nrstates1mod;
|
||||
|
||||
Vect<Vect<int> > Ix2states1mod(nrstates1mod);
|
||||
@@ -696,11 +695,11 @@ namespace JSC {
|
||||
state[ns].Set_Label_from_Ix2 (rhostate.Ix2);
|
||||
state[ns].Compute_All(true);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
LiebLin_Diagonal_State_Ensemble::LiebLin_Diagonal_State_Ensemble (DP c_int, DP L, int N, const Root_Density& rho, int nstates_req)
|
||||
: nstates(nstates_req)
|
||||
@@ -721,7 +720,7 @@ namespace JSC {
|
||||
DP integral_prev = 0.0;
|
||||
int Nfound = 0;
|
||||
Vect<DP> lambda_found(0.0, 2*N);
|
||||
|
||||
|
||||
for (int i = 0; i < rho.Npts; ++i) {
|
||||
integral_prev = integral;
|
||||
integral += L * rho.value[i] * rho.dlambda[i];
|
||||
@@ -742,14 +741,14 @@ namespace JSC {
|
||||
//cout << "\ti = " << i << "\tintegral = " << integral << "\tNfound = " << Nfound << endl;
|
||||
}
|
||||
//cout << "rho: " << rho.Npts << " points" << endl << rho.value << endl;
|
||||
//cout << "sym: " << rho.value[0] << " " << rho.value[rho.value.size() - 1]
|
||||
//cout << "sym: " << rho.value[0] << " " << rho.value[rho.value.size() - 1]
|
||||
// << "\t" << rho.value[rho.value.size()/2] << " " << rho.value[rho.value.size()/2 + 1] << endl;
|
||||
//cout << "Found " << Nfound << " particles." << endl;
|
||||
//cout << "lambda_found = " << lambda_found << endl;
|
||||
|
||||
Vect<DP> lambda(N);
|
||||
// Fill up the found rapidities:
|
||||
for (int il = 0; il < JSC::min(N, Nfound); ++il) lambda[il] = lambda_found[il];
|
||||
for (int il = 0; il < ABACUS::min(N, Nfound); ++il) lambda[il] = lambda_found[il];
|
||||
// If there are missing ones, put them at the end; ideally, this should never be called
|
||||
for (int il = Nfound; il < N; ++il) lambda[il] = lambda_found[Nfound-1] + (il - Nfound + 1) * (lambda_found[Nfound-1] - lambda_found[Nfound-2]);
|
||||
|
||||
@@ -762,7 +761,7 @@ namespace JSC {
|
||||
for (int j = 0; j < N; ++j) sum += 2.0 * atan((lambda[i] - lambda[j])/c_int);
|
||||
Ix2_exact[i] = (L * lambda[i] + sum)/PI;
|
||||
//Ix2[i] = 2.0* int((L * lambda[i] + sum)/twoPI) + (N % 2) - 1;
|
||||
// For N is even/odd, we want to round off to the nearest odd/even integer.
|
||||
// For N is even/odd, we want to round off to the nearest odd/even integer.
|
||||
Ix2[i] = 2.0 * floor((L* lambda[i] + sum)/twoPI + 0.5 * (N%2 ? 1 : 2)) + (N%2) - 1;
|
||||
}
|
||||
//cout << "Found quantum numbers " << endl << Ix2 << endl;
|
||||
@@ -790,7 +789,7 @@ namespace JSC {
|
||||
if (i == 0 || Ix2[i-1] < Ix2[i] - 2) nrstates1mod++;
|
||||
if (i == N-1 || Ix2[i+1] > Ix2[i] + 2) nrstates1mod++;
|
||||
}
|
||||
if (nrstates1mod < nstates_req) JSCerror("nrstates1mod < nstates_req in LiebLin_Diagonal_State_Ensemble.");
|
||||
if (nrstates1mod < nstates_req) ABACUSerror("nrstates1mod < nstates_req in LiebLin_Diagonal_State_Ensemble.");
|
||||
|
||||
Vect<Vect<int> > Ix2states1mod(nrstates1mod);
|
||||
for (int nrs = 0; nrs < nrstates1mod; ++nrs) Ix2states1mod[nrs] = Vect<int> (N);
|
||||
@@ -848,7 +847,7 @@ namespace JSC {
|
||||
|
||||
return(*this);
|
||||
}
|
||||
|
||||
|
||||
void LiebLin_Diagonal_State_Ensemble::Load (DP c_int, DP L, int N, const char* ensfile_Cstr)
|
||||
{
|
||||
ifstream infile(ensfile_Cstr);
|
||||
@@ -871,7 +870,7 @@ namespace JSC {
|
||||
for (int ns = 0; ns < nstates; ++ns) {
|
||||
infile >> weight[ns] >> dummylabel;
|
||||
for (int i = 0; i < state[ns].N; ++i) infile >> state[ns].Ix2[i];
|
||||
}
|
||||
}
|
||||
infile.close();
|
||||
|
||||
for (int ns = 0; ns < nstates; ++ns) {
|
||||
@@ -886,13 +885,13 @@ namespace JSC {
|
||||
|
||||
outfile.open(ensfile_Cstr);
|
||||
|
||||
for (int ns = 0; ns < nstates; ++ns) {
|
||||
for (int ns = 0; ns < nstates; ++ns) {
|
||||
if (ns > 0) outfile << endl;
|
||||
outfile << setprecision(16) << weight[ns] << "\t" << state[ns].label << "\t";
|
||||
for (int i = 0; i < state[ns].N; ++i) outfile << " " << state[ns].Ix2[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//LiebLin_Diagonal_State_Ensemble LiebLin_Thermal_Saddle_Point_Ensemble (DP c_int, DP L, int N, DP kBT, int nstates_req)
|
||||
LiebLin_Diagonal_State_Ensemble LiebLin_Thermal_Saddle_Point_Ensemble (DP c_int, DP L, int N, DP kBT)
|
||||
@@ -911,7 +910,7 @@ namespace JSC {
|
||||
LiebLin_TBA_Solution TBAsol = LiebLin_TBA_Solution_fixed_nbar (c_int, N/L, kBT, 1.0e-4, 100);
|
||||
|
||||
LiebLin_Diagonal_State_Ensemble ensemble(c_int, L, N, TBAsol.rho);
|
||||
|
||||
|
||||
cout << "nbar: " << TBAsol.nbar << endl;
|
||||
cout << "ebar: " << TBAsol.ebar << endl;
|
||||
|
||||
@@ -920,10 +919,4 @@ namespace JSC {
|
||||
return(ensemble);
|
||||
}
|
||||
|
||||
} // 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.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -11,15 +11,14 @@ File: src/LIEBLIN/LiebLin_Sumrules.cc
|
||||
Purpose: provides functions evaluating various sumrule factors
|
||||
for Lieb-Liniger.
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
//DP Sumrule_Factor (char whichDSF, LiebLin_Bethe_State& RefState, DP Chem_Pot, bool fixed_iK, int iKneeded)
|
||||
DP Sumrule_Factor (char whichDSF, LiebLin_Bethe_State& RefState, DP Chem_Pot, int iKmin, int iKmax)
|
||||
@@ -35,8 +34,8 @@ namespace JSC {
|
||||
// We sum up omega * MEsq/(iK^2) for all values of iKmin <= iK <= iKmax, discounting iK == 0 (where DSF vanishes)
|
||||
// We therefore have (N/L) x L^{-1} x (2\pi/L)^2 x (iKmax - iKmin + 1) = 4 \pi^2 x N x (iKmax - iKmin + 1)/L^4
|
||||
// Discounting iK == 0 (where DSF vanishes), if iKmin <= 0 && iKmax >= 0 (in which case 0 is containted in [iKmin, iKmax])
|
||||
sumrule_factor = (iKmin <= 0 && iKmax >= 0) ?
|
||||
(RefState.L * RefState.L * RefState.L * RefState.L)/(4.0 * PI * PI * RefState.N * (iKmax - iKmin))
|
||||
sumrule_factor = (iKmin <= 0 && iKmax >= 0) ?
|
||||
(RefState.L * RefState.L * RefState.L * RefState.L)/(4.0 * PI * PI * RefState.N * (iKmax - iKmin))
|
||||
: (RefState.L * RefState.L * RefState.L * RefState.L)/(4.0 * PI * PI * RefState.N * (iKmax - iKmin + 1));
|
||||
|
||||
/*
|
||||
@@ -53,7 +52,7 @@ namespace JSC {
|
||||
//else if (whichDSF == 'g') sumrule_factor = 1.0/((2.0 * RefState.Tableau[0].Ncols + 1.0)/RefState.L + RefState.N/RefState.L);
|
||||
// Assume that iKmin == 0 here:
|
||||
//else if (whichDSF == 'g') sumrule_factor = 1.0/(2.0* iKmax + 1.0)/RefState.L + RefState.N/RefState.L);
|
||||
else if (whichDSF == 'g')
|
||||
else if (whichDSF == 'g')
|
||||
sumrule_factor = 1.0/((abs(iKmax - iKmin) + 1.0)/RefState.L + RefState.N/RefState.L);
|
||||
//sumrule_factor = 1.0/((pow(twoPI * iKmax/RefState.L, 2.0) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L)/RefState.L);
|
||||
// For the one-body function, it's just the density:
|
||||
@@ -61,20 +60,20 @@ namespace JSC {
|
||||
else if (whichDSF == 'q') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'B') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'C') sumrule_factor = 1.0;
|
||||
else JSCerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
}
|
||||
|
||||
//else if (fixed_iK) {
|
||||
else if (iKmin == iKmax) {
|
||||
if (whichDSF == 'Z') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'd' || whichDSF == '1')
|
||||
else if (whichDSF == 'd' || whichDSF == '1')
|
||||
//// We sum up omega * MEsq/(iK^2): this should give (1/L) x (N/L) x k^2 = N x (2\pi)^2/L^4
|
||||
//sumrule_factor = pow(RefState.L, 4.0)/(4.0 * PI * PI * RefState.N);
|
||||
// We sum up omega * MEsq
|
||||
//sumrule_factor = pow(RefState.L, 4.0)/(4.0 * PI * PI * iKneeded * iKneeded * RefState.N);
|
||||
sumrule_factor = pow(RefState.L, 4.0)/(4.0 * PI * PI * iKmax * iKmax * RefState.N);
|
||||
else if (whichDSF == 'g' || whichDSF == 'o') {
|
||||
// We sum up omega * MEsq
|
||||
// We sum up omega * MEsq
|
||||
//sumrule_factor = 1.0/((pow(twoPI * iKneeded/RefState.L, 2.0) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L)/RefState.L);
|
||||
sumrule_factor = 1.0/((pow(twoPI * iKmax/RefState.L, 2.0) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L)/RefState.L);
|
||||
}
|
||||
@@ -82,9 +81,9 @@ namespace JSC {
|
||||
else if (whichDSF == 'q') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'B') sumrule_factor = 1.0;
|
||||
else if (whichDSF == 'C') sumrule_factor = 1.0;
|
||||
else JSCerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
else ABACUSerror("whichDSF option not consistent in Sumrule_Factor");
|
||||
}
|
||||
|
||||
|
||||
return(sumrule_factor);
|
||||
}
|
||||
|
||||
@@ -95,12 +94,12 @@ namespace JSC {
|
||||
infile.open(RAW_Cstr);
|
||||
if(infile.fail()) {
|
||||
cout << "Filename RAW_Cstr = " << RAW_Cstr << endl;
|
||||
JSCerror("Could not open input file in Evaluate_F_Sumrule(LiebLin...).");
|
||||
ABACUSerror("Could not open input file in Evaluate_F_Sumrule(LiebLin...).");
|
||||
}
|
||||
|
||||
// We run through the data file to check the f sumrule at each positive momenta:
|
||||
//int iK_UL = RefState.Tableau[0].Ncols; // this is iK_UL
|
||||
//Vect<DP> Sum_omega_MEsq(0.0, iK_UL + 1);
|
||||
//Vect<DP> Sum_omega_MEsq(0.0, iK_UL + 1);
|
||||
Vect_DP Sum_omega_MEsq (0.0, iKmax - iKmin + 1);
|
||||
Vect_DP Sum_abs_omega_MEsq (0.0, iKmax - iKmin + 1);
|
||||
|
||||
@@ -128,7 +127,7 @@ namespace JSC {
|
||||
infile.close();
|
||||
|
||||
//cout << "Read " << nraw << " entries in raw file." << endl;
|
||||
|
||||
|
||||
ofstream outfile;
|
||||
outfile.open(FSR_Cstr);
|
||||
outfile.precision(16);
|
||||
@@ -136,23 +135,23 @@ namespace JSC {
|
||||
if (whichDSF == 'd' || whichDSF == '1') {
|
||||
/*
|
||||
outfile << 0 << "\t" << 1; // full saturation at k = 0 !
|
||||
for (int i = 1; i <= iK_UL; ++i)
|
||||
outfile << endl << i << "\t" << Sum_omega_MEsq[i] * RefState.L * RefState.L
|
||||
for (int i = 1; i <= iK_UL; ++i)
|
||||
outfile << endl << i << "\t" << Sum_omega_MEsq[i] * RefState.L * RefState.L
|
||||
* RefState.L * RefState.L/(4.0 * PI * PI * i * i * RefState.N);
|
||||
*/
|
||||
|
||||
for (int i = iKmin; i <= iKmax; ++i) {
|
||||
|
||||
if (i > iKmin) outfile << endl;
|
||||
//outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * JSC::max(abs(i), 1), 2.0) * RefState.N);
|
||||
outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * JSC::max(abs(i), 1), 2.0) * RefState.N)
|
||||
//outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * ABACUS::max(abs(i), 1), 2.0) * RefState.N);
|
||||
outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * ABACUS::max(abs(i), 1), 2.0) * RefState.N)
|
||||
// Include average of result at +iK and -iK in a third column: iK is at index index(iK) = iK - iKmin
|
||||
// so -iK is at index index(-iK) = -iK - iKmin
|
||||
// so -iK is at index index(-iK) = -iK - iKmin
|
||||
// We can only use this index if it is >= 0 and < iKmax - iKmin + 1, otherwise third column is copy of second:
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
0.5 * (Sum_omega_MEsq[i - iKmin] + Sum_omega_MEsq[-i - iKmin])
|
||||
: Sum_omega_MEsq[i - iKmin])
|
||||
* pow(RefState.L, 4.0)/(pow(2.0 * PI * JSC::max(abs(i), 1), 2.0) * RefState.N);
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
0.5 * (Sum_omega_MEsq[i - iKmin] + Sum_omega_MEsq[-i - iKmin])
|
||||
: Sum_omega_MEsq[i - iKmin])
|
||||
* pow(RefState.L, 4.0)/(pow(2.0 * PI * ABACUS::max(abs(i), 1), 2.0) * RefState.N);
|
||||
}
|
||||
}
|
||||
else if (whichDSF == 'g' || whichDSF == 'o') {
|
||||
@@ -168,7 +167,7 @@ namespace JSC {
|
||||
///((4.0 * PI * PI * i * i)/(RefState.L * RefState.L) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L);
|
||||
outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * RefState.L
|
||||
/((4.0 * PI * PI * i * i)/(RefState.L * RefState.L) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L)
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
0.5 * (Sum_omega_MEsq[i - iKmin] + Sum_omega_MEsq[-i - iKmin]) : Sum_omega_MEsq[i - iKmin])
|
||||
* RefState.L/((4.0 * PI * PI * i * i)/(RefState.L * RefState.L) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L);
|
||||
}
|
||||
@@ -182,7 +181,7 @@ namespace JSC {
|
||||
{
|
||||
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
||||
|
||||
stringstream FSR_stringstream; string FSR_string;
|
||||
@@ -224,9 +223,9 @@ namespace JSC {
|
||||
|
||||
// Define the raw input file name:
|
||||
stringstream filenameprefix;
|
||||
//Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
string prefix = filenameprefix.str();
|
||||
//Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, kBT, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
Data_File_Name (filenameprefix, whichDSF, iKmin, iKmax, 0.0, ensemble.state[ns], ensemble.state[ns], ensemble.state[ns].label);
|
||||
string prefix = filenameprefix.str();
|
||||
stringstream RAW_stringstream; string RAW_string;
|
||||
RAW_stringstream << prefix << ".raw";
|
||||
RAW_string = RAW_stringstream.str(); const char* RAW_Cstr = RAW_string.c_str();
|
||||
@@ -235,7 +234,7 @@ namespace JSC {
|
||||
infile.open(RAW_Cstr);
|
||||
if(infile.fail()) {
|
||||
cout << "Filename RAW_Cstr = " << RAW_Cstr << endl;
|
||||
JSCerror("Could not open input file in Evaluate_F_Sumrule(LiebLin...).");
|
||||
ABACUSerror("Could not open input file in Evaluate_F_Sumrule(LiebLin...).");
|
||||
}
|
||||
|
||||
while (infile.peek() != EOF) {
|
||||
@@ -258,21 +257,21 @@ namespace JSC {
|
||||
if (whichDSF == 'd' || whichDSF == '1') {
|
||||
/*
|
||||
outfile << 0 << "\t" << 1; // full saturation at k = 0 !
|
||||
for (int i = 1; i <= iK_UL; ++i)
|
||||
outfile << endl << i << "\t" << Sum_omega_MEsq[i] * RefState.L * RefState.L
|
||||
for (int i = 1; i <= iK_UL; ++i)
|
||||
outfile << endl << i << "\t" << Sum_omega_MEsq[i] * RefState.L * RefState.L
|
||||
* RefState.L * RefState.L/(4.0 * PI * PI * i * i * RefState.N);
|
||||
*/
|
||||
for (int i = iKmin; i <= iKmax; ++i) {
|
||||
if (i > iKmin) outfile << endl;
|
||||
//outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * JSC::max(abs(i), 1), 2.0) * RefState.N);
|
||||
outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * JSC::max(abs(i), 1), 2.0) * RefState.N)
|
||||
//outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * ABACUS::max(abs(i), 1), 2.0) * RefState.N);
|
||||
outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * pow(RefState.L, 4.0)/(pow(2.0 * PI * ABACUS::max(abs(i), 1), 2.0) * RefState.N)
|
||||
// Include average of result at +iK and -iK in a third column: iK is at index index(iK) = iK - iKmin
|
||||
// so -iK is at index index(-iK) = -iK - iKmin
|
||||
// so -iK is at index index(-iK) = -iK - iKmin
|
||||
// We can only use this index if it is >= 0 and < iKmax - iKmin + 1, otherwise third column is copy of second:
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
0.5 * (Sum_omega_MEsq[i - iKmin] + Sum_omega_MEsq[-i - iKmin])
|
||||
: Sum_omega_MEsq[i - iKmin])
|
||||
* pow(RefState.L, 4.0)/(pow(2.0 * PI * JSC::max(abs(i), 1), 2.0) * RefState.N);
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
0.5 * (Sum_omega_MEsq[i - iKmin] + Sum_omega_MEsq[-i - iKmin])
|
||||
: Sum_omega_MEsq[i - iKmin])
|
||||
* pow(RefState.L, 4.0)/(pow(2.0 * PI * ABACUS::max(abs(i), 1), 2.0) * RefState.N);
|
||||
}
|
||||
}
|
||||
else if (whichDSF == 'g' || whichDSF == 'o') {
|
||||
@@ -288,7 +287,7 @@ namespace JSC {
|
||||
///((4.0 * PI * PI * i * i)/(RefState.L * RefState.L) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L);
|
||||
outfile << i << "\t" << Sum_omega_MEsq[i - iKmin] * RefState.L
|
||||
/((4.0 * PI * PI * i * i)/(RefState.L * RefState.L) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L)
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
<< "\t" << ((i + iKmin <= 0 && -i < iKmax + 1) ?
|
||||
0.5 * (Sum_omega_MEsq[i - iKmin] + Sum_omega_MEsq[-i - iKmin]) : Sum_omega_MEsq[i - iKmin])
|
||||
* RefState.L/((4.0 * PI * PI * i * i)/(RefState.L * RefState.L) - Chem_Pot + 4.0 * RefState.c_int * RefState.N/RefState.L);
|
||||
}
|
||||
@@ -299,4 +298,4 @@ namespace JSC {
|
||||
}
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
} // namespace ABACUS
|
||||
|
||||
+32
-33
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -10,15 +10,14 @@ File: LiebLin_Tgt0.cc
|
||||
|
||||
Purpose: Finite temperature correlations for Lieb-Liniger
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
|
||||
/*
|
||||
@@ -47,16 +46,16 @@ namespace JSC {
|
||||
|
||||
//xmax += 10.0* epsilon;
|
||||
//xmin -= 10.0* epsilon;
|
||||
|
||||
|
||||
DP dx = 0.1/RefState.L;
|
||||
int Nptsx = int((xmax - xmin)/dx);
|
||||
int Nptsx = int((xmax - xmin)/dx);
|
||||
|
||||
Vect<bool> occupied (false, (Ix2max - Ix2min)/2 + 1); // whether there is a particle or not
|
||||
for (int i = 0; i < RefState.N; ++i) occupied[(RefState.Ix2[i] - Ix2min)/2] = true;
|
||||
|
||||
Vect<double> rho(0.0, Nptsx);
|
||||
Vect<double> rhoh(0.0, Nptsx);
|
||||
|
||||
|
||||
//cout << xmin << "\t" << xmax << "\t" << dx << "\t" << Nptsx << endl;
|
||||
|
||||
DP x;
|
||||
@@ -91,8 +90,8 @@ namespace JSC {
|
||||
complex<DP> entropy = 0.0;
|
||||
DP Deltax = log(RefState.L)/RefState.L;
|
||||
for (int ix = 0; ix < Nptsx; ++ix)
|
||||
//entropy -= ln_Gamma (1.0 + rho[ix]) + ln_Gamma (2.0 - rho[ix]); // This is ln (\rho_tot choose \rho) with \rho_tot = 1.
|
||||
entropy += ln_Gamma (RefState.L * (rho[ix] + rhoh[ix]) * Deltax + 1.0) - ln_Gamma(RefState.L * rho[ix] * Deltax + 1.0) - ln_Gamma (RefState.L * rhoh[ix] * Deltax + 1.0); // This is ln (\rho_tot choose \rho) with \rho_tot = 1.
|
||||
//entropy -= ln_Gamma (1.0 + rho[ix]) + ln_Gamma (2.0 - rho[ix]); // This is ln (\rho_tot choose \rho) with \rho_tot = 1.
|
||||
entropy += ln_Gamma (RefState.L * (rho[ix] + rhoh[ix]) * Deltax + 1.0) - ln_Gamma(RefState.L * rho[ix] * Deltax + 1.0) - ln_Gamma (RefState.L * rhoh[ix] * Deltax + 1.0); // This is ln (\rho_tot choose \rho) with \rho_tot = 1.
|
||||
entropy *= dx/Deltax;
|
||||
|
||||
//cout << "Entropy found " << entropy << "\t" << real(entropy) << endl;
|
||||
@@ -107,18 +106,18 @@ namespace JSC {
|
||||
// This function calculates the discrete entropy of a finite Lieb-Liniger state,
|
||||
// counting the possible permutations within windows of fixed width.
|
||||
|
||||
// We assume that the quantum numbers are ordered.
|
||||
// We assume that the quantum numbers are ordered.
|
||||
|
||||
// Calculate a density \rho_\Delta (x) for x_j on the lattice:
|
||||
|
||||
int iK_UL = JSC::max(RefState.Ix2[0], RefState.Ix2[RefState.N - 1]);
|
||||
int iK_UL = ABACUS::max(RefState.Ix2[0], RefState.Ix2[RefState.N - 1]);
|
||||
|
||||
Vect<double> rhoD(0.0, 2* iK_UL);
|
||||
|
||||
|
||||
int fourDeltasq = 4 * Delta * Delta;
|
||||
for (int ix = 0; ix < 2* iK_UL; ++ix) {
|
||||
// x = (-iK_UL + 1/2 + ix)/L
|
||||
for (int i = 0; i < RefState.N; ++i) rhoD[ix] += 1.0/((-2*iK_UL + 1 + 2*ix -RefState.Ix2[i]) * (-2*iK_UL + 1 + 2*ix -RefState.Ix2[i]) + fourDeltasq);
|
||||
for (int i = 0; i < RefState.N; ++i) rhoD[ix] += 1.0/((-2*iK_UL + 1 + 2*ix -RefState.Ix2[i]) * (-2*iK_UL + 1 + 2*ix -RefState.Ix2[i]) + fourDeltasq);
|
||||
rhoD[ix] *= 4.0 * Delta/PI;
|
||||
//cout << "x = " << (-iK_UL + 1/2 + ix)/RefState.L << "\trhoD = " << rhoD[ix] << endl;
|
||||
}
|
||||
@@ -137,7 +136,7 @@ namespace JSC {
|
||||
// This function calculates the discrete entropy of a finite Lieb-Liniger state,
|
||||
// counting the possible permutations within windows of fixed width.
|
||||
|
||||
// We assume that the quantum numbers are ordered.
|
||||
// We assume that the quantum numbers are ordered.
|
||||
|
||||
// Fill in vector of occupancies:
|
||||
int nrIs = (RefState.Ix2[RefState.N-1] - RefState.Ix2[0])/2 + 1 + 2*Delta; // assume Ix2 are ordered, leave space of Delta on both sides
|
||||
@@ -149,7 +148,7 @@ namespace JSC {
|
||||
//cout << "Check occupancy: " << endl << occupancy << endl;
|
||||
if (ncheck != RefState.N) {
|
||||
cout << ncheck << "\t" << RefState.N << endl;
|
||||
JSCerror("Counting q numbers incorrectly in Entropy.");
|
||||
ABACUSerror("Counting q numbers incorrectly in Entropy.");
|
||||
}
|
||||
|
||||
// Define some useful numbers:
|
||||
@@ -172,7 +171,7 @@ namespace JSC {
|
||||
|
||||
return(entropy);
|
||||
}
|
||||
|
||||
|
||||
DP Entropy (LiebLin_Bethe_State& RefState, int Delta)
|
||||
{
|
||||
// Perform an average of entropies for regulators from Delta to 2Delta:
|
||||
@@ -238,7 +237,7 @@ namespace JSC {
|
||||
convergedati = false;
|
||||
|
||||
while (!convergedati) {
|
||||
|
||||
|
||||
convergedati = true; // set to false if we change anything
|
||||
|
||||
Estay = spstate.E;
|
||||
@@ -259,7 +258,7 @@ namespace JSC {
|
||||
canfreeenup = Eup - kBT * Sup;
|
||||
}
|
||||
else canfreeenup = canfreeenstay + 1.0e-6;
|
||||
|
||||
|
||||
spstatedown = spstate;
|
||||
if (spstatedown.Ix2[i+1] > spstatedown.Ix2[i] + 2) {
|
||||
spstatedown.Ix2[i] += 2;
|
||||
@@ -272,11 +271,11 @@ namespace JSC {
|
||||
canfreeendown = Edown - kBT * Sdown;
|
||||
}
|
||||
else canfreeendown = canfreeenstay + 1.0e-6;
|
||||
|
||||
//cout << "i = " << i << "\t" << spstate.Ix2[i] << "\t\t" << canfreeenstay << "\t" << canfreeenup << "\t" << canfreeendown
|
||||
|
||||
//cout << "i = " << i << "\t" << spstate.Ix2[i] << "\t\t" << canfreeenstay << "\t" << canfreeenup << "\t" << canfreeendown
|
||||
// << "\t\t" << Estay << "\t" << Eup << "\t" << Edown << "\t\t" << Sstay << "\t" << Sup << "\t" << Sdown << endl;
|
||||
// Choose what to do:
|
||||
if (canfreeenup < canfreeenstay && canfreeendown < canfreeenstay)
|
||||
if (canfreeenup < canfreeenstay && canfreeendown < canfreeenstay)
|
||||
cout << canfreeenstay << "\t" << canfreeenup << "\t" << canfreeendown << "\tWarning: unclear option for minimization." << endl;
|
||||
else if (canfreeenup < canfreeenstay) {
|
||||
spstate = spstateup;
|
||||
@@ -340,14 +339,14 @@ namespace JSC {
|
||||
|
||||
for (int i = 0; i < N/2 - 1; ++i) {
|
||||
|
||||
// Try to increase or decrease the quantum numbers at i ,
|
||||
// Try to increase or decrease the quantum numbers at i ,
|
||||
// or do an (approximately) energy-preserving move with i+1 (and parity pairs)
|
||||
// giving 5 possible options: stay same, (\pm 1, 0), (+1, -1), (-1, +1)
|
||||
|
||||
convergedati = false;
|
||||
|
||||
while (!convergedati) {
|
||||
|
||||
|
||||
convergedati = true; // set to false if we change anything
|
||||
|
||||
Estay = spstate.E;
|
||||
@@ -370,7 +369,7 @@ namespace JSC {
|
||||
canfreeenup = Eup - kBT * Sup;
|
||||
}
|
||||
else canfreeenup = canfreeenstay + 1.0e-6;
|
||||
|
||||
|
||||
spstatedown = spstate;
|
||||
if (spstatedown.Ix2[i+1] > spstatedown.Ix2[i] + 2) {
|
||||
spstatedown.Ix2[i] += 2;
|
||||
@@ -402,8 +401,8 @@ namespace JSC {
|
||||
else canfreeenin = canfreeenstay + 1.0e-6;
|
||||
|
||||
spstateout = spstate;
|
||||
if (i == 0 && spstateout.Ix2[1] + 2 < spstateout.Ix2[2]
|
||||
|| (i < N/2 - 1 && spstateout.Ix2[i] - 2 > spstateout.Ix2[i-1]
|
||||
if (i == 0 && spstateout.Ix2[1] + 2 < spstateout.Ix2[2]
|
||||
|| (i < N/2 - 1 && spstateout.Ix2[i] - 2 > spstateout.Ix2[i-1]
|
||||
&& spstateout.Ix2[i+1] + 2 < spstateout.Ix2[i+2])) { // can move them further apart
|
||||
spstateout.Ix2[i] -= 2;
|
||||
spstateout.Ix2[i+1] += 2;
|
||||
@@ -418,12 +417,12 @@ namespace JSC {
|
||||
canfreeenout = Eout - kBT * Sout;
|
||||
}
|
||||
else canfreeenout = canfreeenstay + 1.0e-6;
|
||||
|
||||
|
||||
//cout << setprecision(8) << "i = " << i << "\t" << spstate.Ix2[i] << "\t" << spstate.Ix2[i+1] << "\t\t" << canfreeenstay << "\t" << canfreeenup << "\t" << canfreeendown << "\t" << canfreeenin << "\t" << canfreeenout << endl;
|
||||
//cout << "\t\tE: " << Estay << "\t" << Eup << "\t" << Edown << "\t" << Ein << "\t" << Eout << endl;
|
||||
//cout << "\t\tS: " << Sstay << "\t" << Sup << "\t" << Sdown << "\t" << Sin << "\t" << Sout << endl;
|
||||
|
||||
// Choose what to do: find minimum,
|
||||
// Choose what to do: find minimum,
|
||||
if (canfreeenstay < canfreeenup && canfreeenstay < canfreeendown && canfreeenstay < canfreeenin && canfreeenstay < canfreeenout) {
|
||||
// do nothing, convergetati is already true
|
||||
}
|
||||
@@ -491,14 +490,14 @@ namespace JSC {
|
||||
|
||||
// This is obtained by rediscretizing the solution coming from TBA.
|
||||
|
||||
// ASSUMPTIONS:
|
||||
// ASSUMPTIONS:
|
||||
// Periodic boundary conditions (the state which is output is forced to be symmetric Ix2 == -Ix2).
|
||||
|
||||
// For zero temperature, return the ground state:
|
||||
if (fabs(kBT) < 1.0e-4) return(LiebLin_Bethe_State(c_int, L, N));
|
||||
|
||||
// Otherwise, return the discretized TBA saddle-point state:
|
||||
LiebLin_TBA_Solution TBAsol = LiebLin_TBA_Solution_fixed_nbar (c_int, N/L, kBT, 1.0e-4, JSC::max(N/10, 10));
|
||||
LiebLin_TBA_Solution TBAsol = LiebLin_TBA_Solution_fixed_nbar (c_int, N/L, kBT, 1.0e-4, ABACUS::max(N/10, 10));
|
||||
|
||||
LiebLin_Bethe_State spstate = Discretized_LiebLin_Bethe_State (c_int, L, N, TBAsol.rho);
|
||||
|
||||
@@ -513,7 +512,7 @@ namespace JSC {
|
||||
{
|
||||
LiebLin_Bethe_State ReturnState (RefState.c_int, RefState.L, RefState.N + 1);
|
||||
|
||||
// Add a quantum number in middle (explicitly: to right of index N/2)
|
||||
// Add a quantum number in middle (explicitly: to right of index N/2)
|
||||
// and shift quantum numbers by half-integer away from added one:
|
||||
ReturnState.Ix2[RefState.N/2] = RefState.Ix2[RefState.N/2] - 1;
|
||||
for (int i = 0; i < RefState.N+1; ++i)
|
||||
@@ -533,4 +532,4 @@ namespace JSC {
|
||||
return(ReturnState);
|
||||
}
|
||||
|
||||
} // 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,12 @@ Purpose: Calculates Nikita Slavnov's determinant, case RHS is Bethe
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
complex<DP> Kernel_Twisted (complex<DP> expbeta, complex<DP> lambdaoc)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace JSC {
|
||||
{
|
||||
return(1.0/(lambdaoc + II) - expbeta/(lambdaoc - II));
|
||||
}
|
||||
|
||||
|
||||
complex<DP> Fn_V (int j, int sign, Vect<complex<DP> >& lstate_lambdaoc, LiebLin_Bethe_State& rstate)
|
||||
{
|
||||
complex<DP> result_num = 1.0;
|
||||
@@ -49,7 +49,7 @@ namespace JSC {
|
||||
{
|
||||
// To match with Nikita's new conventions
|
||||
return(1.0/Fn_V (j, -sign, lstate_lambdaoc, rstate));
|
||||
}
|
||||
}
|
||||
|
||||
complex<DP> LiebLin_Twisted_ln_Overlap (DP expbeta, Vect<DP> lstate_lambdaoc, DP lstate_lnnorm, LiebLin_Bethe_State& rstate)
|
||||
{
|
||||
@@ -79,14 +79,14 @@ namespace JSC {
|
||||
Vplus_Nikita[a] = Fn_V_Nikita (a, 1, lstate_lambdaoc, rstate);
|
||||
Vminus_Nikita[a] = Fn_V_Nikita (a, -1, lstate_lambdaoc, rstate);
|
||||
Fn_Prod[a] = 1.0;
|
||||
for (int m = 0; m < rstate.N; ++m)
|
||||
for (int m = 0; m < rstate.N; ++m)
|
||||
if (m != a) Fn_Prod[a] *= (lstate_lambdaoc[m] - rstate.lambdaoc[a])/(rstate.lambdaoc[m] - rstate.lambdaoc[a]);
|
||||
//rKern[a] = rstate.Kernel (a, p);
|
||||
rKern[a] = Kernel_Twisted (expbeta, rstate.lambdaoc[p] - rstate.lambdaoc[a]);
|
||||
}
|
||||
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
one_plus_U[a][b] = (a == b ? 1.0 : 0.0) + ((lstate_lambdaoc[a] - rstate.lambdaoc[a])/(1.0/Vplus_Nikita[a] - 1.0/Vminus_Nikita[a]))
|
||||
* Fn_Prod[a] * (Kernel_Twisted(expbeta, rstate.lambdaoc[a] - rstate.lambdaoc[b]) - rKern[b]);
|
||||
|
||||
@@ -97,13 +97,13 @@ namespace JSC {
|
||||
ln_prod_V -= 0.5 * rstate.N * log(expbeta);
|
||||
|
||||
complex<DP> ln_prod_2 = 0.0;
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
ln_prod_2 += log((lstate_lambdaoc[a] - rstate.lambdaoc[b] - II)/(rstate.lambdaoc[a] - lstate_lambdaoc[b]));
|
||||
|
||||
//cout << endl << ln_ddalpha_sigma << "\t" << ln_prod_V << "\t" << ln_prod_2 << "\t" << - log(2.0 * II * imag(Vplus[p])) << endl;
|
||||
//cout << endl << ln_ddalpha_sigma << "\t" << ln_prod_V << "\t" << ln_prod_2 << "\t" << - log(Vplus[p] - Vminus[p]) << endl;
|
||||
|
||||
|
||||
ln_ddalpha_sigma += ln_prod_V + ln_prod_2 - log(Vplus_Nikita[p] - expbeta * Vminus_Nikita[p]);
|
||||
|
||||
//cout << "shift = " << (complex<DP>(rstate.N) * (lstate_lambdaoc[0] - rstate.lambdaoc[0])/twoPI) << "\tKout = " << Kout << "\texp(-II*Kout) = " << exp(-II * Kout)
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
File: LiebLin_Gaudin_lnnorm.cc
|
||||
|
||||
Purpose: calculates the Gaudin norm of a vector of arbitrary
|
||||
complex rapidities
|
||||
complex rapidities
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
DP LiebLin_Twisted_lnnorm (Vect<complex<DP> >& lambdaoc, double cxL)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace JSC {
|
||||
|
||||
complex<DP> sum_Kernel = 0.0;
|
||||
|
||||
for (int j = 0; j < N; ++j)
|
||||
for (int j = 0; j < N; ++j)
|
||||
for (int k = 0; k < N; ++k) {
|
||||
if (j == k) {
|
||||
sum_Kernel = 0.0;
|
||||
@@ -49,4 +49,4 @@ namespace JSC {
|
||||
return(lnnorm);
|
||||
}
|
||||
|
||||
} // 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,9 +12,11 @@ Purpose: Utilities for Lieb-Liniger gas
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
namespace JSC {
|
||||
using namespace std;
|
||||
|
||||
namespace ABACUS {
|
||||
|
||||
DP LiebLin_dE0_dc (DP c_int, DP L, int N)
|
||||
{
|
||||
@@ -30,7 +32,7 @@ namespace JSC {
|
||||
|
||||
DP LiebLin_vs (DP c_int, DP L, int N)
|
||||
{
|
||||
LiebLin_Bethe_State gstate (c_int, L, N);
|
||||
LiebLin_Bethe_State gstate (c_int, L, N);
|
||||
gstate.Compute_All(true);
|
||||
|
||||
DP Egs = gstate.E;
|
||||
@@ -40,7 +42,7 @@ namespace JSC {
|
||||
gstate.Compute_All(false);
|
||||
|
||||
return((gstate.E - Egs) * L/twoPI);
|
||||
|
||||
|
||||
}
|
||||
|
||||
DP LiebLin_Dressed_Charge_N (DP c_int, DP L, int N)
|
||||
@@ -57,23 +59,23 @@ namespace JSC {
|
||||
{
|
||||
// Calculates the momentum of the excitations on the right of Fermi
|
||||
// surface, discarding the rightmost excitation.
|
||||
|
||||
|
||||
int nr = 0;
|
||||
for (int i = ScanState.N - 2; i >= ScanState.N/2; --i)
|
||||
if (ScanState.Ix2[i] >= 0) nr += (ScanState.Ix2[i] + ScanState.N - 1 - 2*i)/2;
|
||||
|
||||
|
||||
return(nr);
|
||||
}
|
||||
|
||||
|
||||
int Momentum_Left_Excitations (LiebLin_Bethe_State& ScanState)
|
||||
{
|
||||
// Calculates the momentum of the excitations on the left of Fermi
|
||||
// surface, discarding the rightmost excitation.
|
||||
|
||||
|
||||
int nl = 0;
|
||||
for (int i = 0; i < ScanState.N/2; ++i)
|
||||
if (ScanState.Ix2[i] < 0) nl -= (ScanState.Ix2[i] + ScanState.N - 1 - 2*i)/2;
|
||||
|
||||
|
||||
return(nl);
|
||||
}
|
||||
|
||||
@@ -82,25 +84,25 @@ namespace JSC {
|
||||
{
|
||||
int N = lambda.N;
|
||||
int L = lambda.L;
|
||||
|
||||
|
||||
DP c_int = lambda.c_int;
|
||||
|
||||
// The overlap identically vanishes if the state is not parity invariant:
|
||||
if (!lambda.Check_Symmetry()) return(-300.0);
|
||||
|
||||
if (!lambda.Check_Symmetry()) return(-300.0);
|
||||
|
||||
SQMat_DP Gaudin( N);
|
||||
|
||||
|
||||
SQMat_DP Gaudin_Quench( N/2);
|
||||
|
||||
|
||||
lambda.Build_Reduced_Gaudin_Matrix ( Gaudin);
|
||||
lambda.Build_Reduced_BEC_Quench_Gaudin_Matrix (Gaudin_Quench);
|
||||
|
||||
|
||||
//DP ln_prefactor = N/2.0 * log(2./fabs(c_int*L) ) + 0.5 * (N*log(N) - N + 0.5*log(2. * PI * N));
|
||||
|
||||
DP ln_prefactor = N/2.0 * log(2./(c_int*L) ) + 0.5 * real(ln_Gamma(complex<double>(N+1.0)));
|
||||
|
||||
|
||||
DP ln_prefactor = N/2.0 * log(2./(c_int*L) ) + 0.5 * real(ln_Gamma(complex<double>(N+1.0)));
|
||||
|
||||
for(int i =N/2; i<N; i ++) ln_prefactor -= log(fabs(lambda.lambdaoc[i ])) + 0.5*log( 1. + 4. * lambda.lambdaoc[i ]*lambda.lambdaoc[i ]) ;
|
||||
|
||||
|
||||
//cout << ln_prefactor << endl;
|
||||
return (ln_prefactor + real(lndet_LU_dstry(Gaudin_Quench)) - 0.5 * real(lndet_LU_dstry(Gaudin)));
|
||||
}
|
||||
|
||||
@@ -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,12 @@ Purpose: Calculates Nikita Slavnov's determinant, case RHS is Bethe
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
/*
|
||||
complex<DP> Fn_V (int j, int sign, Vect<complex<DP> >& lstate_lambdaoc, LiebLin_Bethe_State& rstate)
|
||||
{
|
||||
@@ -62,7 +62,7 @@ namespace JSC {
|
||||
Vect_CX ln_prod_ll_plus (0.0, rstate.N); // contains \prod_{a \neq k} (\lambdaoc_a - \lambdaoc_k + II)
|
||||
Vect_CX ln_prod_ll_minus (0.0, rstate.N); // contains \prod_{a \neq k} (\lambdaoc_a - \lambdaoc_k - II)
|
||||
|
||||
for (int j = 0; j < rstate.N; ++j)
|
||||
for (int j = 0; j < rstate.N; ++j)
|
||||
for (int k = 0; k < rstate.N; ++k) {
|
||||
ln_prod_plus[k] += log(rstate.lambdaoc[j] - lstate_lambdaoc[k] + II);
|
||||
ln_prod_minus[k] += log(rstate.lambdaoc[j] - lstate_lambdaoc[k] - II);
|
||||
@@ -75,9 +75,9 @@ namespace JSC {
|
||||
// Build the matrix:
|
||||
SQMat_CX Omega (0.0, rstate.N);
|
||||
|
||||
for (int j = 0; j < rstate.N; ++j)
|
||||
for (int j = 0; j < rstate.N; ++j)
|
||||
for (int k = 0; k < rstate.N; ++k)
|
||||
//Omega[j][k] = exp(-II * rstate.cxL * lstate_lambdaoc[k] + ln_prod_plus[k] - ln_prod_ll_plus[k])
|
||||
//Omega[j][k] = exp(-II * rstate.cxL * lstate_lambdaoc[k] + ln_prod_plus[k] - ln_prod_ll_plus[k])
|
||||
//* (II/((rstate.lambdaoc[j] - lstate_lambdaoc[k])*(rstate.lambdaoc[j] - lstate_lambdaoc[k] + II)))
|
||||
//- (II/((rstate.lambdaoc[j] - lstate_lambdaoc[k])*(rstate.lambdaoc[j] - lstate_lambdaoc[k] - II)))
|
||||
//* exp(ln_prod_minus[k] - ln_prod_ll_plus[k]);
|
||||
@@ -87,7 +87,7 @@ namespace JSC {
|
||||
|
||||
|
||||
//for (int j = 0; j < rstate.N; ++j) {
|
||||
//for (int k = 0; k < rstate.N; ++k)
|
||||
//for (int k = 0; k < rstate.N; ++k)
|
||||
//cout << Omega[j][k] << "\t";
|
||||
//cout << endl;
|
||||
//}
|
||||
@@ -115,12 +115,12 @@ namespace JSC {
|
||||
for (int k = 0; k < rstate.N; ++k)
|
||||
ln_prod_plusminus += log((rstate.lambdaoc[j] - lstate_lambdaoc[k] + II));
|
||||
|
||||
//cout << "ln_prod_mu " << ln_prod_mu << "\tln_prod_lambdaoc " << ln_prod_lambdaoc << "\tln_prod_plusminus " << ln_prod_plusminus
|
||||
//cout << "ln_prod_mu " << ln_prod_mu << "\tln_prod_lambdaoc " << ln_prod_lambdaoc << "\tln_prod_plusminus " << ln_prod_plusminus
|
||||
// << "\texp1 " << exp(-ln_prod_mu - ln_prod_lambdaoc) << "\texp2 " << exp(ln_prod_plusminus) << endl;
|
||||
|
||||
//if (real(ln_prod_d_mu + ln_prod_d_lambdaoc - ln_prod_mu + ln_prod_lambdaoc + lndetOmega - 0.5 * (lstate_lnnorm + rstate.lnnorm)) > 10.0) {
|
||||
//cout << ln_prod_d_mu << "\t" << ln_prod_d_lambdaoc << "\t" << -ln_prod_mu << "\t" << ln_prod_lambdaoc << "\t" << lndetOmega << "\t" << -0.5 * lstate_lnnorm << "\t" << -0.5 * rstate.lnnorm << endl; cout << ln_prod_d_mu + ln_prod_d_lambdaoc - ln_prod_mu + ln_prod_lambdaoc + lndetOmega - 0.5 * (lstate_lnnorm + rstate.lnnorm) << endl;
|
||||
//JSCerror("Overlap exceeds 1.");
|
||||
//ABACUSerror("Overlap exceeds 1.");
|
||||
//}
|
||||
|
||||
//return(ln_prod_d_mu + ln_prod_d_lambdaoc - ln_prod_mu + ln_prod_lambdaoc + lndetOmega - 0.5 * (lstate_lnnorm + rstate.lnnorm));
|
||||
@@ -150,13 +150,13 @@ namespace JSC {
|
||||
Vplus[a] = Fn_V (a, 1, lstate_lambdaoc, rstate);
|
||||
Vminus[a] = Fn_V (a, -1, lstate_lambdaoc, rstate);
|
||||
Fn_Prod[a] = 1.0;
|
||||
for (int m = 0; m < rstate.N; ++m)
|
||||
for (int m = 0; m < rstate.N; ++m)
|
||||
if (m != a) Fn_Prod[a] *= (lstate_lambdaoc[m] - rstate.lambdaoc[a])/(rstate.lambdaoc[m] - rstate.lambdaoc[a]);
|
||||
//rKern[a] = rstate.Kernel (a, p);
|
||||
}
|
||||
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
one_plus_U[a][b] = (a == b ? 1.0 : 0.0) + II * ((lstate_lambdaoc[a] - rstate.lambdaoc[a])/(Vplus[a] - Vminus[a]))
|
||||
* Fn_Prod[a] * rstate.Kernel(a,b);
|
||||
|
||||
@@ -164,15 +164,15 @@ namespace JSC {
|
||||
|
||||
complex<DP> ln_prod_V = 0.0;
|
||||
for (int a = 0; a < rstate.N; ++a) ln_prod_V += log(Vplus[a] - Vminus[a]);
|
||||
|
||||
|
||||
complex<DP> ln_prod_2 = 0.0;
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < rstate.N; ++b)
|
||||
ln_prod_2 += log((rstate.lambdaoc[a] - rstate.lambdaoc[b] + II)/(lstate_lambdaoc[a] - rstate.lambdaoc[b]));
|
||||
|
||||
//cout << endl << ln_ddalpha_sigma << "\t" << ln_prod_V << "\t" << ln_prod_2 << "\t" << - log(2.0 * II * imag(Vplus[p])) << endl;
|
||||
cout << endl << ln_ddalpha_sigma << "\t" << ln_prod_V << "\t" << ln_prod_2 << "\t" << 0.5 * lstate_lnnorm << "\t" << 0.5 * rstate.lnnorm << endl;//- log(Vplus[p] - Vminus[p]) << endl;
|
||||
|
||||
|
||||
ln_ddalpha_sigma += ln_prod_V + ln_prod_2;// - log(Vplus[p] - Vminus[p]);
|
||||
|
||||
//cout << "shift = " << (complex<DP>(rstate.N) * (lstate_lambdaoc[0] - rstate.lambdaoc[0])/twoPI) << "\tKout = " << Kout << "\texp(-II*Kout) = " << exp(-II * Kout)
|
||||
@@ -183,4 +183,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,12 +12,12 @@ Purpose: Computes the density operator \rho(x = 0) matrix element
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
complex<DP> Fn_V (int j, LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace JSC {
|
||||
Vect_CX Vplus (0.0, lstate.N); // contains V^+_j; V^-_j is the conjugate
|
||||
//Vect_DP Fn_Prod (0.0, lstate.N); // product_{m\neq j} (\mu_m - \lambdaoc_j)/(\lambdaoc_m - \lambdaoc_j)
|
||||
// From ABACUS++G_3 onwards: use logs to stabilize numerical values at small c, at the cost of execution speed.
|
||||
Vect_CX ln_Fn_Prod (0.0, lstate.N); // product_{m\neq j} (\mu_m - \lambdaoc_j)/(\lambdaoc_m - \lambdaoc_j)
|
||||
Vect_CX ln_Fn_Prod (0.0, lstate.N); // product_{m\neq j} (\mu_m - \lambdaoc_j)/(\lambdaoc_m - \lambdaoc_j)
|
||||
Vect_DP rKern (0.0, lstate.N); // K(lambdaoc_j - lambdaoc_(p == arbitrary))
|
||||
|
||||
//int p = 0;
|
||||
@@ -64,14 +64,14 @@ namespace JSC {
|
||||
Vplus[a] = Fn_V (a, lstate, rstate);
|
||||
//Fn_Prod[a] = 1.0;
|
||||
ln_Fn_Prod[a] = 0.0;;
|
||||
for (int m = 0; m < lstate.N; ++m)
|
||||
for (int m = 0; m < lstate.N; ++m)
|
||||
//if (m != a) Fn_Prod[a] *= (lstate.lambdaoc[m] - rstate.lambdaoc[a])/(rstate.lambdaoc[m] - rstate.lambdaoc[a]);
|
||||
if (m != a) ln_Fn_Prod[a] += log(complex<DP>(lstate.lambdaoc[m] - rstate.lambdaoc[a])/(rstate.lambdaoc[m] - rstate.lambdaoc[a]));
|
||||
rKern[a] = rstate.Kernel (a, p);
|
||||
}
|
||||
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
one_plus_U[a][b] = (a == b ? 1.0 : 0.0) + 0.5 * ((lstate.lambdaoc[a] - rstate.lambdaoc[a])/imag(Vplus[a]))
|
||||
//* Fn_Prod[a] * (rstate.Kernel(a,b) - rKern[b]);
|
||||
* real(exp(ln_Fn_Prod[a])) * (rstate.Kernel(a,b) - rKern[b]);
|
||||
@@ -80,15 +80,15 @@ namespace JSC {
|
||||
|
||||
complex<DP> ln_prod_V = 0.0;
|
||||
for (int a = 0; a < lstate.N; ++a) ln_prod_V += log(2.0 * II * imag(Vplus[a]));
|
||||
|
||||
|
||||
complex<DP> ln_prod_2 = 0.0;
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
ln_prod_2 += log((rstate.lambdaoc[a] - rstate.lambdaoc[b] + II)/(lstate.lambdaoc[a] - rstate.lambdaoc[b]));
|
||||
|
||||
//cout << "ln_Fn_Prod = " << ln_Fn_Prod << endl;
|
||||
//cout << endl << ln_ddalpha_sigma << "\t" << ln_prod_V << "\t" << ln_prod_2 << "\t" << - log(2.0 * II * imag(Vplus[p])) << "\t" << - 0.5 * (lstate.lnnorm + rstate.lnnorm) << "\t" << ln_ddalpha_sigma + ln_prod_V + ln_prod_2 - log(2.0 * II * imag(Vplus[p])) - 0.5 * (lstate.lnnorm + rstate.lnnorm) << endl;
|
||||
|
||||
|
||||
ln_ddalpha_sigma += ln_prod_V + ln_prod_2 - log(2.0 * II * imag(Vplus[p]));
|
||||
|
||||
return (log(-II * Kout) + ln_ddalpha_sigma - 0.5 * (lstate.lnnorm + rstate.lnnorm));
|
||||
|
||||
+13
-13
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,12 +12,12 @@ Purpose: Computes the matrix element of \Psi (x = 0)
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
|
||||
complex<DP> Fn_V_Psi (int j, LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate)
|
||||
{
|
||||
@@ -26,10 +26,10 @@ namespace JSC {
|
||||
complex<DP> result_num = 1.0;
|
||||
complex<DP> result_den = 1.0;
|
||||
|
||||
for (int m = 0; m < lstate.N; ++m)
|
||||
for (int m = 0; m < lstate.N; ++m)
|
||||
result_num *= (lstate.lambdaoc[m] - rstate.lambdaoc[j] + II);
|
||||
|
||||
for (int m = 0; m < rstate.N; ++m)
|
||||
for (int m = 0; m < rstate.N; ++m)
|
||||
result_den *= (rstate.lambdaoc[m] - rstate.lambdaoc[j] + II);
|
||||
|
||||
return(result_num/result_den);
|
||||
@@ -39,7 +39,7 @@ namespace JSC {
|
||||
{
|
||||
// Computes the log of the annihilation operator matrix element between lstate and rstate.
|
||||
|
||||
if (lstate.N + 1 != rstate.N) JSCerror("Wrong particle numbers in left and right states for Psi FF.");
|
||||
if (lstate.N + 1 != rstate.N) ABACUSerror("Wrong particle numbers in left and right states for Psi FF.");
|
||||
|
||||
SQMat_DP U_Psi (0.0, lstate.N);
|
||||
|
||||
@@ -52,25 +52,25 @@ namespace JSC {
|
||||
for (int a = 0; a < lstate.N; ++a) {
|
||||
Vplus[a] = Fn_V_Psi (a, lstate, rstate);
|
||||
Fn_Prod[a] = (lstate.lambdaoc[a] - rstate.lambdaoc[a])/(rstate.lambdaoc[rstate.N - 1] - rstate.lambdaoc[a]);
|
||||
for (int m = 0; m < lstate.N; ++m)
|
||||
for (int m = 0; m < lstate.N; ++m)
|
||||
if (m != a) Fn_Prod[a] *= (lstate.lambdaoc[m] - rstate.lambdaoc[a])/(rstate.lambdaoc[m] - rstate.lambdaoc[a]);
|
||||
rKern[a] = rstate.Kernel (a, p);
|
||||
}
|
||||
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
U_Psi[a][b] = (a == b ? 2.0 * imag(Vplus[a]) : 0.0) + Fn_Prod[a] * (rstate.Kernel(a,b) - rKern[b]);
|
||||
|
||||
complex<DP> ln_det_U_Psi = lndet_LU_dstry(U_Psi);
|
||||
|
||||
complex<DP> ln_prod_lambdaocsq_plus_one = 0.0;
|
||||
for (int a = 0; a < rstate.N - 1; ++a)
|
||||
for (int b = a; b < rstate.N; ++b)
|
||||
for (int a = 0; a < rstate.N - 1; ++a)
|
||||
for (int b = a; b < rstate.N; ++b)
|
||||
ln_prod_lambdaocsq_plus_one += log(complex<DP>((rstate.lambdaoc[a] - rstate.lambdaoc[b]) * (rstate.lambdaoc[a] - rstate.lambdaoc[b])) + 1.0);
|
||||
|
||||
complex<DP> ln_prod_lambdaoca_min_mub = 0.0;
|
||||
for (int a = 0; a < rstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
ln_prod_lambdaoca_min_mub += log(complex<DP>(rstate.lambdaoc[a] - lstate.lambdaoc[b]));
|
||||
|
||||
//cout << endl << "Factors are " << ln_det_U_Psi << "\t" << ln_prod_lambdaocsq_plus_one << "\t" << ln_prod_lambdaoca_min_mub << endl;
|
||||
|
||||
+52
-53
@@ -2,7 +2,7 @@
|
||||
|
||||
This software is part of J.-S. Caux's ABACUS library.
|
||||
|
||||
Copyright (c).
|
||||
Copyright (c) J.-S. Caux.
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
@@ -12,62 +12,61 @@ Purpose: provides the matrix element of the second density moment g2(x = 0)
|
||||
|
||||
NOTE: based on Lorenzo Piroli's expression of the matrix element
|
||||
|
||||
|
||||
***********************************************************/
|
||||
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace JSC;
|
||||
using namespace ABACUS;
|
||||
|
||||
namespace JSC {
|
||||
namespace ABACUS {
|
||||
/*
|
||||
complex<DP> ln_g2_ME_old_jacopo (LiebLin_Bethe_State& mu, LiebLin_Bethe_State& lambda)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
if (mu.Ix2 == lambda.Ix2) return(-200.);
|
||||
|
||||
|
||||
DP c_int = mu.c_int;
|
||||
|
||||
|
||||
SQMat_CX G(lambda.N);
|
||||
SQMat_CX GpB(lambda.N);
|
||||
SQMat_CX B(lambda.N);
|
||||
|
||||
|
||||
complex<DP> log_themp;
|
||||
complex<DP> lnprefactor = 0. ;
|
||||
|
||||
|
||||
lnprefactor += 2.*log(c_int) ;
|
||||
|
||||
|
||||
for(int j=0; j < mu.N; ++j){
|
||||
for(int k=0; k < j; ++k){
|
||||
lnprefactor -= log((mu.lambdaoc[j] - mu.lambdaoc[k]));
|
||||
lnprefactor -= log((lambda.lambdaoc[j] - lambda.lambdaoc[k]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for(int j=0; j < mu.N; ++j){
|
||||
for(int k=0; k <mu.N; ++k){
|
||||
lnprefactor += log(mu.lambdaoc[j] - mu.lambdaoc[k] + II);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vect_CX VVP (0.0, mu.N);
|
||||
Vect_CX VVM (0.0, mu.N);
|
||||
|
||||
|
||||
//compute the vectors
|
||||
for(int j=0; j < mu.N; ++j) {
|
||||
log_themp = 0.;
|
||||
for(int k=0; k < mu.N; ++k) log_themp += log(mu.lambdaoc[j] - lambda.lambdaoc[k] + II) - log(mu.lambdaoc[j] - mu.lambdaoc[k] + II);
|
||||
VVP[j] = exp(log_themp);
|
||||
}
|
||||
|
||||
|
||||
for(int j=0; j < mu.N; ++j) {
|
||||
log_themp = 0.;
|
||||
for(int k=0; k < mu.N; ++k) log_themp += log(mu.lambdaoc[j] - lambda.lambdaoc[k] - II) - log(mu.lambdaoc[j] - mu.lambdaoc[k] - II);
|
||||
VVM[j] = exp(log_themp);
|
||||
}
|
||||
|
||||
|
||||
//compute the sum of determinants
|
||||
complex<DP> sum_n =0.;
|
||||
for(int n=0; n < mu.N; ++n) {
|
||||
@@ -83,27 +82,27 @@ namespace JSC {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int a = 0; a < mu.N; ++a){
|
||||
for (int b = 0; b < mu.N; ++b){
|
||||
if(b == n){
|
||||
B[a][b] = 0.;
|
||||
}
|
||||
else{
|
||||
else{
|
||||
B[a][b] = II*1.0/(mu.lambdaoc[b] - mu.lambdaoc[n] - II) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int a = 0; a < mu.N; ++a){
|
||||
}
|
||||
|
||||
for (int a = 0; a < mu.N; ++a){
|
||||
for (int b = 0; b < mu.N; ++b){
|
||||
GpB[a][b] = G[a][b] + B[a][b];
|
||||
}
|
||||
}
|
||||
}
|
||||
//finally add
|
||||
sum_n += exp( lndet_LU_CX(GpB) ) - exp(lndet_LU_CX(G) ) ;
|
||||
}
|
||||
|
||||
|
||||
return(log(sum_n ) + lnprefactor - 0.5 * (mu.lnnorm + lambda.lnnorm));
|
||||
}
|
||||
*/
|
||||
@@ -112,46 +111,46 @@ namespace JSC {
|
||||
//complex<DP> result_num = 1.0;
|
||||
//complex<DP> result_den = 1.0;
|
||||
complex<DP> result = 1.0;
|
||||
|
||||
|
||||
for (int m = 0; m < lstate.N; ++m) {
|
||||
//result_num *= (lstate.lambdaoc[m] - rstate.lambdaoc[j] + II);
|
||||
//result_den *= (rstate.lambdaoc[m] - rstate.lambdaoc[j] + II);
|
||||
result *= (lstate.lambdaoc[m] - rstate.lambdaoc[j] + II)/(rstate.lambdaoc[m] - rstate.lambdaoc[j] + II);
|
||||
}
|
||||
|
||||
|
||||
//return(result_num/result_den);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
complex<DP> ln_g2_ME (LiebLin_Bethe_State& lstate, LiebLin_Bethe_State& rstate)
|
||||
{
|
||||
// Computes the log of the density operator \rho(x = 0) matrix element between lstate and rstate.
|
||||
|
||||
|
||||
// If we have lstate == rstate, density matrix element = 0:
|
||||
|
||||
|
||||
|
||||
|
||||
if (lstate.Ix2 == rstate.Ix2) return(-200.);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SQMat_DP one_plus_U (0.0, lstate.N);
|
||||
|
||||
|
||||
Vect_CX Vplus (0.0, lstate.N); // contains V^+_j; V^-_j is the conjugate
|
||||
//Vect_DP Fn_Prod (0.0, lstate.N); // product_{m\neq j} (\mu_m - \lambdaoc_j)/(\lambdaoc_m - \lambdaoc_j)
|
||||
// From ABACUS++G_3 onwards: use logs to stabilize numerical values at small c, at the cost of execution speed.
|
||||
Vect_CX ln_Fn_Prod (0.0, lstate.N); // product_{m\neq j} (\mu_m - \lambdaoc_j)/(\lambdaoc_m - \lambdaoc_j)
|
||||
Vect_DP rKern (0.0, lstate.N); // K(lambdaoc_j - lambdaoc_(p == arbitrary))
|
||||
|
||||
|
||||
//int p = 0;
|
||||
int p = rstate.N/2-1; // choice doesn't matter, see 1990_Slavnov_TMP_82 after (3.8). Choose rapidity around the middle.
|
||||
|
||||
|
||||
|
||||
|
||||
DP c_int = rstate.c_int;
|
||||
|
||||
|
||||
DP Eout = log(pow(lstate.E - rstate.E,2.)) - (2)*log(c_int) - log(2*lstate.N);
|
||||
|
||||
|
||||
for (int a = 0; a < lstate.N; ++a) {
|
||||
Vplus[a] = Fn_V_g2 (a, lstate, rstate);
|
||||
//Fn_Prod[a] = 1.0;
|
||||
@@ -161,33 +160,33 @@ namespace JSC {
|
||||
if (m != a) ln_Fn_Prod[a] += log(complex<DP>(lstate.lambdaoc[m] - rstate.lambdaoc[a])/(rstate.lambdaoc[m] - rstate.lambdaoc[a]));
|
||||
rKern[a] = rstate.Kernel (a, p);
|
||||
}
|
||||
|
||||
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
one_plus_U[a][b] = (a == b ? 1.0 : 0.0) + 0.5 * 1./imag(Vplus[a])
|
||||
//* Fn_Prod[a] * (rstate.Kernel(a,b) - rKern[b]);
|
||||
* ((lstate.lambdaoc[a] - rstate.lambdaoc[a])*real(exp(ln_Fn_Prod[a])) * (rstate.Kernel(a,b) - rKern[b]) + rKern[b]);
|
||||
|
||||
|
||||
complex<DP> ln_ddalpha_sigma = lndet_LU_dstry(one_plus_U);
|
||||
|
||||
|
||||
complex<DP> ln_prod_V = 0.0;
|
||||
for (int a = 0; a < lstate.N; ++a) ln_prod_V += log(2.0 * II * imag(Vplus[a]));
|
||||
|
||||
|
||||
complex<DP> ln_prod_2 = 0.0;
|
||||
for (int a = 0; a < lstate.N; ++a)
|
||||
for (int b = 0; b < lstate.N; ++b)
|
||||
ln_prod_2 += log((rstate.lambdaoc[a] - rstate.lambdaoc[b] + II)/(lstate.lambdaoc[a] - rstate.lambdaoc[b]));
|
||||
|
||||
|
||||
//cout << "ln_Fn_Prod = " << ln_Fn_Prod << endl;
|
||||
//cout << endl << ln_ddalpha_sigma << "\t" << ln_prod_V << "\t" << ln_prod_2 << "\t" << - log(2.0 * II * imag(Vplus[p])) << "\t" << - 0.5 * (lstate.lnnorm + rstate.lnnorm) << "\t" << ln_ddalpha_sigma + ln_prod_V + ln_prod_2 - log(2.0 * II * imag(Vplus[p])) - 0.5 * (lstate.lnnorm + rstate.lnnorm) << endl;
|
||||
|
||||
|
||||
ln_ddalpha_sigma += ln_prod_V + ln_prod_2 - log(2.0 * II * imag(Vplus[p]));
|
||||
|
||||
|
||||
return (log(II) + Eout + ln_ddalpha_sigma - 0.5 * (lstate.lnnorm + rstate.lnnorm));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace ABACUS
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::balanc(SQMat_DP& a)
|
||||
void ABACUS::balanc(SQMat_DP& a)
|
||||
{
|
||||
// Balancing of nonsymmetric matrix. See NR p.489.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
DP JSC::det_LU (SQMat_DP a)
|
||||
DP ABACUS::det_LU (SQMat_DP a)
|
||||
{
|
||||
// Returns the determinant of matrix a, through LU decomposition
|
||||
// In order to preserve the original matrix, it is copied first.
|
||||
@@ -12,7 +12,7 @@ DP JSC::det_LU (SQMat_DP a)
|
||||
|
||||
DP d;
|
||||
|
||||
JSC::ludcmp (mat, indx, d);
|
||||
ABACUS::ludcmp (mat, indx, d);
|
||||
|
||||
for (int j = 0; j < mat.size(); j++) d *= mat[j][j];
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
complex<DP> JSC::det_LU_CX (SQMat_CX a)
|
||||
complex<DP> ABACUS::det_LU_CX (SQMat_CX a)
|
||||
{
|
||||
// Returns the determinant of matrix a, through LU decomposition
|
||||
|
||||
@@ -11,11 +11,11 @@ complex<DP> JSC::det_LU_CX (SQMat_CX a)
|
||||
|
||||
DP d;
|
||||
|
||||
JSC::ludcmp_CX (mat, indx, d);
|
||||
ABACUS::ludcmp_CX (mat, indx, d);
|
||||
|
||||
complex<DP> dd = d;
|
||||
|
||||
for (int j = 0; j < mat.size(); j++) dd *= mat[j][j];
|
||||
|
||||
|
||||
return(dd);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
|
||||
void JSC::eigsrt (Vect_DP& d, SQMat_DP& v)
|
||||
void ABACUS::eigsrt (Vect_DP& d, SQMat_DP& v)
|
||||
{
|
||||
// This puts the eigenvalues in INCREASING order, not decreasing as in NR !
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::elmhes(SQMat_DP& a)
|
||||
void ABACUS::elmhes(SQMat_DP& a)
|
||||
{
|
||||
// Reduction to Hessenberg form by elimination method. NR p.490
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSC.h"
|
||||
#include "ABACUS.h"
|
||||
using namespace std;
|
||||
|
||||
void JSC::gaussj (SQMat_DP& a, SQMat_DP& b)
|
||||
void ABACUS::gaussj (SQMat_DP& a, SQMat_DP& b)
|
||||
{
|
||||
int i, j, k, l, ll;
|
||||
int icol = 0;
|
||||
@@ -33,7 +33,7 @@ void JSC::gaussj (SQMat_DP& a, SQMat_DP& b)
|
||||
}
|
||||
indxr[i] = irow;
|
||||
indxc[i] = icol;
|
||||
if (a[icol][icol] == 0.0) JSCerror("gaussj: singular matrix");
|
||||
if (a[icol][icol] == 0.0) ABACUSerror("gaussj: singular matrix");
|
||||
pivinv = 1.0/a[icol][icol];
|
||||
a[icol][icol] = 1.0;
|
||||
for (l = 0; l < n; l++) a[icol][l] *= pivinv;
|
||||
@@ -53,4 +53,3 @@ void JSC::gaussj (SQMat_DP& a, SQMat_DP& b)
|
||||
SWAP (a[k][indxr[l]], a[k][indxc[l]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user