16
16
from ase .constraints import FixSymmetry
17
17
from ase .filters import FrechetCellFilter
18
18
from ase .io import Trajectory as AseTrajectory
19
+ from ase .io import write
19
20
from ase .optimize import BFGS , FIRE , LBFGS , BFGSLineSearch , LBFGSLineSearch , MDMin
20
21
from ase .optimize .sciopt import SciPyFminBFGS , SciPyFminCG
21
22
from monty .serialization import dumpfn
@@ -328,6 +329,7 @@ def relax(
328
329
fmax : float = 0.1 ,
329
330
steps : int = 500 ,
330
331
traj_file : str = None ,
332
+ final_atoms_object_file : str = "final_atoms_object.xyz" ,
331
333
interval : int = 1 ,
332
334
verbose : bool = False ,
333
335
cell_filter : Filter = FrechetCellFilter ,
@@ -346,6 +348,8 @@ def relax(
346
348
Max number of steps for relaxation.
347
349
traj_file : str
348
350
The trajectory file for saving.
351
+ final_atoms_object_file: str
352
+ The final atoms object file for saving.
349
353
interval : int
350
354
The step interval for saving the trajectories.
351
355
verbose : bool
@@ -389,6 +393,9 @@ def relax(
389
393
np .linalg .norm (traj .frame_properties [- 1 ]["forces" ][idx ]) < abs (fmax )
390
394
for idx in range (len (struct ))
391
395
)
396
+ if final_atoms_object_file is not None :
397
+ write (final_atoms_object_file , atoms , format = "extxyz" , append = True )
398
+
392
399
return AseResult (
393
400
final_mol_or_struct = struct ,
394
401
trajectory = traj ,
0 commit comments