Coder Social home page Coder Social logo

dftd3 / simple-dftd3 Goto Github PK

View Code? Open in Web Editor NEW
45.0 45.0 19.0 1.59 MB

reimplementation of the DFT-D3 program

Home Page: https://dftd3.readthedocs.io

License: GNU Lesser General Public License v3.0

Meson 0.54% Fortran 95.15% C 0.41% Python 3.24% CMake 0.61% Shell 0.05%
ase computational-chemistry dispersion-correction pyscf qcschema quantum-chemistry

simple-dftd3's People

Contributors

awvwgk avatar e-kwsm avatar hebrewsnabla avatar kjelljorner avatar lgtm-migrator avatar lukaswittmann avatar marvinfriede avatar rscohn2 avatar sunqm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simple-dftd3's Issues

Building with cmake with no internet connection

This is probably a cmake question, but I have no idea how to do it.

I'm trying to compile simple-dftd3 with cmake and ninja in a computer that doesn't allow connections to the outside world. Therefore, I've had to copy the sources of mctc-lib and compile them myself. I have already compiled mctc-lib, and trying to compile simple-dftd3 tells me that it can not find mctc-lib because of missing mctc-lib_DIR:

Screenshot from 2022-02-04 19-25-43

How can I specify mctc-lib_DIR?

Thanks!

Dispersion energy not the same between s-dftd3 binary and dftd3.interface API

Hi 😄

I'm experiencing result disaccordance between binary s-dftd3 and result from python API dftd3.interface, at least for D3-BJ with PBE0.

Results run on my computer are:

Run Type Eng. Disp. (a.u.)
original dftd3 -0.02958913
simple s-dftd3 -2.9589129838629E-02
python (prebuild param) -0.02948923293249489
python (user param) -0.029589132634178346

Difference between python (prebuild param) and other results is somehow large. Difference between s-dftd3 and python (user param) may be a result of different Angstrom->Bohr conversion constant, which is not important.

I'm not acustomed to ffi workflow, thus I havn't hacked why this happens 🥲


Steps to reproduce python (prebuild param) and python (user param)

To reproduce python (prebuild param), I shamelessly borrow the code from test code of simple-dftd3 😂
https://github.com/awvwgk/simple-dftd3/blob/4c6c7825ba25288d62047a1ecf8edaccecd7061a/python/dftd3/test_interface.py#L179-L204

To reproduce result of python (user param), substiuting RationalDampingParam(method="pbe0") by RationalDampingParam(s6=1, s8=1.2177, s9=0, a1=0.4145, a2=4.8593, alp=14) should work.

Steps to reproduce original dftd3 and simple s-dftd3

Coordinate file is defined as tm.xyz:

16
tm.xyz
H   1.47785865  2.02673935 -1.47792345
H  -0.75909124  0.22976202  2.93087098
C  -1.72653772 -1.3263511  -0.82885635
B   1.13534314 -0.46989888 -1.18849251
H  -2.27669551 -2.08300829 -0.2589304
P   0.03232026 -2.02393313 -1.17653739
O   0.21785459  0.30748145  2.94674769
Cl  2.33559684  2.07710454  1.36507466
Al  0.70755099  0.7418772   1.04528377
P   1.63167935  0.91293665 -2.34248821
B  -1.59995106  0.02348594 -0.14624446
H   0.59007699 -0.5165691   3.30980685
F   0.32776684  1.15309591 -3.28767134
P  -1.41550502  1.58846245  0.55584146
H  -2.18646012 -1.23947453 -1.82225432
P   1.50819301 -1.40171049  0.375773

Then run

$ s-dftd3 run --bj pbe0 tm.xyz
$ dftd3 tm.xyz -bj -func pbe0

I'm new to dftd3/4, so hope these scripts are the correct D3-BJ with PBE0 🥲

parallel evaluation

Hi!

Is there a way (maybe by setting an environment variable) to parallelise the evaluation of the dispersion when using the python-API (via the ASE calculator) ?

Error due to location of _libdftd3.cpython-xxx.so

I'm compiling this project with python interface enabled by

meson setup _build -Dpython=true 
meson configure _build --prefix=/home/wsr/s-dftd3
meson install -C _build

The compilation is ok, but I got an error when import dftd3.pyscf

Traceback (most recent call last):
  File "/home/wsr/s-dftd3/lib/python3.10/site-packages/dftd3/library.py", line 25, in <module>
    from ._libdftd3 import ffi, lib
ModuleNotFoundError: No module named 'dftd3._libdftd3'

I check the location of _libdftd3 and find it's in lib64, so the library.py in lib cannot import it

wsr@yoga:~/simple-dftd3> ls ~/s-dftd3/lib64/python3.10/site-packages/dftd3/
_libdftd3.cpython-310-x86_64-linux-gnu.so
wsr@yoga:~/simple-dftd3> ls ~/s-dftd3/lib/python3.10/site-packages/dftd3/
ase.py       interface.py  parameters.py  pyscf.py     test_ase.py        test_library.py     test_pyscf.py
__init__.py  library.py    __pycache__    qcschema.py  test_interface.py  test_parameters.py  test_qcschema.py

Can this be fixed by some meson setting? I've tried change meson configure _build --prefix=/home/wsr/s-dftd3 to meson configure _build --prefix=/home/wsr/s-dftd3 --libdir=lib, but it doesn't work.
Or, can we change the way importing _libdftd3 so that its location does not matter?

Default realspace cutoffs

Would it be possible to set the default (2-body) cutoff to 94.8683 a.u. as in the reference implementation as opposed to 60 a.u. right now?

default for s9 in dftd3

The parameters file for dftd3 has three-body scaling all defaulting to s9=0.0 or off, https://github.com/dftd3/simple-dftd3/blob/main/assets/parameters.toml#L5-L9 , and that's what gets returned from a get_all_damping_params call. But the docs and interface file show the three-body as s9=1.0 or on, https://github.com/dftd3/simple-dftd3/blob/main/python/dftd3/qcschema.py#L50 , and on is what gets computed in a qcschema run without param_tweaks being specified.

Is this an inconsistency, or am I missing something? In switching over psi4, I was prepared for three-body on, then pleasantly surprised (for consistency's sake with "classic" executable dftd3) to find it off, and now uncertain. I can make it work psi4-side either way, but I thought I'd check in for guidance. Thanks!

Build Python wheels for MacOS / Windows?

Currently Python wheels are only built for Linux using mesonpep517, since the conda-forge distribution already covers MacOS and Windows this seems like only minor issue. However, if there is sufficient interest and/or somebody is willing to contribute the respective additions to the wheel building workflow the distribution can be expanded.

Preferably we can also build Python wheels for MacOS and Windows against the conda-forge API like done in the Linux case.

Release version 1.0.0

This projects seems stable enough to leave the 0.x version series. This issue tracks whether there is anything that should be done prior to making the first release in the 1.x version series.

Reliability of combining simple DFT-D3 and VASP with ASE interface?

Recently, I'm using simple DFT-D3 and VASP with ASE interface because some DFT-D3 parameters are not set as default in VASP. Here is part of my script:

from dftd3.ase import DFTD3
from ase.calculators.vasp import Vasp
from ase.calculators.mixing import SumCalculator
from ase.io import read, write
from ase.optimize import LBFGS, BFGS, GPMin

atoms = read('CONTCAR')
d3 = DFTD3(method='PBE', damping='d3bj')   
vasp_pbe.set(label='PBE', directory='PBE', xc='PBE') # check whether the energy is consistent with the default one in VASP
vasp_pbe_d3 = SumCalculator([d3, vasp_pbe])
del atoms.constraints
atoms.set_calculator(vasp_pbe_d3)
dyn=LBFGS(atoms)    #优化器
dyn.run(fmax=0.03)

To verify the scheme, I used CO adsorption energy as a criterion and compared the difference between simple DFT-D3 and default one in VASP. I found that the absolute energy for a specific structure is different, while the targeted adsorption energy is quite close.
Snipaste_2023-07-04_06-06-31

However, I'm still worried about the reliability of such a scheme and do you have any suggestions?

PySCF: Register dispersion energy in mf.scf_summary["dispersion"]

The dispersion energy is currently only added to the nuclear repulsion, however PySCF provides with the scf_summary dictionary in the mf object a way to record the individual contributions. It would be useful for if the PySCF wrapper could record the dispersion energy in scf_summary["dispersion"].

Which dftd3 should one use?

Thanks for the work on this!

We are bit in a dead-lock now, since there exists 3 different libraries which all say do the same thing? :)
So which one should we support :)

I see you are involved in both dftb and Grimme's group.
What I would like to see is that there is one preferred version to be used? If that means archiving one of the packages, then good! :)

Conda package for Python API?

Are there are plans for a Python API as for the new DFTD4? I have an interface to the old DFTD4 in ᴍᴏʀғᴇᴜs using both the D3 and the D4 calculators. I am now considering (a) dropping D3 support and only giving D4 (b) still providing interface for users who would do a manual install of the simple-dftd3 Python interface.

pairwise analysis inconsistent in d3 forks

This is purely informative and for searchability; feel free to close right away.

I noticed in debugging sapt0-d3m in Psi4 that the pairwise analysis from classic dftd3 -anal and simple-dftd3 (at least the qcengine interface) differ by a factor of two. Below are the rms of the returned arrays (labels are <program>_<conda channel>), but I've checked the arrays per-element, too. s-dftd3 is closer to dftd4, so I'm assuming that it's classic dftd3 that's the inconsistent definition. Rather than perpetrating another variation in d3 versions out there, I'll compensate in Psi4.

rms(dftd3_psi4)    = 0.0008701284366337631
rms(dftd3_psi4 / 2)= 0.00043506421831688153
rms(sdftd3_cf)     = 0.00043506480394359256
rms(dftd4_psi4)    = 0.00015463675259706915
rms(dftd4_cf)      = 0.0001546367518179213

installation by pip is broken

Hi,
I installed the s-DFTD3 successfully by pip using:

pip install dftd3

however, I tested the code by following the lines:
python -c "from dftd3.ase import DFTD3"
I got the error like this:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'dftd3.ase'; 'dftd3' is not a package

I am sure I have ASE installed because I can import ASE successfully.

Is there any idea why I got the importing error?

Thank you very much

Best,
Geng

Looking for (co-)maintainers

This DFT-D3 reimplementation has become somewhat stable now. Going forward I'm looking for contributors and maintainers to ensure the project remains healthy and available for the computational chemistry community.

Current status

  • fpm, meson and CMake build system support
  • compatible with GCC >=5, Intel >=18, NAG >=7
  • C and Python bindings
  • integrated with DFTB+, tblite, DFT-FE, QCEngine (WIP), Siesta (WIP)

Dependencies

Project assets

Packaging status

Implement pairwise analysis for dispersion energy

This was a command line feature in the original dftd3 which allowed to create dispersion energies for all pairs in the system. An implementation is available in dftd4 which could be adapted for this library as well. Special care should be taken periodic systems and for calculating the pairwise representation of the ATM contribution.

Related: dftd4/dftd4#81
Patch: dftd4/dftd4#82

release serial pypi version?

Recently we found pytorch pollutes openmp symbols. DFTD3 returns wrong results after the pollution. While some packages are not affected. I guess that is because the current pypi version (v1.0.0) is using the recent version (gomp_5.0) of libgomp. It is not an issue with the recent openmp, but it would be convenient to have a serial version at the same time.

pytorch/pytorch#109446 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.