You will write four functions that do the sums of X-ray diffraction for cubic crystals.
The idea. Bragg's law is . In a cubic cell, . A bcc lattice reflects only when is even. An fcc lattice reflects only when , and are all odd or all even.
Your tasks.
d_spacing(a, h, k, l).two_theta(d, wavelength, n) so that it returns in degrees, or None when there is no reflection.allowed(lattice, h, k, l) for "sc", "bcc" and "fcc".first_lines(lattice, a, wavelength) so that it returns the of the first four allowed reflections in order. The candidate planes are given.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…