coords[i]
is a list containing 3 elements x,y,z
and I want to get the derivative of G[i]
w.r.t. each of x,y,z
partially i.e. d(G[i])/d(xi)
in some sort of a functional form like f(x)
so that I can pass a scalar x
to f()
.
This is one of the functions I am using as one of my inputs to a Neural Network and I want to find the partial derivative of my NN
w.r.t to x
. Hence, I am trying to find d(NN)/ d(G1[i]). d(G1[i])/ (x_{i})
import pytorch
def sym1(coords):
global avg
global eeta
global Rs
global e
R_avg=Rc
G1=[]
for i,m in enumerate(coords):
G1.append(0)
Ri=np.array(coords[i])
for j in range(i,len(coords)):
if(i!=j):
Rj=np.array(coords[j])
Rij=Ri-Rj
Rij_norm=np.linalg.norm(Rij)
sum1=e**(-eeta*((Rij_norm-Rs)**2))
sum2=cutoff(Rij_norm)
summation=sum1*sum2
G1[i]=G1[i]+summation
return G1