Skip to content

Conversation

@Awallace3
Copy link
Contributor

@Awallace3 Awallace3 commented May 22, 2024

Description

Added SAPT0-D4 and SAPT0-D4M methods and parameters along with a test

User API & Changelog headlines

  • Enables users to call SAPT0-D4M and FISAPT0-D4M based on the damping function parameters provided from this work.

Dev notes & details

  • Adds D4M options for SAPT0 methods by adding HF-D4M to the list of functionals in hyb_functionals.py. To keep the naming convention similar to what is used in -D3 in QCEngine, HF-D4 is named HF-D4BJEEQATM and HF-D4M, which does not have ATM enabled making it two body only, is named HF-D4BJEEQTWO.

Questions

  • Is hyb_functionals.py the desired location for these parameters?

Checklist

Status

  • Ready for review
  • Ready for merge

Copy link
Member

@loriab loriab 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 contribution!

procedures['energy']['sapt0-' + disp] = proc.run_sapt
procedures['energy']['fisapt0-' + disp] = proc.run_fisapt

procedures['energy']['sapt0-d4'] = proc.run_sapt
Copy link
Member

Choose a reason for hiding this comment

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

Could this be leftover and unneeded? I'd think the block above could catch and define this.

Should fisapt0-d4 work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a test for fsapt-d4 under ./tests/fsapt-d4 following similar tests of ./tests/fsapt-terms and /tests/fsaptd-terms.

@loriab loriab added this to the Psi4 1.10 milestone Jul 12, 2024
Han Solo: This is *not* gonna work.
Luke Skywalker: Why didn't you say so before?
Han Solo: I *did* say so before.
=> HF-D4(BJ,EEQ)ATM: Empirical Dispersion <=
Copy link
Member

Choose a reason for hiding this comment

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

is this output.ref old (s9=1, ATM) and should be regenerated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the output.ref to be from the most recent updates. I have an evaluation for regular fisapt0-d4 (atm) and fisapt0-d4bj2b (no atm), so there are two locations where the HF-D4 information is printed. I believe you are looking for the second energy call. Would you prefer these two energy calls to be broken into two different tests, or could it be left as one test?

Copy link
Member

Choose a reason for hiding this comment

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

sure, fine to leave as one test. I just spotted the ATM, recalled the changes we had made, and wanted to check with you.

@@ -0,0 +1,4 @@
include(TestingMacros)
Copy link
Member

Choose a reason for hiding this comment

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

this test dir needs a test_input.py file and make sure it has the using(dftd4) (approximate syntax) in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I setup the tests/fsapt-d4/test_input.py to be similar to the tests/fsaptd-terms/test_input.py, switching the uusing from dftd3 to dftd4.

Copy link
Member

Choose a reason for hiding this comment

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

thanks, did this get pushed?

# compare_values(fEref['fEedisp'])

for key in fkeys: #TEST
compare_values(fEref[key], fEnergies[key], 2, key) #TEST
Copy link
Member

Choose a reason for hiding this comment

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

are these checks so loose (0.01) for a reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This compare_values tolerance is copied over from the tests/fsaptd-terms/test_input.py test for I believe that processing the fsapt values lowers the relevant precision. I have attached the snippet from fsaptd-terms below:

import os
import sys
import subprocess

os.chdir('fsapt')
with open('fA.dat', 'w') as fA: fA.write("MethylA 1 2 3 4 5")
with open('fB.dat', 'w') as fB: fB.write("MethylB 6 7 8 9 10")
subprocess.run([sys.executable, os.path.join('..', 'fsapt.py')], check=True)

fEnergies = {}
fkeys = ['fEelst', 'fEexch', 'fEindAB', 'fEindBA', 'fEdisp', 'fEedisp', 'fEtot']    #TEST 

with open('fsapt.dat', 'r') as fsapt:                                    #TEST
    Energies = [float(x) for x in fsapt.readlines()[-2].split()[2:]]     #TEST

for pair in zip(fkeys,Energies):            #TEST
    fEnergies[pair[0]] = pair[1] #TEST

fEref = {               #TEST
    'fEelst' : -0.002,  #TEST 
    'fEexch' :  0.000,  #TEST  
    'fEindAB': -0.000,  #TEST 
    'fEindBA': -0.000,  #TEST 
    'fEdisp' :  0.000,  #TEST 
    'fEedisp': -0.033,  #TEST 
    'fEtot'  : -0.036}  #TEST

for key in fkeys:                                      #TEST
    compare_values(fEref[key], fEnergies[key], 2, key) #TEST                  

Han Solo: This is *not* gonna work.
Luke Skywalker: Why didn't you say so before?
Han Solo: I *did* say so before.
=> HF-D4(BJ,EEQ)ATM: Empirical Dispersion <=
Copy link
Member

Choose a reason for hiding this comment

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

sure, fine to leave as one test. I just spotted the ATM, recalled the changes we had made, and wanted to check with you.

Copy link
Member

@loriab loriab left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@loriab loriab added this pull request to the merge queue Aug 11, 2025
Merged via the queue into psi4:master with commit d089223 Aug 11, 2025
6 checks passed
@loriab loriab mentioned this pull request Sep 5, 2025
@DanielWicz
Copy link

I did notice that I can call sapt0-d4bj. Which version is then chosen ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants