thank you Anders Blom
i have revised my code following you suggestion.
scattering_region_initial_scaled_spin = [0,]*len(scattering_elements)
for index in range(len(scattering_elements)):
if (scattering_elements[index]=="Carbon") :
if (scattering_coordinates[index][2]> 17):
scattering_region_initial_scaled_spin[index]=1
elif (scattering_coordinates[index][2]< 13):
scattering_region_initial_scaled_spin[index]=1
but a strange things happed. the for ...if ... language does not work. all the scattering_region_initial_scaled_spin are set to 0 in my output
Initial Scaled Spin = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
my scattering_elements and corresponding scattering_coordinates are following, i can make sure there are atoms fit the if condition (the atoms are carbon and their y coordinates are larger than 17 or less than 13), and of course, these atoms initial_scaled_spin should be labled 1. but the output shows not. i do not know why? please give me some hints. thanks a lot!!!!
scattering_elements = [Hydrogen, Carbon, Carbon, Carbon,
Carbon, Hydrogen, Carbon, Carbon,
Carbon, Carbon, Hydrogen, Carbon,
Carbon, Carbon, Carbon, Hydrogen,
Carbon, Carbon, Carbon, Carbon,
Hydrogen, Carbon, Carbon, Carbon,
Carbon, Hydrogen, Carbon, Carbon,
Carbon, Carbon, Hydrogen, Carbon,
Carbon, Carbon, Carbon, Hydrogen,
Carbon, Carbon, Carbon, Carbon,
Hydrogen, Hydrogen, Carbon, Hydrogen,
,,,,,
and scattering_coordinates = [[ 0.00000000e+00+5.0, 0.00000000e+00+20.0, 9.83800000e+00],
[ -1.22989401e-15+5.0, -1.12843802e+00+20.0, 9.85067344e+00],
[ -2.94995475e-15+5.0, -3.92924460e+00+20.0, 9.85627415e+00],
[ -4.66985681e-15+5.0, -5.36743000e+00+20.0, 9.86150159e+00],
[ -5.47776181e-16+5.0, -8.20440839e+00+20.0, 9.84598938e+00],
[ 7.14895909e-16+5.0, -9.36487852e+00+20.0, 9.81171705e+00],
[ -2.17900005e-15+5.0, -1.78728400e+00+20.0, 1.10995077e+01],
[ -2.86524241e-15+5.0, -3.23383319e+00+20.0, 1.11043162e+01],
[ -2.38880286e-15+5.0, -6.08197662e+00+20.0, 1.11053456e+01],
[ 1.62864277e-15+5.0, -7.53795350e+00+20.0, 1.10969972e+01],
[ -1.10737121e-15+5.0, 9.41494265e-02+20.0, 1.23040920e+01],
[ -3.10119238e-15+5.0, -1.06706289e+00+20.0, 1.23230761e+01],
[ -2.21118463e-15+5.0, -3.93739872e+00+20.0, 1.23453547e+01],
[ 9.63002055e-16+5.0, -5.37828650e+00+20.0, 1.23518140e+01],
.......