constructed the dimerization model as a class, instead of a function