diff --git a/pyxtal/interface/ase_opt.py b/pyxtal/interface/ase_opt.py index c933ae03..faf579d1 100644 --- a/pyxtal/interface/ase_opt.py +++ b/pyxtal/interface/ase_opt.py @@ -48,6 +48,7 @@ def handler(signum, frame): signal.signal(signal.SIGALRM, handler) signal.alarm(timeout) #logger.info(f"{label} start calculation") + _fmax = 1e+5 try: #if True: @@ -92,7 +93,7 @@ def handler(signum, frame): tag = 'False' if struc is None else 'True' logger.info(f"Finishing {label} {tag}") #signal.alarm(0) # Cancel the alarm - return struc + return struc #, eng, _fmax class ASE_optimizer: """ diff --git a/pyxtal/lego/builder.py b/pyxtal/lego/builder.py index e6ce63fe..533587a1 100644 --- a/pyxtal/lego/builder.py +++ b/pyxtal/lego/builder.py @@ -1009,16 +1009,15 @@ def optimize_xtal(self, xtal, count=0, opt_type='local', minimizers=minimizers, filename=filename) xtal, xs = result - status = xtal.check_validity(self.criteria, verbose=self.verbose) - sim1 = self.get_similarity(xtal) - #print("after optim", sim1, status) + if result is not None: + status = xtal.check_validity(self.criteria, verbose=self.verbose) + sim1 = self.get_similarity(xtal) + #print("after optim", sim1, status) + else: + xtal, xs, status, sim1 = None, None, False, None else: - print("Lattice is None", xtal.get_xtal_string()) - xtal = None - xs = None - status = False - sim1 = None - xs = None + print("Lattice is None")#, xtal.get_xtal_string()) + xtal, xs, status, sim1 = None, None, False, None #import sys; sys.exit() if status: