def METHOD_NAME(self, gs, name):
    if name not in self.grad:
        self.grad[name] = []
    self.time("norm")
    gn = 0.0
    v = 0
    for g in gpt.core.util.to_list(gs):
        gn += gpt.norm2(g)
        v += g.grid.gsites
    self.time()
    self.grad[name].append(gn / v)