The task I am trying to address is probably best explained thus:
- Consider a cube. Each side (a,b,c) has a length of 1 unit.
- Place a dot at the point where all a,b and c intersect (position 0,0,0).
- Find the energy at that point.
- Move the point 0.1 units along side a (position 0.1,0,0).
- Repeat steps 3 and 4 until you reach the end of side a (i.e. points 0...1,0,0 have been considered).
- Return to the start of side a and take a step of 0.1 along side b (position 0,0.1,0)
- Repeat steps 3-6 until you reach the end of sides a and b (i.e. points 0...1,0...1,0 have been considered).
- Return to the start of sides a and b and take a step of 0.1 along side c (position 0,0,0.1).
- Repeat 3-8 until you reach the end of sides a, b and c (i.e. points 0...1,0...1,0...1 have been considered and position 1,1,1 reached)
I am trying to use python to output the list of each position, by defining loops and functions but it stops once I get to x=0, y=0 z=1.0. It appears to me that two of my while loops are not working....
The code I have thus far is below:
def zcoord():
global z
while z<=1.0:
print('%.2f' % x + ' %.2f' % y + ' %.2f' % z)
z+=0.1
def ycoord():
global y
while y<=1.0:
zcoord()
y+=0.1
def xcoord():
global x
while x<=1.0:
ycoord()
x+=0.1
x=0.0
y=0.0
z=0.0
xcoord()
zvariable aftery+=0.1?