# Question about dE/dr and d2Edr2 processes

I have questions about dEdr and d2Edr2.

1. According to my understanding about dEdr, each call to dEdr returns only a fragmented contribution to the partial derivative so that, for example, the completed value for d E / d r_12 can be obtained by adding the contributions from all the dEdr process calls with (1,2) or (2,1). I’m wondering if it is right.

2. For the second derivative I think there’s some ambiguity regarding whether we consider, e.g., d^2 E / d r_12 d_34 and d^2 E / d r_34 d_12 as the same thing or two things with the same value. So, for example, when we compute d^2 E / d r_12 d r_34, the two following interpretations are possible:

(1) Add all contributions from (1,2)/(3,4), (2,1)/(3,4), (1,2)/(4,3), (2,1)/(4,3) or

(2) Add all contributions from (1,2)/(3,4), (2,1)/(3,4), (1,2)/(4,3), (2,1)/(4,3) + (3,4)/(1,2), (4,3)/(1,2), (3,4)/(2,1), (4,3)/(2,1).

I did some tests with an open-KIM EAM potential and found that (1) is the way to obtain the right result, but the standard doesn’t seem to state this point clearly. So, I just want to check if my understanding is correct.

Hi Woo Kyun,

Thanks for your question. You are right that the documentation currently does not describe all of this well. Adding beter documentation for this issue is on my to-do list for the next release of the api.

I have questions about dEdr and d2Edr2.

1. According to my understanding about dEdr, each call to dEdr returns only
a fragmented contribution to the partial derivative so that, for example,
the completed value for d E / d r_12 can be obtained by adding the
contributions from all the dEdr process calls with (1,2) or (2,1). I'm
wondering if it is right.

Yes that is correct.

2. For the second derivative I think there's some ambiguity regarding
whether we consider, e.g., d^2 E / d r_12 d_34 and d^2 E / d r_34 d_12 as
the same thing or two things with the same value. So, for example, when we
compute d^2 E / d r_12 d r_34, the two following interpretations are
possible:

(1) Add all contributions from (1,2)/(3,4), (2,1)/(3,4), (1,2)/(4,3),
(2,1)/(4,3) or

(2) Add all contributions from (1,2)/(3,4), (2,1)/(3,4), (1,2)/(4,3),
(2,1)/(4,3) + (3,4)/(1,2), (4,3)/(1,2), (3,4)/(2,1), (4,3)/(2,1).

I did some tests with an open-KIM EAM potential and found that (1) is the
way to obtain the right result, but the standard doesn't seem to state this
point clearly. So, I just want to check if my understanding is correct.

Right! The model is expected to return the "full symmetric hessian matrix" which means there will be upper and lower triangular parts that are equal for models that can be derived from an energy. (If, however, the model is not conservative, then this matrix will not be symmetric; In such a case the name 'hessian' is actually not really correct.)

Cheers,

Ryan

Hi Woo Kyun,

My understanding is that it actually doesn’t matter; the standard needn’t specify whether all permutations be given. Rather, the model simply needs to make sure everything is included.

The model can choose to process dE/dr_12 but not dE/dr_21. Or, it can do both, giving half the contribution to r_12 and half to r_21. If the test is mathematically correct, both will work.

It’s similar for process_d2Edr2: you can split the contributions among the permutations, or pick just one combination.

Hopefully, Ryan can say more.

Steve

Hi Steve,

what you say is right, but I think Woo Kyun was asking a different question....

Ryan

To Ryan: Thanks a lot for your answer!

To Steve: I’ll rephrase my question. To calculate d^2 E / d r_12 d r_34 we have to collect the contributions from d2Edr2 for the following 8 permutations:

1: (1,2)/(3,4)
2: (2,1)/(3,4)
3: (1,2)/(4,3)
4: (2,1)/(4,3)
5: (3,4)/(1,2)
6: (4,3)/(1,2)
7: (3,4)/(2,1)
8: (4,3)/(2,1).

Let’s say - we add the contributions from 1,2,3,4 and save the value to A and save the sum of the contributions from 5,6,7,8 to B. My question was whether d^2 E / d r_12 d r_34 = A or A+B and now I know that the answer is d^2 E / d r_12 d r_34 = A, which is again equal to B (for the model where the symmetry is guaranteed).