## mcPolymer (Monte Carlo Simulator)

`mcPolymer/` is an independent open-source C++ kinetic Monte Carlo (kMC) simulator from TU Clausthal.  
https://gitlab.tu-clausthal.de/mcPolymer/mcpolymer

**What it adds over the ODE models:**
- Full chain length distribution (CLD), not just averages Mn/Mw
- Microstructure: sequence distribution, branching (backbiting for acrylates)
- Reversible-deactivation radical polymerization: ATRP, NMP, RAFT
- Stochastic simulation — naturally handles statistical fluctuations

**Role in this project:** Use mcPolymer as a **reference/validation tool**. Run the same monomer system in mcPolymer and compare Mn, Mw, PDI, and composition vs. conversion to the Tancev deterministic model. Discrepancies reveal where the ODE moment-method approximations break down.

**Included examples relevant to this project:**
- `examples/styrene/` — styrene bulk homopolymerization
- `examples/mma-s-sg1/` — Nitroxide-Controlled MMA/styrene copolymerization
- `examples/raft/` —  reversible addition fragmentation chain transfer (RAFT) polymerization: cumyl dithiobenzoate mediated methyl acrylate polymerization
- `examples/vac/` — vinyl acetate (VAc) polymerization
- `examples/atrp/` — styrene bulk polymerization, Atom Transfer Radical Polymerization (ATRP)
- `examples/ba/` —  butyl acrylate (BA) polymerization
- `examples/ba-ht/` — // butyl acrylate (BA) polymerization at high temperature
- `examples/nmp/` — styrene bulk polymerization, NMP

---
# Summary
Kinetic Monte Carlo (kMC) simulations provide access to detailed information on the microstructure of polymers, 
such as molar mass distributions (MMDs), branching levels and types of branches, copolymer composition, 
and conversion-time data, as long as the kinetic model contains all relevant elemental reactions.
The open source simulator mcPolymer is based on the Monte Carlo simulation technique and published under the GNU General Public License (GPL), 
which is unique in the field of polymerization modeling. mcPolymer runs on different platforms: from workstation computers with Microsoft Windows up to compute servers running UNIX (Linux).
Simulations with mcPolymer are based on the concept of fundamental reaction templates. Thus, mcPolymer is very versatile and applicable to very different 
types of polymerizations. mcPolymer is mainly applied to model radical polymerizations, e.g., simulations of reversible deactivation radical polymerizations, 
or simulation of acrylate polymerizations with backbiting and transfer to polymer reactions. A kMC model for acrylate radical polymerization may 
consist of more than 40 elemental reactions, which proceed in parallel, and the same number of kinetic coefficients. Since the concentrations of reactants may cover eight to 
nine decadic orders of magnitude, 10E10 to 10E11 molecules have to be accounted for. The sophisticated modular structure of mcPolymer allows for the integration of the simulator 
in complex simulation environments.

# Build environment
This section gives an introduction on how to build mcPolymer on a Linux system using run make command. However you can also use e.g. a Microsoft Visual Studio setup to build the software; there are no platform specific dependencies. You may also consider running a Windows subsystem for Linux setup (WSL2 e.g. 24.04.2 LTS) on a Windows Desktop.

For building lib/libmcPolymer.a, lib/libmcPolymer.so (mcpolymer library) with "make" on Linux, you will need:
* GCC version 7 and newer (we use some fancy C++17 features)


On an Ubuntu system these packages are installed with this line:
```
> sudo apt-get install build-essential
```

# Build mcPolymer
The makefile provides several build targets. The default build provides the executable.
Further options are:
* make debug - builds mcPolymer with debug symbols; for debugging tools such as gdb
* make clean - removes all build artifacts