Hello all,
I'm trying to re-position the atoms of any structure (any periodic or molecule configuration) in nanolanguage. In other words, I'm trying to modify coordinates of atoms according to some rule, for example, "increase the x position by 2 Angstrom while keeping other positions unchanged" or "double the x and z coordinate while y coordinate is unchanged", in fact this corresponds the modifying the origin in Atomic Manipulator.
Since atom coordinates are given as a list of lists, I have to loop over each element of list of lists. I studied the script below to modify the coordinates of (5,5) nanotube such that "double the x and y coordinate while z coordinate is unchanged". But I could not complete the script. Could you help please?
coordinates = [[ 1.23252581e+01, 8.93048313e+00, 0.00000000e+00],
[ 1.16769137e+01, 1.09258818e+01, 1.23148812e+00],
[ 9.97952627e+00, 1.21591059e+01, -2.22044605e-16],
[ 7.88143998e+00, 1.21591059e+01, 1.23148812e+00],
[ 6.18405251e+00, 1.09258818e+01, -4.44089210e-16],
[ 5.53570819e+00, 8.93048313e+00, 1.23148812e+00],
[ 6.18405251e+00, 6.93508448e+00, -8.88178420e-16],
[ 7.88143998e+00, 5.70186030e+00, 1.23148812e+00],
[ 9.97952627e+00, 5.70186030e+00, -8.88178420e-16],
[ 1.16769137e+01, 6.93508448e+00, 1.23148812e+00],
[ 1.20317643e+01, 1.03112625e+01, -5.55111512e-17],
[ 1.06278706e+01, 1.18704445e+01, 1.23148812e+00],
[ 8.57563252e+00, 1.23066611e+01, -2.22044605e-16],
[ 6.65893531e+00, 1.14532926e+01, 1.23148812e+00],
[ 5.60989217e+00, 9.63629652e+00, 0.00000000e+00],
[ 5.82920190e+00, 7.54970376e+00, 1.23148812e+00],
[ 7.23309566e+00, 5.99052179e+00, -8.88178420e-16],
[ 9.28533373e+00, 5.55430512e+00, 1.23148812e+00],
[ 1.12020309e+01, 6.40767370e+00, -8.88178420e-16],
[ 1.22510741e+01, 8.22466973e+00, 1.23148812e+00]]
for index1, item1 in enumerate(coordinates):
for index2, item2 in enumerate(item1):
if index2==0:
item_new[index2]=2*item1[index2]
elif index2==1:
item_new[index2]=2*item1[index2]
elif index2==2:
item_new[index2]=item1[index2]