refine packmol code