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

Interface to dftd4 #3

Closed
sunqm opened this issue Jun 20, 2021 · 7 comments · Fixed by #7
Closed

Interface to dftd4 #3

sunqm opened this issue Jun 20, 2021 · 7 comments · Fixed by #7
Labels
enhancement New feature or request

Comments

@sunqm
Copy link
Contributor

sunqm commented Jun 20, 2021

See relevant discussions in
pyscf/pyscf#983
dftd4/dftd4#107

@sunqm sunqm added the enhancement New feature or request label Jun 20, 2021
@awvwgk
Copy link
Contributor

awvwgk commented Apr 30, 2022

Trying to implement an interface like provided here in awvwgk/simple-dftd3#17, if this works as expected I can implement it for DFT-D4 as well. The linked implementation in dftd3.pyscf should provide a drop-in replacement of pyscf.dftd3.itrf.

This interface could be forwarded here using

# pyscf.dftd3
import dftd3.pyscf as itrf
dftd3 = itrf.dftd3
grad = itrf.grad

Only feature not supported is DFT-D2.

@gkc1000
Copy link

gkc1000 commented Apr 30, 2022 via email

@awvwgk
Copy link
Contributor

awvwgk commented May 1, 2022

Should be usable now, instructions for dftd3.pyscf and dftd4.pyscf are up now. Since the change affects only the Python bindings the latest trunk can be built against the binary distribution from conda-forge for testing as described in the linked README files.

I can send a patch to forward the DFT-D4 / DFT-D3 integration here or update the pyscf.org webpage to directly point to the upstream repositories. Any preferences?

@sunqm
Copy link
Contributor Author

sunqm commented Mar 29, 2023

Since the dftd3 dftd4 pyscf interface is available, can I disable this extension and add a message to redirect to the dftd3 and dftd4 native modules? @awvwgk

@jeanwsr
Copy link
Contributor

jeanwsr commented Mar 29, 2023

I think we still need a wrapper to provide the total energy and grad -- with simple-dftd3 you only get the part from d3. Thus users can do something like mf = to_dftd3(mf). That's what ajz34/vdw do (including wrapper for dftd4).

We are planning to contribute that to pyscf-forge.

@awvwgk
Copy link
Contributor

awvwgk commented Mar 29, 2023

This wrappers are already provided in both dftd4.pyscf and dftd3.pyscf by using the energy and grad functions:

>>> from pyscf import gto, scf
>>> import dftd3.pyscf as d3
>>> mol = gto.M(
...     atom="""
...          O  -1.65542061  -0.12330038   0.00000000
...          O   1.24621244   0.10268870   0.00000000
...          H  -0.70409026   0.03193167   0.00000000
...          H  -2.03867273   0.75372294   0.00000000
...          H   1.57598558  -0.38252146  -0.75856129
...          H   1.57598558  -0.38252146   0.75856129
...          """
... )
>>> grad = d3.energy(scf.RHF(mol)).run().nuc_grad_method()
converged SCF energy = -149.947191000075

Or are you looking for something else?

@jeanwsr
Copy link
Contributor

jeanwsr commented Mar 30, 2023

This wrappers are already provided in both dftd4.pyscf and dftd3.pyscf by using the energy and grad functions:

>>> from pyscf import gto, scf
>>> import dftd3.pyscf as d3
>>> mol = gto.M(
...     atom="""
...          O  -1.65542061  -0.12330038   0.00000000
...          O   1.24621244   0.10268870   0.00000000
...          H  -0.70409026   0.03193167   0.00000000
...          H  -2.03867273   0.75372294   0.00000000
...          H   1.57598558  -0.38252146  -0.75856129
...          H   1.57598558  -0.38252146   0.75856129
...          """
... )
>>> grad = d3.energy(scf.RHF(mol)).run().nuc_grad_method()
converged SCF energy = -149.947191000075

Or are you looking for something else?

You are right. I didn't notice that dftd3.pyscf has already provided this wrapper.

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

Successfully merging a pull request may close this issue.

4 participants