dftd3 / simple-dftd3

reimplementation of the DFT-D3 program
https://dftd3.readthedocs.io
GNU Lesser General Public License v3.0
51 stars 26 forks source link

Conda package for Python API? #3

Closed kjelljorner closed 3 years ago

kjelljorner commented 3 years ago

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.

awvwgk commented 3 years ago

Haven't planned on it yet, but probably a good idea to bring this project up to speed with the capabilities in DFTD4 and distribute it on conda-forge as well.

Note that the D3 in DFTD4 is a bit special, because it is not the actual DFTD3 but a D3-like model build on DFTD4. The practical consequence is that this D3-like model will usually be better than the original DFTD3. If you are interested in more details, feel free to PM me.

kjelljorner commented 3 years ago

Yes, I noticed that it gave somewhat different results compared to the regular D3 executable. But from what I could see the interface to the D3-like functionality is removed in the latest version of dftd4? Small differences are probably not important for my application as I am using it to calculate the dispersion coefficients used in Pollice's and Chen's dispersion descriptor.

awvwgk commented 3 years ago

Yes, I removed it from DFTD4 because I feared it might cause confusion if it is used as D3 and labeled incorrectly in a publication. The D3-like model was basically constructed by setting ga=0.0, gc=0.0 and wf=4.0 when constructing the dispersion model, which is more or less equivalent to disabling the charge scaling.

awvwgk commented 3 years ago

Do you mind trying how smoothly

pip install "https://github.com/awvwgk/simple-dftd3/archive/refs/heads/python#egg=dftd3-python&subdirectory=python"

works for you? You will need an existing installation of simple-dftd3 from some source (conda-forge, self-compiled, system-wide installation). The pip syntax for installing from non-PyPI sources is a bit unwieldy but some preliminary tests on my side went quite smoothly with the above.

kjelljorner commented 3 years ago

Unfortunately does not work on my end.

ERROR: HTTP error 404 while getting https://github.com/awvwgk/simple-dftd3/archive/refs/heads/python#egg=dftd3-python&subdirectory=python
ERROR: Could not install requirement dftd3-python from https://github.com/awvwgk/simple-dftd3/archive/refs/heads/python#egg=dftd3-python&subdirectory=python because of HTTP error 404 Client Error: Not Found for url: https://github.com/awvwgk/simple-dftd3/archive/refs/heads/python for URL https://github.com/awvwgk/simple-dftd3/archive/refs/heads/python#egg=dftd3-python&subdirectory=python

Not sure exactly how you have set this up, but I would imagine it should be possible to install with

pip install git+https://github.com/awvwgk/simple-dftd3@python#egg=dftd3-python&subdirectory=python

but that does not work for me either.

awvwgk commented 3 years ago

Sorry, I forget to add the .zip in the URL. Using pip with git URL's doesn't work because the ffibuilder step is skipped (maybe a bug?), there the automatic git archive function to download zip files from GitHub seems the only option for now, but also yields longer link names with the risk to mistype. That's the one that should be working:

pip install "https://github.com/awvwgk/simple-dftd3/archive/refs/heads/python.zip#egg=dftd3-python&subdirectory=python"

Maybe it is easier to upload an sdist to PyPI instead.

kjelljorner commented 3 years ago

Tried that and it works perfectly. I was able to reproduce the first code block in the Readme without any errors. For development purposes I think this works, but for end users I think a version on PyPi or Conda would be preferred, not least to handle updates in a good way. It's also easier for non-expert users.

awvwgk commented 3 years ago

I agree, pre-built versions are usually less error-prone.

awvwgk commented 3 years ago

Just merged: https://github.com/conda-forge/staged-recipes/pull/15362

Feedstock: https://github.com/conda-forge/dftd3-python-feedstock

kjelljorner commented 3 years ago

Just gave it a try and it works perfectly. Thanks!