@@ -98,6 +98,12 @@ def __init__(self, minimizer = None, ase_calculator=None, N_configs=1, max_pop =
9898 self .target_pressure = 0
9999 self .fix_volume = False
100100
101+ # Options for the cell relaxation
102+ # If true the cell shape is fixed in a variable-cell relaxation
103+ # even if the symmetries allows for more degrees of freedom in the cell shape.
104+ # Usefull (for example) if you want to enfoce a cubic cell even if the structure brakes the symmetries
105+ self .fix_cell_shape = False
106+
101107
102108 # Setup the attribute control
103109 self .__total_attributes__ = [item for item in self .__dict__ .keys ()]
@@ -351,7 +357,10 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
351357 This function performs a variable cell SCHA relaxation at constant pressure,
352358 It is similar to the relax calculation, but the unit cell is updated according
353359 to the anharmonic stress tensor at each new population.
354- The cell optimization is performed with the BFGS algorithm.
360+
361+ By default, all the degrees of freedom compatible with the symmetry group are relaxed in the cell.
362+ You can constrain the cell to keep the same shape by setting fix_cell_shape = True.
363+
355364
356365 NOTE:
357366 remember to setup the stress_offset variable of the SCHA_Minimizer,
@@ -360,6 +369,7 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
360369 stress tensor difference between a single very high-cutoff calculation and a
361370 single low-cutoff (the one you use), this difference will be added at the final
362371 stress tensor to get a better estimation of the true stress.
372+
363373
364374 Parameters
365375 ----------
@@ -393,7 +403,8 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
393403 does not support it by default)
394404 cell_relax_algorithm : string
395405 This identifies the stress algorithm. It can be both sd (steepest-descent),
396- cg (conjugate-gradient) or bfgs (Quasi-newton)
406+ cg (conjugate-gradient) or bfgs (Quasi-newton).
407+ The most robust one is SD. Do not change if you are not sure what you are doing.
397408 fix_volume : bool, optional
398409 If true (default False) the volume is fixed, therefore only the cell shape is relaxed.
399410
@@ -558,7 +569,11 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
558569 # print ""
559570
560571 # Perform the cell step
561- cell_gradient = (stress_tensor - I * target_press_evA3 )
572+ if self .fix_cell_shape :
573+ # Use a isotropic stress tensor to keep the same cell shape
574+ cell_gradient = I * (Press - target_press_evA3 )
575+ else :
576+ cell_gradient = (stress_tensor - I * target_press_evA3 )
562577
563578 new_uc = self .minim .dyn .structure .unit_cell .copy ()
564579 BFGS .UpdateCell (new_uc , cell_gradient , fix_volume )
0 commit comments