Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable user-defined MRSQK reference space #210

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

RenkeHuang
Copy link
Contributor

@RenkeHuang RenkeHuang commented Jun 17, 2023

Description

Enable user to input a spin-adapted reference space for MRSQK calculations.

User Notes

  • enable user-defined MRSQK reference spaces
  • add option that writes intermediate matrices in QSD calculations to disk (.npz file)

Checklist

  • Added tests of new features
  • Documented source code
  • Ready to go!

Copy link
Contributor

@JonathonMisiewicz JonathonMisiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the only goal of this PR to enable user-defined MRSQK reference spaces?

It seems to me that it's also trying to allow saving intermediates. Is this true? Is this PR trying to accomplish anything else?

src/qforte/abc/qsdabc.py Outdated Show resolved Hide resolved
@RenkeHuang RenkeHuang removed the request for review from fevangelista June 30, 2023 19:07
Copy link
Contributor

@JonathonMisiewicz JonathonMisiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the code. I have a few additional comments and questions.

@@ -126,6 +126,8 @@ def run(self,
mr_dt=0.5,
target_root=0,
reference_generator='SRQK',
refs_user_defined=None,
save_qk_matrices=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include this keyword in the docstring.

@@ -178,9 +183,15 @@ def run(self,
self.build_refs_from_srqk()

print('\n ==> SRQK reference selection complete.')

elif reference_generator.lower()=='user':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif reference_generator.lower()=='user':
elif reference_generator.lower() == 'user':

print('Trial reference state: ', ref_string(self._ref, self._nqb))
print('Trial state preparation method: ', self._state_prep_type)
print('Reference space generator ', self._reference_generator.upper())
if(self._reference_generator.upper()=='SRQK'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(self._reference_generator.upper()=='SRQK'):
if self._reference_generator.upper()=='SRQK':

@@ -424,15 +440,16 @@ def build_sa_qk_mats(self):

k = p+1
self._n_classical_params = k
if(k==1):
if(k==1) and (self._reference_generator != 'user'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(k==1) and (self._reference_generator != 'user'):
if k==1 and self._reference_generator != 'user':

Comment on lines +705 to +706
for i, csf in enumerate(refs_user_defined):
print('\nRef ', i+1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for i, csf in enumerate(refs_user_defined):
print('\nRef ', i+1)
for i, csf in enumerate(refs_user_defined, start=1):
print('\nRef ', i)

if (self._print_summary_file):
f.write(f' {scond:7.2e} {np.real(evals[self._target_root]):+15.9f} {self._n_classical_params:8} {self._n_cnot:10} {self._n_pauli_trm_measures:12}\n')

if len(evals) > self._target_root:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line added?

@@ -60,6 +61,8 @@ def run(self,
self._n_cnot = 0
self._n_pauli_trm_measures = 0

self._save_qk_matrices = save_qk_matrices
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that nt_srqk is called before the MRSQK. Is there a risk of MRSQK overwriting the saved QK files from here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants