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