github.com/txstc55/yasps
Check out Xuan's work on a new programming language for writing modular and high-performance physical simulation code from energy definition. The key is two differentiable relational operators (join/union) that model the sparsity structure between the attributes and energy.