A generalized theory of compositional changes and structural relaxation in amorphous materials