Esempio n. 1
0
 def metric(self, variables):
     """ Convert the stress-tensor to a single metric that should be minimized """
     out = io_siesta.outSileSiesta(self.out)
     if _siesta_out_accept(out):
         metric = self.stress_op(out.read_stress())
         _log.debug(f"metric.stress [{self.out}] success {metric}")
     else:
         metric = self.failure
         _log.warning(f"metric.stress [{self.out}] fail {metric}")
     return metric
Esempio n. 2
0
 def metric(self, variables):
     """ Read the energy from the out file in `path` """
     out = io_siesta.outSileSiesta(self.out)
     if _siesta_out_accept(out):
         metric = self.failure(self.energy(out.read_energy()), False)
         _log.debug(f"metric.energy [{self.out}] success {metric}")
     else:
         metric = self.failure(0., True)
         _log.warning(f"metric.energy [{self.out}] fail {metric}")
     return metric
Esempio n. 3
0
def _siesta_out_accept(out):
    if not isinstance(out, io_siesta.outSileSiesta):
        out = io_siesta.outSileSiesta(self.out)
    accept = out.completed()
    if accept:
        with out:
            # We do accept
            # KBproj: WARNING: Cut off radius for the KB projector too big
            # We do not accept:
            # KBproj: WARNING: KB projector does not decay to zero
            accept = not out.step_to("KB projector does not decay to zero")[0]
    return accept