Exercises#

Let’s first look at the halogens list.

halogens = ['fluorine', 'chlorine', 'bromine', 'iodine', 'astatine']
print(halogens[::-1])
['astatine', 'iodine', 'bromine', 'chlorine', 'fluorine']

Using a negative number reverses the list.

Now for the distance calculations.

Molecule 1#

First we will define the atom positions.

atom_1 = [0.1, 0.5, 3.2]
atom_2 = [0.4, 0.5, 2.3]
atom_3 = [-0.3, 0.3, 1.7]
from math import sqrt
r_12 = sqrt((atom_1[0] - atom_2[0]) ** 2 + (atom_1[1] - atom_2[1]) ** 2 + (atom_1[2] - atom_2[2]) ** 2)
r_13 = sqrt((atom_1[0] - atom_3[0]) ** 2 + (atom_1[1] - atom_3[1]) ** 2 + (atom_1[2] - atom_3[2]) ** 2)
r_23 = sqrt((atom_2[0] - atom_3[0]) ** 2 + (atom_2[1] - atom_3[1]) ** 2 + (atom_2[2] - atom_3[2]) ** 2)
print(r_12, r_13, r_23)
0.9486832980505141 1.5652475842498532 0.9433981132056602

The distance between atoms 1 and 3 is less than half the distance between atoms 1 and 2 plus the distance between atoms 2 and 3. This indicates that the atoms are in a bent shape.

Molecule 2#

Again, define the atom positions.

atom_1 = [-0.1, 0.5, 1.5]
atom_2 = [0.2, 0.5, 2.6]
atom_3 = [0.5, 0.5, 3.7]

We can reuse the code above.

r_12 = sqrt((atom_1[0] - atom_2[0]) ** 2 + (atom_1[1] - atom_2[1]) ** 2 + (atom_1[2] - atom_2[2]) ** 2)
r_13 = sqrt((atom_1[0] - atom_3[0]) ** 2 + (atom_1[1] - atom_3[1]) ** 2 + (atom_1[2] - atom_3[2]) ** 2)
r_23 = sqrt((atom_2[0] - atom_3[0]) ** 2 + (atom_2[1] - atom_3[1]) ** 2 + (atom_2[2] - atom_3[2]) ** 2)
print(r_12, r_13, r_23)
1.140175425099138 2.280350850198276 1.140175425099138

Note that middle distance is the same as the sum of the other two. So the molecule is linearly shaped.