Copy of https://github.com/kazewong/flowMC/issues/119
Copy of kazewong#119