How to update material settings using the material database from Python?

I am looking for the equivalent of "Update All Materials" in the GUI

The function you are looking for is LinkMaterialWithDatabase().

This is how you can add new material settings with properties taken from the database

import s4l_v1.document as document
import s4l_v1.model as model

sim = document.AllSimulations[0]

for ent in model.AllEntities():
	mats = sim.AddMaterialSettings([ent])
	mats.Name = ent.Name
	sim.LinkMaterialWithDatabase(mats, str(ent.MaterialName))

To modify the settings of an existing simulation and update their properties, you can do something like this:

import s4l_v1.simulation as simulation

material_settings = [s for s in sim.AllSettings if isinstance(s, simulation.fdtd.MaterialSettings)]
for mats in material_settings:
	material_name = mats.Name
	sim.LinkMaterialWithDatabase(mats, material_name)