Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the quality keyword for geometry convergence criteria #133

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions src/tcutility/job/ams.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AMSJob(Job):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.single_point()
self.geometry_convergence('Good')
self.geometry_convergence()

def __str__(self):
return f'{self._task}({self._functional}/{self._basis_set}), running in {os.path.join(os.path.abspath(self.rundir), self.name)}'
Expand Down Expand Up @@ -104,28 +104,20 @@ def vibrations(self, enable: bool = True, NegativeFrequenciesTolerance: float =
self.settings.input.ams.PESPointCharacter.NegativeFrequenciesTolerance = NegativeFrequenciesTolerance
self.settings.input.ams.NormalModes.ReScanFreqRange = '-10000000.0 10.0'

def geometry_convergence(self, quality: str = None, gradients: float = 1e-5, energy: float = 1e-5, step: float = 1e-2):
def geometry_convergence(self, gradients: float = 1e-5, energy: float = 1e-5, step: float = 1e-2, stress: float = 5e-4):
'''
Set the convergence criteria for the geometry optimization.

Args:
quality: convergence criteria preset. Must be one of [``VeryBasic``, ``Basic``, ``Normal``, ``Good``, ``VeryGood``].
Default ``None`` will not use a threshold. If it is given, it will overwrite the other arguments.
gradients: the convergence criteria for the gradients during geometry optimizations. Defaults to 1e-5.
energy: the convergence criteria for the energy during geometry optimizations. Defaults to 1e-5.
step: the convergence criteria for the step-size during geometry optimizations. Defaults to 1e-2.
'''
if quality:
allowed_qualities = ['verybasic', 'basic', 'normal', 'good', 'verygood']
if quality.lower() not in [q.lower() for q in allowed_qualities]:
log.error(f'Argument "quality" must be one of {allowed_qualities}, not {quality}')
raise
self.settings.input.ams.GeometryOptimization.Convergence.Quality = quality
else:
self.settings.input.ams.GeometryOptimization.Convergence.Quality = 'Custom'
self.settings.input.ams.GeometryOptimization.Convergence.Gradients = gradients
self.settings.input.ams.GeometryOptimization.Convergence.Energy = energy
self.settings.input.ams.GeometryOptimization.Convergence.Step = step
gradients: the convergence criteria for the gradients during geometry optimizations. Defaults to ``1e-5``.
energy: the convergence criteria for the energy during geometry optimizations. Defaults to ``1e-5``.
step: the convergence criteria for the step-size during geometry optimizations. Defaults to ``1e-2``.
stress: the convergence criteria for the stress-energy per atom during geometry optimizations. Defaults to ``5e-4``
'''
self.settings.input.ams.GeometryOptimization.Convergence.Gradients = gradients
self.settings.input.ams.GeometryOptimization.Convergence.Energy = energy
self.settings.input.ams.GeometryOptimization.Convergence.Step = step
self.settings.input.ams.GeometryOptimization.Convergence.StressEnergyPerAtom = stress

def charge(self, val: int):
'''
Expand Down
Loading