Dangling bond energetics in carbon nitride and phosphorus carbide thin films with fullerene-like and amorphous structure