Gotcha. Unless you are an atmospheric scientist, or have a true grasp on atmospheric science, I would not attempt trying to program complex physical based models such as 6S or MODTRAN. Eric Vermote has dedicated his research career to 6S.
Instead, I would recommend something like a scene-based model like cos(t), Chavez 1996. Easily programmable and implemented, and produces good results. Calibrate to TOA radiance, then to planetary reflectance, then apply cos(t).
http://info.asprs.org/publications/pers/96journal/september/1996_sep_1025-1036.pdf
http://earth.gis.usu.edu/imagestd/ (example code with equations).