Skip to content

Troubleshooting Determinant Import Issues in TREXIO with PySCF #43

@NastaMauger

Description

@NastaMauger

Hello,

I am trying to import my casci wavefunction into qp2. To do so I am using trexio-tools.
After importing my one- and two-electron integrals and my TREXIO data from PySCF using:

qp_import_trexio.py casci.hdf5
qp set_file casci.hdf5.ezfio/
qp set mo_basis mo_label Canonical
qp_run import_trexio_integrals casci.hdf5.ezfio
qp_run print_energy casci.hdf5.ezfio

I can verify that it returns the same energy components as PySCF.
However, I would also like to import my determinants. To do so, I ran:

qp_run import_trexio_determinants casci.hdf5.ezfio/

However, I am experiencing a few issues:

  1. The files created in casci.hdf5.ezfio/determinants, named psi_det_qp_edit.gz and psi_det.gz, don’t seem to contain meaningful data, although the corresponding coefficients files appear to be correct.
  2. While no error occurs when running the import_trexio_determinants command, the print_energy command now fails with this error:
Providing the one-electron integrals
* N_int                                                          1
 * mo_label          Canonical
* Number of determinants                                         5
* Dimension of the psi arrays                                    5
 Read psi_det
 Read psi_coef           5           1
.. >>>>> [ IO READ: mo_class ] <<<<< ..
  cpu  time :  4.399999999998849E-005 s
  wall time :  7.152557373046875E-006 s  ( x    6.15164586666506      )
 MO map initialized:                   1540
 ac_operator: iorb < 1
    -1822208          10
-1
Program exited with code 255.
Wall time: 0:00:01

My guess is that I might not be registering my determinants list correctly. However, if this were the case, how could the import_trexio_determinants command run without issues?

Here is how I handled this in my PySCF script:

# Determinants in TREXIO
from trexio_tools.group_tools import determinant as trexio_det
int64_num = int((mo_num-1)/64) + 1 

det_list = []
#occsa is my spin up list whereas occsb is my spin down
for occsa, occsb, _, _ in data_all_sorted:
    det_tmp = []
    det_tmp += trexio_det.to_determinant_list(occsa, int64_num)
    det_tmp += trexio_det.to_determinant_list(occsb, int64_num)
    det_list.append(det_tmp)
    print(det_tmp)

offset_file = 0 
trexio_file.set_state(1)
trexio.write_state_num(trexio_file, 1)
trexio.write_determinant_list(trexio_file, offset_file, num_determinants, det_list)

ci_coeff_list = []
for occsa, occsb, ci_coeff, _ in data_all_sorted:
    ci_coeff_list.append(ci_coeff)

if len(ci_coeff_list) == num_determinants:
    dset = np.array(ci_coeff_list)  
    trexio.write_determinant_coefficient(trexio_file, offset_file, num_determinants, dset)

I’ve attached my casci.hdf5 file, generated by Pyscf for reference.

If anyone has insights into why this error is occurring or suggestions on how to resolve it, I would really appreciate your help. Thank you in advance!

Best

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions