A procedure for obtaining energy parameters from crystal packing