msd code that should work for both monomer and powder, print statements need to be deleted