II.2  Program to Simulate Step Polymerization.
(Value 1.5 quiz grades due Thursday October 27)

Write a program to simulate random step-wise polymerization that produces a plot of molecular weight versus time (reaction time or program cycle).  You should input system size, N, probability of reaction per cycle per site, number of cycles (t).  The system is represented by a 3d matrix of bi-functional molecules that are randomly arranged in space.  The program should 1) build the 3d matrix; 2) for each cycle find paired chain ends and apply the probability of reaction by comparing a random number to a cutoff number, react some of the end groups; 3) Measure the average molecular weight (n1 and nw) and the molecular weight distribution from the system and store these values as a function of cycle; 4) make a plot of number and weight average molecular weight versus cycle and PDI versus cycle showing, hopefully, an approach to PDI = 2.

Another way to program this which might be simpler is to start with the fully polymerized system (by creating a random chain that fills the system) and randomly cleaving this system in a sequence of steps similar to the steps above.  Monomers will not cleave so by considering this degradation system in reverse time you are considering the step growth polymerization. 

You can program by either method or by both for extra credit (2 quiz grades).