  Non-equilibrium chemistry is a key process in the study of the InterStellar
Medium (ISM), in particular the formation of molecular clouds and thus stars.
However, computationally it is among the most difficult tasks to include in
astrophysical simulations, because of the typically high (>40) number of
reactions, the short evolutionary timescales (about $10^4$ times less than the
ISM dynamical time) and the characteristic non-linearity and stiffness of the
associated Ordinary Differential Equations system (ODEs). In this proof of
concept work, we show that Physics Informed Neural Networks (PINN) are a viable
alternative to traditional ODE time integrators for stiff thermo-chemical
systems, i.e. up to molecular hydrogen formation (9 species and 46 reactions).
Testing different chemical networks in a wide range of densities ($-2< \log
n/{\rm cm}^{-3}< 3$) and temperatures ($1 < \log T/{\rm K}< 5$), we find that a
basic architecture can give a comfortable convergence only for simplified
chemical systems: to properly capture the sudden chemical and thermal
variations a Deep Galerkin Method is needed. Once trained ($\sim 10^3$ GPUhr),
the PINN well reproduces the strong non-linear nature of the solutions (errors
$\lesssim 10\%$) and can give speed-ups up to a factor of $\sim 200$ with
respect to traditional ODE solvers. Further, the latter have completion times
that vary by about $\sim 30\%$ for different initial $n$ and $T$, while the
PINN method gives negligible variations. Both the speed-up and the potential
improvement in load balancing imply that PINN-powered simulations are a very
palatable way to solve complex chemical calculation in astrophysical and
cosmological problems.
