I think your prototype test.py is pretty much what you need. The only thing to change is to forget all about "Ang" regarding all coordinates, until you reach the point when you make the BulkConfigurations. So, for example
for add in [0.1,0.2,0.3,0.4]:
vector_a = [10.0, 0.0, 0.0]
vector_b = [0.0, 10.0, 0.0]
vector_c = [0.0, 0.0, 24.9]
vector_c[2]+=2*add
print vector_c
central_region_lattice = UnitCell(vector_a*Ang, vector_b*Ang, vector_c*Ang)
for coordinate in central_region_coordinates:
if coordinate[2]>=12.1:
coordinate[2]+=add
if coordinate[2]>(12.8+add):
coordinate[2]+=add
central_region = BulkConfiguration(
bravais_lattice=central_region_lattice,
elements=central_region_elements,
cartesian_coordinates=coordinate*Ang
)
device_configuration = DeviceConfiguration(
central_region,
[left_electrode, right_electrode]
)
Be careful about your indentation, it's a bit hard to see the logic in the script. As it stands, "central_region = BulkConfiguration" is part of the loop "for coordinate in central_region_coordinates", that's perhaps not your intention?
If you are using ATK 10.8, units are stripped off using the method "inUnitsOf":
coords = central_region_coordinates.inUnitsOf(Ang)
although you don't really need that if you just don't introduce "Ang" until the "BulkConfiguration" calls.
Oh, and one more thing: the use of "+=" can be dangerous! Try to avoid it when operating on arrays, even if it means writing a bit more:
coordinate[2] = coordinate[2]+add
I understand it can be frustrating sometimes.
Sometimes it's better to take a step back and consider what it really is you want to achieve. As I understand it, you want to introduce a variable Li-H distance, is that correct? If so, consider the attached script as an alternative.
However, there is only a minor issue with your script, if you want to learn from it. The problem is that "coordinate" is not what you want it to be; I changed your loop to
coordinate = central_region_coordinates.inUnitsOf(Ang)
for j in range(len(coordinate)):
if coordinate[j][2]>=12.1:
coordinate[j][2]=coordinate[j][2]+add
if coordinate[j][2]>(12.8+add):
coordinate[j][2]=coordinate[j][2]+add
I trust you can see the difference! :)