Btw, a couple of useful tips for your script :)
The labels "ele1" and "ele2" can be automatically generated, to save you double-editing when you change the elements:
element1 = 'Carbon'
element2 = 'Silicon'
ele1 = element1.symbol()
ele2 = element2.symbol()
Then, you can save yourself some headache in clusterConfigToATK():
if ( clusterConfig[atom][3] == 1 ):
clusterElements.append(eval(element1)) # element1
else:
clusterElements.append(eval(element2)) # element2
Now you only have to change elements in once place!
Since you do from math import *, you don't need to redefine pi (it's already available from math).
iFlag = []
for anyAtom in range(N):
iFlag.append(1)
could simply be
The role of distance() could be made a bit more obvious by using numpy:
def distance(N, clusterConfig):
import numpy
dist = []
for atom1 in range(N):
distAtom = []
for atom2 in range(N):
r = numpy.sqrt(numpy.sum((numpy.array(clusterConfig[atom1])-numpy.array(clusterConfig[atom2]))**2))
distAtom.append(r)
dist.append(distAtom)
return dist
These are minor details that have nothing to do with the problem of running in parallel. I just thought I would take the chance to show some nice NanoLanguage tricks :)
One mistake above (corrected above also). The new code for the function should be
if ( clusterConfig[atom][3] == 1 ):
clusterElements.append(eval(element1)) # element1
else:
clusterElements.append(eval(element2)) # element2
Never copy/paste code!