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

ExternalPotential in Bohr #2515

Merged
merged 4 commits into from
Mar 31, 2022
Merged

ExternalPotential in Bohr #2515

merged 4 commits into from
Mar 31, 2022

Conversation

loriab
Copy link
Member

@loriab loriab commented Mar 30, 2022

Description

The psi4.core.ExternalPotential object has long stored its charge locations in the same units as its BasisSet's Molecule. Also, the usual way of initializing it is by creating a psi4.driver.qmmm.QMMM() object and then doing the unusual psi4.set_global_option_python("EXTERN", qmmmobj.extern) to a field of that object. That's the situation for "plain" external charges calcs, where there's only one potential and both charges and locations are specified.

Additionally, there's two related categories. F-SAPT can put different external potentials on any of fragments A, B, C, which have been passed in as energy("fisapt", external_potentials={"A": extern, ...}, ...). Also nbody can take an array of charges (not locations) that replace fragments when the fragments are ghosted. These are passed as energy(..., bsse_type=..., embedding_charges=[monoAchg, ...])

Problems:

  • formation of Python objects in the input file and special options setting doesn't translate to QCSchema, which is the sole means of communication for many calcs in DDD.
  • the most common calc, the simple single extern has no kwarg-to-energy way to set
  • the uncertainty in units of ExternalPotential can be confusing and has led to bugs. Also, in DDD, the spec order of mol and extern may not be so clear to set the units.

This is No. 2 of the DDD series, #1351.

Todos

  • Replace QMMM() with QMMMbohr() and issue an update guide if the former is called.
  • For the common single-extern case, switch to energy(..., external_potentials=array instead of QMMM() object. This tests whether the external_potentials value is an array for a single extern, which gets processed and set immediately, or a dict of externs, which gets handled by the run_fsapt later on.
  • relaxed the array spec by which externs are initialized. instead of q, [x, y, z] also allow q, x, y, z, which makes for very easy numpy processing for units transofmation.
  • removed all the units handling around ExternalPotential
  • docs

Questions

  • ok to use external_potentials kwarg for both simple and fsapt multi frags use cases?

Checklist

Status

  • Ready for review
  • Ready for merge

@loriab
Copy link
Member Author

loriab commented Mar 30, 2022

looks like MDI is the first casualty of QMMM and ecosystem GHA. This PR can have a warning for QMMM, then kill it off for DDD.

doc/sphinxman/source/scf.rst Outdated Show resolved Hide resolved
psi4/driver/procrouting/proc.py Show resolved Hide resolved
psi4/driver/driver.py Outdated Show resolved Hide resolved
psi4/driver/procrouting/proc.py Show resolved Hide resolved
pytest.ini Outdated Show resolved Hide resolved
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.

LGTM now, many thanks for breaking DDD down.

@loriab loriab added this to the Psi4 1.6 milestone Mar 30, 2022
@loriab loriab added schema deploys or develops MolSSI/QCSchema libmints For things that are wrong with libmints (but not wavefunction). labels Mar 30, 2022
Copy link
Member

@hokru hokru left a comment

Choose a reason for hiding this comment

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

lgtm. I think this will lead to less confusion about units.

0.417, -1.0231, 1.6243, -0.8743,
-0.834, -0.5806, 2.0297, -0.1111,
0.417, -0.9480, 1.5096, 0.6281]).reshape((-1, 4))
Chrgfield_C[:,[1,2,3]] /= psi_bohr2angstroms
Copy link
Member

Choose a reason for hiding this comment

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

Excellent - great to show the user how to get bohr from Angstrom easily :)

Copy link
Member

@andysim andysim left a comment

Choose a reason for hiding this comment

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

LGTM - this will be a little easier to generalize to other input formats. Thanks for taking care of it. This will simplify the blurred multipole specification, methinks.

@JonathonMisiewicz JonathonMisiewicz merged commit b5f84b6 into psi4:master Mar 31, 2022
zachglick pushed a commit to zachglick/psi4 that referenced this pull request Apr 18, 2022
* extern in Bohr

* docs and fix mdi

* review comments

* Update doc/sphinxman/source/scf.rst

Co-authored-by: Andy Simmonett <[email protected]>

Co-authored-by: Andy Simmonett <[email protected]>
zachglick pushed a commit to zachglick/psi4 that referenced this pull request Apr 18, 2022
* extern in Bohr

* docs and fix mdi

* review comments

* Update doc/sphinxman/source/scf.rst

Co-authored-by: Andy Simmonett <[email protected]>

Co-authored-by: Andy Simmonett <[email protected]>
@loriab loriab mentioned this pull request Apr 19, 2022
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libmints For things that are wrong with libmints (but not wavefunction). schema deploys or develops MolSSI/QCSchema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants