1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| def readXYZ(chaine, nbre_confo):
k = 0
for i, line in enumerate(lines):
j = 5
if (chaine in line) and (nbre_confo > k):
k = k + 1
Za = []
X = []
Y = []
Z = []
while j<14 :
Za.append( (float( (lines[i + j].split())[1]) ))
X.append( ( float( (lines[i + j].split())[3]) ))
Y.append( ( float( (lines[i + j].split())[4]) ))
Z.append( ( float( (lines[i + j].split())[5]) ))
j = j + 1
print(X)
def energy(nbre_confo):
readXYZ(chaine, nbre_confo)
E = 0
for i in range(len(Za)):
for j in range(i+1,len(Za)):
distance = (sqrt(pow((X[i] - X[j]),2) + pow((Y[i] - Y[j]),2) + pow((Z[i] - Z[j]),2))) / 0.5291772085936
E = E + ( (Za[i] * Za[j]) / distance )
print(E) |
Partager