  The Jiangmen Underground Neutrino Observatory (JUNO) is designed to determine
the neutrino mass ordering and precisely measure oscillation parameters. It is
being built in South China at a depth of 700~m underground and comprises a
central detector, water Cerenkov detector and top tracker. The central detector
is designed to detect anti-neutrinos with an energy resolution of 3\% at 1~MeV,
using a 20 kt liquid scintillator target with 17,612 20-inch PMTs and 25,600
3-inch PMTs. The scintillator provides a light yield of approximately 10,000
photons per MeV. Monte Carlo simulation is a crucial tool for developing an
understanding of detector performance, requiring the production of large
samples of background processes with optical photons. Simulation of large
numbers of optical photons with Geant4 is computationally challenging for both
processing time and memory resources. In order to optimize resource usage, a
deferred optical photon simulation workflow is proposed and implemented using
Geant4 classes. The key idea is to simulate events initially without optical
photons, only performing the optical photon simulation when user specified
criteria are met.
  In this contribution, the design and the implementation of the deferred
optical photon simulation will be presented.
