Name: Anonymous 2013-09-11 14:50
I'm studying chemistry and wrote the following code to calculate electron configuration by element symbol:
is it correct? what orbitals should go after f?
(defun electron-configuration (n)
(let* ((os '(s p d f g h i))
(r nil)
(y 0)
(i 0))
(print n)
(while (< i n)
(dotimes (k (+ y 1))
(let ((x (- y k)))
(when (and (>= (- y (* 2 x)) 0) (> (- n i) 0))
(let* ((orbital-capacity (* 2 (+ 1 (* x 2))))
(inc (min (- n i) orbital-capacity)))
(push (list (- (+ y 1) x) (nth x os) inc) r)
(incf i inc)))))
(incf y))
(nreverse r)))is it correct? what orbitals should go after f?