tequilahub / tequila

A High-Level Abstraction Framework for Quantum Algorithms
MIT License
362 stars 101 forks source link

Trouble getting madness backend to work with larger molecules #247

Closed jjgoings closed 1 year ago

jjgoings commented 2 years ago

Hi, I'm able to successfully run the example:

import tequila as tq

# initialize molecule (also works over .xyz files --> see next example)
geomstring="Li 0.0 0.0 0.0\nH 0.0 0.0 1.6"
mol = tq.Molecule(geometry=geomstring)

and I get

Starting madness calculation with executable:  /home/goings/miniconda3/envs/madness/bin/pno_integrals
output redirected to lih_pno_integrals.out logfile
finished after 24.076884031295776s

I installed using the madtequila conda method.

Smaller molecules (like H2 or BeH2) also work as well. But if I try and do anything larger, say Li2 or N2:

import tequila as tq

# initialize molecule (also works over .xyz files --> see next example)
geomstring="Li 0.0 0.0 0.0\nLi 0.0 0.0 1.6"
mol = tq.Molecule(geometry=geomstring)

then I get the error:

Starting madness calculation with executable:  /home/goings/miniconda3/envs/madness/bin/pno_integrals
output redirected to li2_pno_integrals.out logfile
finished after 28.895132541656494s
Traceback (most recent call last):
  File "/home/goings/basis_free/prod/test.py", line 5, in <module>
    mol = tq.Molecule(geometry=geomstring)
  File "/home/goings/miniconda3/envs/madness/lib/python3.10/site-packages/tequila/quantumchemistry/__init__.py", line 115, in Molecule
    return INSTALLED_QCHEMISTRY_BACKENDS[backend.lower()](parameters=parameters, transformation=transformation,
  File "/home/goings/miniconda3/envs/madness/lib/python3.10/site-packages/tequila/quantumchemistry/madness_interface.py", line 110, in __init__
    raise TequilaMadnessException("Could not initialize the madness interface\n"
tequila.quantumchemistry.madness_interface.TequilaMadnessException: Error in madness backend:Could not initialize the madness interface
Status report is
found li2_htensor.npy=False
found li2_gtensor.npy=False
madness=madness_run=[Errno 2] No such file or directory: 'pnoinfo.txt' -> 'li2_pnoinfo.txt'
found li2_htensor.npy=False
found li2_gtensor.npy=False
found li2_pnoinfo.txt=False
h_tensor report:
failed
[Errno 2] No such file or directory: 'molecule_htensor.bin'
g_tensor report:
failed
[Errno 2] No such file or directory: 'molecule_gtensor.bin'
pnoinfo report:
failed
[Errno 2] No such file or directory: 'li2_pnoinfo.txt'

either provide li2_gtensor.npy and li2_htensor.npy files
or provide the number of pnos over by giving the n_pnos keyword to run madness
in order for madness to run you need to make sure that the pno_integrals executable can be found in your environment
alternatively you can provide the path to the madness_root_dir: the directory where you compiled madness

Any thoughts? I'm using a VM on GCP with Linux and 32 GB RAM and 500 GB disk, 8 CPUs.

Here's some additional outputs: li2_pno_integrals.out.txt nemo_iterations.txt scf_info.json.txt input.txt

jjgoings commented 2 years ago

Will note that running /home/goings/miniconda3/envs/madness/bin/pno_integrals on the generated input gives me molecule_gtensor.bin and molecule_htensor.bin and exits successfully

kottmanj commented 2 years ago

Hi Josh,

thanks for noticing and the detailed report, that made it really convenient to find the issue.

The problem was with the auto-detection of frozen-core orbitals that suffered from an "=" instead of "+=" bug - meaning it only took the last non-hydrogen atom into account. Test are quite diverse, but all of them only have one heavy atom (like BeH2), so this went unnoticed.

currently no clean way around it in version 1.8.1, but re-installing tequila from the devel branch (once the pull-request is merged) fixes it:

pip install git+https://github.com/aspuru-guzik-group/tequila.git@devel

before merge:

pip install git+https://github.com/aspuru-guzik-group/tequila.git@pr-devel

will keep the issue open until the merge.

jjgoings commented 2 years ago

Awesome, thanks! Seems to be working for me now. Close when you are ready!