ase
Utility functions for running ASE calculators with ASE-based methods.
OptimizerKwargs ¶
VibKwargs ¶
run_calc ¶
run_calc(
atoms: Atoms,
geom_file: str | None = None,
copy_files: (
SourceDirectory
| dict[SourceDirectory, Filenames]
| None
) = None,
get_forces: bool = False,
) -> Atoms
Run a calculation 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 atoms.get_potential_energy(). Note: This function does not modify the atoms object in-place.
Parameters:
-
atoms
(Atoms
) –The Atoms object to run the calculation on.
-
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's atoms.get_potential_energy() function to update the positions, as this varies between codes.
-
copy_files
(SourceDirectory | dict[SourceDirectory, Filenames] | None
, default:None
) –Files to copy (and decompress) from source to the runtime directory.
-
get_forces
(bool
, default:False
) –Whether to use
atoms.get_forces()
instead ofatoms.get_potential_energy()
.
Returns:
-
Atoms
–The updated Atoms object.
Source code in quacc/runners/ase.py
run_opt ¶
run_opt(
atoms: Atoms,
relax_cell: bool = False,
fmax: float = 0.01,
max_steps: int = 1000,
optimizer: Optimizer = BFGS,
optimizer_kwargs: OptimizerKwargs | None = None,
store_intermediate_results: bool = False,
fn_hook: Callable | None = None,
run_kwargs: dict[str, Any] | None = None,
copy_files: (
SourceDirectory
| dict[SourceDirectory, Filenames]
| None
) = None,
) -> Optimizer
Run an ASE-based optimization 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 optimizers in ASE. Note: This function does not modify the atoms object in-place.
Parameters:
-
atoms
(Atoms
) –The Atoms object to run the calculation on.
-
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
, default:1000
) –Maximum number of steps to take.
-
optimizer
(Optimizer
, default:BFGS
) –Optimizer class to use.
-
optimizer_kwargs
(OptimizerKwargs | 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.
-
copy_files
(SourceDirectory | dict[SourceDirectory, Filenames] | None
, default:None
) –Files to copy (and decompress) from source to the runtime directory.
Returns:
-
Optimizer
–The ASE Optimizer object.
Source code in quacc/runners/ase.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 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 |
|
run_vib ¶
run_vib(
atoms: Atoms,
vib_kwargs: VibKwargs | None = None,
copy_files: (
SourceDirectory
| dict[SourceDirectory, Filenames]
| 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. Note: This function does not modify the atoms object in-place.
Parameters:
-
atoms
(Atoms
) –The Atoms object to run the calculation on.
-
vib_kwargs
(VibKwargs | None
, default:None
) –Dictionary of kwargs for the ase.vibrations.Vibrations class.
-
copy_files
(SourceDirectory | dict[SourceDirectory, Filenames] | None
, default:None
) –Files to copy (and decompress) from source to the runtime directory.
Returns:
-
Vibrations
–The updated Vibrations module