ase
Utility functions for running ASE calculators with ASE-based methods.
has_geodesic_interpolate
module-attribute
¶
Runner ¶
Runner(
atoms: Atoms | list[Atoms],
calculator: BaseCalculator,
copy_files: (
SourceDirectory
| dict[SourceDirectory, Filenames]
| None
) = None,
)
Bases: BaseRunner
Run various types of calculations in a scratch directory and copy the results back to the original directory. Note: This function does not modify the atoms object in-place.
Parameters:
-
atoms
(Atoms | list[Atoms]
) –The Atoms object to run calculations on. A list[Atoms] is used for NEB.
-
calculator
(BaseCalculator
) –The instantiated ASE calculator object to attach to the Atoms object.
-
copy_files
(SourceDirectory | dict[SourceDirectory, Filenames] | None
, default:None
) –Files to copy (and decompress) from source to the runtime directory.
Returns:
-
None
–
Source code in quacc/runners/ase.py
run_calc ¶
This is a wrapper around atoms.calc.calculate()
.
Parameters:
-
geom_file
(str | None
, default:None
) –The filename of the log file that contains the output geometry, used to update the atoms object's positions and cell after a job. It is better to specify this rather than relying on ASE to update the positions, as the latter behavior varies between codes.
-
properties
(list[str] | None
, default:None
) –A list of properties to obtain. Defaults to ["energy", "forces"]
Returns:
-
Atoms
–The updated Atoms object.
Source code in quacc/runners/ase.py
run_md ¶
run_md(
dynamics: MolecularDynamics,
dynamics_kwargs: dict[str, Any] | None = None,
steps: int = 1000,
maxwell_boltzmann_kwargs: (
MaxwellBoltzmanDistributionKwargs | None
) = None,
set_com_stationary: bool = False,
set_zero_rotation: bool = False,
) -> MolecularDynamics
Run an ASE-based MD in a scratch directory and copy the results back to the original directory.
Parameters:
-
dynamics
(MolecularDynamics
) –MolecularDynamics class to use, from
ase.md.md.MolecularDynamics
. -
dynamics_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the dynamics. Takes all valid kwargs for ASE MolecularDynamics classes.
-
steps
(int
, default:1000
) –Maximum number of steps to run
-
maxwell_boltzmann_kwargs
(MaxwellBoltzmanDistributionKwargs | None
, default:None
) –If specified, a
MaxwellBoltzmannDistribution
will be applied to the atoms based onase.md.velocitydistribution.MaxwellBoltzmannDistribution
with the specified keyword arguments. -
set_com_stationary
(bool
, default:False
) –Whether to set the center-of-mass momentum to zero. This would be applied after any
MaxwellBoltzmannDistribution
is set. -
set_zero_rotation
(bool
, default:False
) –Whether to set the total angular momentum to zero. This would be applied after any
MaxwellBoltzmannDistribution
is set.
Returns:
-
MolecularDymamics
–The ASE MolecularDynamics object.
Source code in quacc/runners/ase.py
run_neb ¶
run_neb(
relax_cell: bool = False,
fmax: float = 0.01,
max_steps: int | None = 1000,
optimizer: type[Optimizer] = NEBOptimizer,
optimizer_kwargs: dict[str, Any] | None = None,
neb_kwargs: dict[str, Any] | None = None,
run_kwargs: dict[str, Any] | None = None,
) -> Dynamics
Run an NEB calculation.
Parameters:
-
relax_cell
(bool
, default:False
) –Whether to relax the unit cell shape and volume.
-
fmax
(float
, default:0.01
) –Tolerance for the force convergence (in eV/A).
-
max_steps
(int | None
, default:1000
) –Maximum number of steps to take.
-
optimizer
(type[Optimizer]
, default:NEBOptimizer
) –Optimizer class to use.
-
optimizer_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the optimizer. Takes all valid kwargs for ASE Optimizer classes.
-
neb_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the NEB class.
-
run_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the
run()
method of the optimizer.
Returns:
-
Dynamics
–The ASE Dynamics object following an NEB calculation.
Source code in quacc/runners/ase.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
|
run_opt ¶
run_opt(
relax_cell: bool = False,
fmax: float | None = 0.01,
max_steps: int = 1000,
optimizer: type[Dynamics] = BFGS,
optimizer_kwargs: dict[str, Any] | None = None,
store_intermediate_results: bool = False,
fn_hook: Callable | None = None,
run_kwargs: dict[str, Any] | None = None,
filter_kwargs: dict[str, Any] | None = None,
) -> Optimizer
This is a wrapper around the optimizers in ASE.
Parameters:
-
relax_cell
(bool
, default:False
) –Whether to relax the unit cell shape and volume.
-
fmax
(float | None
, default:0.01
) –Tolerance for the force convergence (in eV/A).
-
max_steps
(int
, default:1000
) –Maximum number of steps to take.
-
optimizer
(type[Dynamics]
, default:BFGS
) –Optimizer class to use.
-
optimizer_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the optimizer. Takes all valid kwargs for ASE Optimizer classes. Refer to
_set_sella_kwargs
for Sella-related kwargs and how they are set. -
store_intermediate_results
(bool
, default:False
) –Whether to store the files generated at each intermediate step in the optimization. If enabled, they will be stored in a directory named
stepN
whereN
is the step number, starting at 0. -
fn_hook
(Callable | None
, default:None
) –A custom function to call after each step of the optimization. The function must take the instantiated dynamics class as its only argument.
-
run_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the
run()
method of the optimizer. -
filter_kwargs
(dict[str, Any] | None
, default:None
) –Dictionary of kwargs for the
FrechetCellFilter
if relax_cell is True.
Returns:
-
Optimizer
–The ASE Optimizer object following an optimization.
Source code in quacc/runners/ase.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
run_vib ¶
run_vib(vib_kwargs: VibKwargs | None = None) -> Vibrations
Run an ASE-based vibration analysis in a scratch directory and copy the results back to the original directory. This can be useful if file I/O is slow in the working directory, so long as file transfer speeds are reasonable.
This is a wrapper around the vibrations module in ASE.
Parameters:
-
vib_kwargs
(VibKwargs | None
, default:None
) –Dictionary of kwargs for the ase.vibrations.Vibrations class.
Returns:
-
Vibrations
–The updated Vibrations module