Rewrite adjacency lists with new format in statmech groups

Unfortunately saveDatabse() reordered the entries.