Derivation of a scoring function for crystal structure prediction.