The structure and stability of molecular cloud cores in external radiation fields