mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 03:23:29 +01:00
Open-Shell CSF: Fix bug in getbftodetfunction.
This commit is contained in:
parent
727815751c
commit
4ccaa8f695
@ -68,12 +68,18 @@ void getBFIndexList(int NSOMO, int *BF1, int *IdxListBF1){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(countN1 <= 0){
|
||||||
|
BFcopy[Iidx] = -1;
|
||||||
|
IdxListBF1[Iidx] = Iidx;
|
||||||
|
}
|
||||||
|
else{
|
||||||
BFcopy[Iidx] = -1;
|
BFcopy[Iidx] = -1;
|
||||||
BFcopy[Jidx] = -1;
|
BFcopy[Jidx] = -1;
|
||||||
IdxListBF1[Jidx] = Iidx;
|
IdxListBF1[Jidx] = Iidx;
|
||||||
IdxListBF1[Iidx] = Jidx;
|
IdxListBF1[Iidx] = Jidx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1297,16 +1303,21 @@ void getbftodetfunction(Tree *dettree, int NSOMO, int MS, int *BF1, double *rowv
|
|||||||
double fac = 1.0;
|
double fac = 1.0;
|
||||||
for(int i = 0; i < NSOMO; i++)
|
for(int i = 0; i < NSOMO; i++)
|
||||||
donepq[i] = 0.0;
|
donepq[i] = 0.0;
|
||||||
|
for(int i=0;i<npairs;++i){
|
||||||
|
for(int j=0;j<NSOMO;++j)
|
||||||
|
detslist[i*npairs + j]=0;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i < NSOMO; i++){
|
for(int i = 0; i < NSOMO; i++){
|
||||||
idxp = BF1[i];
|
idxp = BF1[i];
|
||||||
idxq = BF1[idxp];
|
idxq = BF1[idxp];
|
||||||
// Do one pair only once
|
// Do one pair only once
|
||||||
if(donepq[idxp] > 0.0 || donepq[idxq] > 0.0) continue;
|
if(donepq[idxp] > 0.0 || donepq[idxq] > 0.0 || idxp == idxq) continue;
|
||||||
fac *= 2.0;
|
fac *= 2.0;
|
||||||
donepq[idxp] = 1.0;
|
donepq[idxp] = 1.0;
|
||||||
donepq[idxq] = 1.0;
|
donepq[idxq] = 1.0;
|
||||||
for(int j = 0; j < npairs; j = j + shft){
|
for(int j = 0; j < npairs; j = j + shft){
|
||||||
|
printf("i=%d j=%d (%d,%d)\n",i,j,idxp,idxq);
|
||||||
for(int k = 0; k < shft/2; k++){
|
for(int k = 0; k < shft/2; k++){
|
||||||
detslist[(k+j)*NSOMO + idxp] = 1;
|
detslist[(k+j)*NSOMO + idxp] = 1;
|
||||||
detslist[(k+j)*NSOMO + idxq] = 0;
|
detslist[(k+j)*NSOMO + idxq] = 0;
|
||||||
@ -1319,15 +1330,26 @@ void getbftodetfunction(Tree *dettree, int NSOMO, int MS, int *BF1, double *rowv
|
|||||||
}
|
}
|
||||||
shft /= 2;
|
shft /= 2;
|
||||||
}
|
}
|
||||||
|
for(int i=0;i<npairs;++i){
|
||||||
|
for(int j=0;j<NSOMO;++j)
|
||||||
|
printf(" %d ",detslist[i*NSOMO + j]);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf(" done detslist npairs=%d NSOMO=%d\n",npairs,NSOMO);
|
||||||
// Now get the addresses
|
// Now get the addresses
|
||||||
int inpdet[NSOMO];
|
int inpdet[NSOMO];
|
||||||
int phase_cfg_to_qp=1;
|
int phase_cfg_to_qp=1;
|
||||||
int addr = -1;
|
int addr = -1;
|
||||||
for(int i = 0; i < npairs; i++){
|
for(int i = 0; i < npairs; i++){
|
||||||
for(int j = 0; j < NSOMO; j++)
|
for(int j = 0; j < NSOMO; j++) {
|
||||||
inpdet[j] = detslist[i*NSOMO + j];
|
inpdet[j] = detslist[i*NSOMO + j];
|
||||||
|
printf(" %d ",inpdet[j]);
|
||||||
|
printf("\n-- i=%d j=%d \n",i,j);
|
||||||
|
}
|
||||||
findAddofDetDriver(dettree, NSOMO, inpdet, &addr);
|
findAddofDetDriver(dettree, NSOMO, inpdet, &addr);
|
||||||
|
printf("(%d) add=%d\n",i,addr);
|
||||||
// Calculate the phase for cfg to QP2 conversion
|
// Calculate the phase for cfg to QP2 conversion
|
||||||
//get_phase_cfg_to_qp_inpList(inpdet, NSOMO, &phase_cfg_to_qp);
|
//get_phase_cfg_to_qp_inpList(inpdet, NSOMO, &phase_cfg_to_qp);
|
||||||
//rowvec[addr] = 1.0 * phaselist[i]*phase_cfg_to_qp/sqrt(fac);
|
//rowvec[addr] = 1.0 * phaselist[i]*phase_cfg_to_qp/sqrt(fac);
|
||||||
@ -1415,6 +1437,10 @@ void convertBFtoDetBasis(int64_t Isomo, int MS, double **bftodetmatrixptr, int *
|
|||||||
addI = i;
|
addI = i;
|
||||||
getIthBFDriver(&bftree, NSOMO, addI, BF1);
|
getIthBFDriver(&bftree, NSOMO, addI, BF1);
|
||||||
getBFIndexList(NSOMO, BF1, IdxListBF1);
|
getBFIndexList(NSOMO, BF1, IdxListBF1);
|
||||||
|
printf("ms=%d \n",MS);
|
||||||
|
for(int j=0;j<NSOMO;++j)
|
||||||
|
printf(" %d(%d) ",BF1[j],IdxListBF1[j]);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
// Get ith row
|
// Get ith row
|
||||||
@ -1661,6 +1687,12 @@ void getApqIJMatrixDriverArrayInp(int64_t Isomo, int64_t Jsomo, int32_t orbp, in
|
|||||||
orthoMatrixI = malloc(rowsI*colsI*sizeof(double));
|
orthoMatrixI = malloc(rowsI*colsI*sizeof(double));
|
||||||
|
|
||||||
gramSchmidt(overlapMatrixI, rowsI, colsI, orthoMatrixI);
|
gramSchmidt(overlapMatrixI, rowsI, colsI, orthoMatrixI);
|
||||||
|
for(int i=0;i<rowsI;++i) {
|
||||||
|
for(int j=0;j<colsI; ++j) {
|
||||||
|
printf(" %5.3f ",orthoMatrixI[j*rowsI + i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
Doing J
|
Doing J
|
||||||
@ -1680,6 +1712,12 @@ void getApqIJMatrixDriverArrayInp(int64_t Isomo, int64_t Jsomo, int32_t orbp, in
|
|||||||
|
|
||||||
gramSchmidt(overlapMatrixJ, rowsJ, colsJ, orthoMatrixJ);
|
gramSchmidt(overlapMatrixJ, rowsJ, colsJ, orthoMatrixJ);
|
||||||
|
|
||||||
|
for(int i=0;i<rowsJ;++i) {
|
||||||
|
for(int j=0;j<colsJ; ++j) {
|
||||||
|
printf(" %5.3f ",orthoMatrixJ[j*rowsJ + i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
int rowsA = 0;
|
int rowsA = 0;
|
||||||
int colsA = 0;
|
int colsA = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user