sanshar / StackBlock

GNU General Public License v3.0
11 stars 12 forks source link

Transition Density Matrices Between Different Irrep #5

Open Biondilbiondo opened 4 years ago

Biondilbiondo commented 4 years ago

Hello everyone, I'm trying to use StackBlock to perform some DMRG calculations (via PySCF interface) and I also need to calculate 1,2 particle(s) transition density matrices between wfns belonging to different spatial symmetries. I tried to follow the tutorial here [1] but I got the following error: Loading Wavefunction scratch_tran/node0/wave-0-24.0.1.tmp Warning :: Didn't Normalise, because norm is 0.000000000000 followed by a segmentation fault.

I tried both with my system and with the example in the repository (README_Examples/12/) but I always got the same result.

According to a quick and dirty debug I found that the error happens in the call of function GuessWave::guess_wavefunctions in modules/npdm/npdm.C at line 122; here when the function calls Normalize(), it seem to get zero in the DotProduct.

Do you have the same issue or I'm doing something wrong in the process for calculate these TDMs?

Thanks, Mattia

[1] https://sanshar.github.io/Block/examples.html#transition-dm

bogdanoff commented 4 years ago

It seems that some part of the code for this functionality was not adapted in StackBlock.

You can try to use the older Block (aka Block 1.1) for now. Temp files are not compatible between Block and StackBlock, so you'll need to rerun the calculations.

Biondilbiondo commented 4 years ago

Ok. So you confirm that this issue is present, and it is not just an error in the procedure? If so, I suggest you to update the documentation. If I can help in fixing this issue, please let me know. Mattia

Biondilbiondo commented 4 years ago

I have also tried to use Block 1.1 to run example 12 and I got the same problem. To help to reproduce the problem I'm experiencing I wrote a simple script that reproduces the issue.

#!/bin/bash
set -e

BLOCK_SPIN_ADAPTED=/home/mattia/software/block_dmrg/block-git/block.spin_adapted
#BLOCK_SPIN_ADAPTED=/home/mattia/software/stackblock_dmrg/StackBlock/block.spin_adapted

STACKBLOCK_REPO=/home/mattia/software/stackblock_dmrg/StackBlock

cp $STACKBLOCK_REPO/README_Examples/FCIDUMP .
cp $STACKBLOCK_REPO/README_Examples/12/*.dat . 

mkdir scratch_bra
$BLOCK_SPIN_ADAPTED input_bra.dat > output_bra.txt

mkdir scratch_ket
$BLOCK_SPIN_ADAPTED input_ket.dat > output_ket.txt

# Create the scratch for trdm calculation
mkdir -p scratch_tran/node0
cd scratch_tran/node0/
# Copy bra wfn
cp ../../scratch_bra/node0/{statefile,wave,Rotation}*0.tmp .
rename .0.tmp .1.tmp *.tmp
rename .state0.tmp .state1.tmp Rotation*.tmp

# Copy ket wfn
cp ../../scratch_ket/node0/{statefile,wave,Rotation}*0.tmp .

cd ../../

# Calculate TRDM
$BLOCK_SPIN_ADAPTED input.dat > output.txt

I also attach the output of my calculations (performed with both Block 1.1; the one with StackBlock 1.5 are very similar).

output_ket.txt output_bra.txt output.txt

Running this script you get the same error? Is there something wrong in what I'm doing or is a feature that have been broken in some commit? Just to know if git bisect can be the way to go for finding the solution. Thanks again, Mattia

bogdanoff commented 3 years ago

I reproduce your error with StackBlock. But with Block your script actually works if I also copy the RestartReorder.dat file. Quick inspection of your output file in the last comment actually tells me that it was produced with StackBlock.

hczhai commented 3 years ago

This bug is now fixed in StackBlock: https://github.com/hczhai/StackBlock/commit/d69835ae2f974d3bf85062f1946d98c8556fec44