1616from ase .constraints import FixSymmetry
1717from ase .filters import FrechetCellFilter
1818from ase .io import Trajectory as AseTrajectory
19+ from ase .io import write
1920from ase .optimize import BFGS , FIRE , LBFGS , BFGSLineSearch , LBFGSLineSearch , MDMin
2021from ase .optimize .sciopt import SciPyFminBFGS , SciPyFminCG
2122from monty .serialization import dumpfn
@@ -328,6 +329,7 @@ def relax(
328329 fmax : float = 0.1 ,
329330 steps : int = 500 ,
330331 traj_file : str = None ,
332+ final_atoms_object_file : str = "final_atoms_object.xyz" ,
331333 interval : int = 1 ,
332334 verbose : bool = False ,
333335 cell_filter : Filter = FrechetCellFilter ,
@@ -346,6 +348,8 @@ def relax(
346348 Max number of steps for relaxation.
347349 traj_file : str
348350 The trajectory file for saving.
351+ final_atoms_object_file: str
352+ The final atoms object file for saving.
349353 interval : int
350354 The step interval for saving the trajectories.
351355 verbose : bool
@@ -389,6 +393,9 @@ def relax(
389393 np .linalg .norm (traj .frame_properties [- 1 ]["forces" ][idx ]) < abs (fmax )
390394 for idx in range (len (struct ))
391395 )
396+ if final_atoms_object_file is not None :
397+ write (final_atoms_object_file , atoms , format = "extxyz" , append = True )
398+
392399 return AseResult (
393400 final_mol_or_struct = struct ,
394401 trajectory = traj ,
0 commit comments