OptimizeGeometryParameters¶
- class OptimizeGeometryParameters(max_forces=None, max_stress=None, max_steps=None, max_step_length=None, constraints=None, trajectory_filename=None, trajectory_object_id=None, disable_stress=None, optimize_cell=None, optimizer_method=None, target_stress=None, pre_step_hook=None, post_step_hook=None, constrain_bravais_lattice=None, trajectory_interval=None, restart_strategy=None, enable_optimization_stop_file=None, write_raw_stress=None, write_raw_forces=None, compute_stress=None)¶
Class for parameters used in optimizing the geometry of a configuration.
- Parameters:
max_forces (PhysicalQuantity of type force) – The maximum forces determining that the optimization should stop. Default: 0.05*eV/Ang
max_stress (PhysicalQuantity of type pressure) – The maximum stress determining that the optimization should stop. Default: 0.1*GPa
max_steps (A positive integer.) – The maximum number of steps. Default: 200
max_step_length (PhysicalQuantity of type length) – The maximum step length the optimizer may take. Default: 0.2*Ang
constraints (A list of integers and Constraints objects.) – A list of indices of the atom with fixed positions, and Constraints objects. Default: []
trajectory_filename (str.) – The filename of the file to be used for storing the trajectory in.
trajectory_object_id (str | None) – The object id to use when saving to HDF5. Default: None
disable_stress – Deprecated: from v2022.03, use
optimize_cell
parameter instead.optimize_cell (bool) – will be change during the optimization. Enabling the stress calculation for bulk configurations. Default: True for BulkConfigurations otherwise False
optimizer_method (
LBFGS
|FIRE
|VelocityProjectionOptimization
|ConjugateGradient
) – The optimizer to use for optimizing the structure. Default: LBFGStarget_stress – The target stress under which the cell should be optimized. Must be given as a single pressure value, or a stress vector in Voigt or matrix notation. Default: 0*GPa
pre_step_hook (A callable function or method) – An optional user-defined function which will be called just before each optimization step. The signature of the function requires the arguments (step, configuration). The return status is ignored. Unhandled exceptions will terminate the optimization. Default: No hook.
post_step_hook (A callable function or method) – An optional user-defined function which will be called just after each optimization step. The signature of the function requires the arguments (step, configuration). The return status is ignored. Unhandled exceptions will terminate the optimization. Default: No hook.
constrain_bravais_lattice (bool) – Enable preserving the Bravais lattice symmetry of the configuration. Default: True if the
target_stress
is commensurate with the lattice symmetriestrajectory_interval (int | PhysicalQuantity of type time) – The resolution used in saving steps to a trajectory file. This can either be given as an integer (a value of 1 results in all steps being saved; a value of 2 results in every second step being saved; etc.) or as a time interval. Default:
1
restart_strategy (
NoRestart
|RestartFromTrajectory
) – The restart mechanism based on trajectory data saved in a given file. Default:RestartFromTrajectory()
enable_optimization_stop_file (bool) – Determines whether to enable a file for stopping the geometry optimization. If
True
, creation of the stop file will stop the optimization at the next step. The name of the stop file will be shown in the log output; it will bestop-geometry-optimization-uniqueID
, whereuniqueID
is a randomly generated identifier for this optimization. The file must be created in the current working directory. Default:True
write_raw_stress – Deprecated: from v2025.06, use
compute_stress
parameter instead.write_raw_forces – Deprecated: from v2025.06, forces are always written to trajectory.
compute_stress (bool) – Compute stress for each optimization step. Using this flag, stress can be regardless if
optimize_cell
is disabled. DefaultAutomatic
corresponds to “same as”optimize_cell
. Default:Automatic
- computeStress()¶
Query method for the compute_stress parameter.
- constrainBravaisLattice()¶
Query method for the constrain_bravais_lattice parameter.
- constraints()¶
Query method for the constraints.
- classmethod defaultOptimizeCell(configuration_type, is_neb, neb_variable_cell=None)¶
The default “enable stress” depend on the configuration type.
- Parameters:
configuration_type (type) – The configuration type.
is_neb (bool) – True, if neb configuration.
neb_variable_cell (bool) – Whether this is a variable cell NEB Configuration.
- Returns:
True, for Bulk configurations, otherwise False.
- Return type:
bool
- disableStress()¶
Query method for the disable stress.
- enableOptimizationStopFile()¶
Query method for the enable_optimization_stop_file parameter.
- maxForces()¶
Query method for the max forces.
- maxStepLength()¶
Query method for the max step length.
- maxSteps()¶
Query method for the max steps.
- maxStress()¶
Query method for the max stress.
- nlinfo()¶
- Returns:
The nlinfo.
- Return type:
dict
- optimizeCell()¶
Query method for the optimize cell.
- optimizerMethod()¶
Query method for the optimizer method.
- postStepHook()¶
Query method for the post-step hook.
- preStepHook()¶
Query method for the pre-step hook.
- restartStrategy()¶
Query method for the restart_strategy parameter.
- setConstrainBravaisLattice(constrain_bravais_lattice)¶
Method for setting the constrain_bravais_lattice parameter.
- setConstraints(constraints)¶
Method for setting the constraints.
- setDisableStress(disable_stress)¶
Method for setting the disable_stress.
- setEnableOptimizationStopFile(enable_optimization_stop_file, default_enable_optimization_stop_file)¶
Method for setting the enable optimization stop file parameter.
- setMaxForces(max_forces)¶
Method for setting the max forces.
- setMaxStepLength(max_step_length)¶
Method for setting the max step length.
- setMaxSteps(max_steps)¶
Method for setting the max steps.
- setMaxStress(max_stress)¶
Method for setting the max stress.
- setOptimizeCell(optimize_cell)¶
Method for setting the disable_stress and optimize cell.
- setOptimizerMethod(optimizer_method)¶
Method for setting the optimizer method.
- setPostStepHook(post_step_hook)¶
Method for setting the post-step hook.
- setPreStepHook(pre_step_hook)¶
Method for setting the pre-step hook.
- setRestartStrategy(restart_strategy, default_restart_strategy)¶
Method for setting the restart_strategy parameter.
- setTargetStress(target_stress)¶
Method for setting the target stress tensor.
- setTrajectoryFilename(trajectory_filename)¶
Method for setting the trajectory filename.
- setTrajectoryInterval(trajectory_interval, default_trajectory_interval)¶
Method for setting the trajectory_interval parameter.
- setTrajectoryObjectId(trajectory_object_id)¶
Method for setting the trajectory object ID.
- setWriteRawStress(write_raw_stress)¶
Method for setting the write_raw_stress.
- targetStress()¶
Query method for the target stress tensor.
- trajectoryFilename()¶
Query method for the trajectory filename.
- trajectoryInterval()¶
Query method for the trajectory_interval parameter.
- trajectoryObjectId()¶
Query method for the trajectory object ID.
- uniqueString()¶
Return a unique string representing the state of the object.
- writeRawForces()¶
Query method to check if raw force will be written on the trajectory.
- writeRawStress()¶
Query method to check if raw stress will be written on the trajectory.