Atomic sites with multiple substituents are common in minerals, and correct
site assignment of substituents in structure refinement is of fundamental
importance. Substituents must be assigned to particular sites to fit the ob
served site scattering and chemical analysis, but the assignments are rarel
y made with mathematical rigor. We propose a quadratic programming approach
to calculating optimal site assignments, thereby providing crystallographe
rs with a mathematically robust starting point for the determination of sit
e occupancies. Our program, OCCQP, implements this approach within the wide
ly used MATLAB programming environment. User-defined weights may be assigne
d to the structural formula, site scattering, and bond-valence sums. The pr
ogram is useful for evaluation of site occupancies in newly refined structu
res and re-evaluation of previously published structures with ad hoc site a
ssignments.