Closed Rafael-G-C closed 3 years ago
And what we want to find out is: why is the output a list instead of a float?
Yes, and now that I look at it why it a list zeros
Okey, might be let's see what's happens when I fix it
Also in the test I would not start by cycling through all derivatives but start only with very few elements. It takes time to cycle through all of them and right now we will be very happy if already 1 or 2 work which takes a fraction.
I see so stopping the derivative order loop earlier
Alright the code can now:
get the gradient, hessian, 3rds and 4rds of the sum of the r6, r8 and repulse interactions in kcal
this line derivative_orders = list(derivative_orders)[0:1]
is used to cut off the list of derivative orders so we have control of how many we want
This sounds fantastic!
Really great Rafael, apologies for tardiness, I didn't get email notifications for these changes... I'll try to fix the conflicts with the base branch and get a test going.
OK, so:
master
and fixed the conflicts. @Rafael-G-C, before you do any edits locally: git pull --rebase origin some_gradient
d3
) accepts 3 arguments: the configuration, the list of charges, the list of coordinates. The configuration is a dataclass
.requirements.txt
, since we officially depend on JAX now. I dropped Windows in the GitHub action.A word of warning: the gradient test is pretty slow.
The tests should hopefully run slightly faster now (I've removed one of the parametrization levels for the gradient test)
I have also reorganized a bit the code to make it easier (hopefully!) for @ringholm to run the numdiff tests:
n
order derivative calculation:
python -m dftd3.dftd3 --damp zero --order 1 examples/formic_acid_dimer.com
This outputs the energy to screen and writes a JSON file with the full input and full output (including the gradient). In Python, you can load the gradient with:
import json
import numpy as np
with open("formic_acid_dimer.json", "r") as f:
data = json.load(f)
gradient = np.array(data["formic_acid_dimer"]["output"]["1-st order geometric derivative"])
Merging so that @ringholm can try the numerical differentiation stuff before the next meeting.
@bast here's the code that returns the error
just run the test as
python3 -m pytest tests/
in the pyDFTD3 folder online 93
in test_CO2H2_2.py "2" is the hessiand3_dervs = D3_derivatives(charges,functional,damping,2,coordinates)