I'm pretty new to coding so this may be a silly problem but when I try to run my programme I get the error mentioned in the title. The bit of code which seems to be the problem is this:
def branch(replicas):
ER = d * 0.5 * w
N0 = len(replicas)
newReplicas = [] ##### Error on this line
for j in range( len(replicas) ):
replica = replicas[j]
r2 = 0
for x in replica:
r2 += x * x
V = 0.5 * mass * w**2 * r2
W = exp(-(V - ER) / rootT)
mn = int(W + random.uniform(0,1))
if mn >= 3:
newReplicas.append( replica )
newReplicas.append( replica )
newReplicas.append( replica )
elif mn == 2:
newReplicas.append( replica )
newReplicas.append( replica )
elif mn == 1:
newReplicas.append( replica )
replicas = newReplicas
N1 = len(replicas)
ER = ER + ((hbar/deltaT)(1-(N1/N0)))
Any help would be appreciated. Thanks in advance!