First-principles method for high-Q photonic crystal cavity mode calculations.