Solar thermal fuels (STFs) are an unconventional paradigm for solar energy conversion and storage which is attracting renewed attention. A material absorbs sunlight and stores the energy chemically via an induced structural change, which can later be reversed to release the energy as heat. Two important factors for STFs are the absorption cross-section and the quantum yield for photoisomerization. We employ massively parallel time-dependent density-functional theory (TDDFT) calculations with the Octopus real-space code [www.tddft.org/programs/octopus] to obtain the optical absorption and follow the structural changes after absorption for candidate STF molecules such as azobenzene and norbornadiene/quadricylcane. We use our new excited-state forces formulation for TDDFT in the Casida or Tamm-Dancoff approaches, which is based on density-functional perturbation theory and does not require any additional sums over unoccupied states. Our results show the photoisomerization mechanism in these molecules, to aid in further improvement of STF materials by functionalization and attachment to templates [A. M. Kolpaket al., Nano Lett. 11, 3156 (2011); T. Kucharski et al., Nat. Chem. 6, 441 (2014)].