Hello, I'm writing a program in Python with a code I have in Fortran. I'm having a problem writing this fortran:
do i=1,n
write(3,350)r(i),(ener(j)*alfa,j=1,6) !meV
end do
I tried to write this way in Python:
file=open("energia_nll2_R50A.dat","w")
for i in range(1,n+1):
for j in range(1,6):
file.write("r[i],(ener[j]*alfa)")
file.close()
I wanted to know if there is one more equivalent way of writing this excerpt in Python.
Complete code:
alfa = 3014.4
r = []
for i in range(1,n1+1):
x = r1 + (i - 1)*hr1
r.append(x)
ener = []
for i in range(1,n):
for j in range(i+1,n+1):
if ener[i]>ener[j]:
az = ener[j]
ener[j] = ener[i]
ener[i] = az
for k in range(1,n+1):
zz3 = vetor[k,j]
vetor[k,j] = vetor[k,i]
vetor[k,i] = zz3
file=open("energia_nll2_R50A.dat","w")
for i in range(1,n+1):
for j in range(1,6):
file.write("r[i],(ener[j]*alfa)")
file.close()