-
Notifications
You must be signed in to change notification settings - Fork 41
/
core.py
124 lines (108 loc) · 3.82 KB
/
core.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""Core recipes for GULP."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import job
from quacc.recipes.gulp._base import run_and_summarize
if TYPE_CHECKING:
from ase.atoms import Atoms
from quacc.schemas._aliases.ase import RunSchema
from quacc.utils.files import Filenames, SourceDirectory
@job
def static_job(
atoms: Atoms,
use_gfnff: bool = True,
keywords: list[str] | None = None,
options: list[str] | None = None,
library: str | None = None,
copy_files: SourceDirectory | dict[SourceDirectory, Filenames] | None = None,
) -> RunSchema:
"""
Carry out a single-point calculation.
Parameters
----------
atoms
Atoms object
use_gfnff
True if (p)GFN-FF should be used; False if not.
keywords
List of custom `keyword` kwargs for the GULP calculator. To remove entries
from the defaults, put a `#` in front of the name. For a list of
available keys, refer to the `ase.calculators.gulp.GULP` calculator.
options
List of custom `options` kwargs for the GULP calculator. To remove entries
from the defaults, put a `#` in front of the name. For a list of
available keys, refer to the `ase.calculators.gulp.GULP` calculator.
library
Filename of the potential library file, if required.
copy_files
Files to copy (and decompress) from source to the runtime directory.
Returns
-------
RunSchema
Dictionary of results from [quacc.schemas.ase.summarize_run][].
See the type-hint for the data structure.
"""
keyword_defaults = ["gfnff", "gwolf"] if use_gfnff else []
option_defaults = ["dump every gulp.res"]
return run_and_summarize(
atoms,
library=library,
keyword_defaults=keyword_defaults,
option_defaults=option_defaults,
keyword_swaps=keywords,
option_swaps=options,
additional_fields={"name": "GULP Static"},
copy_files=copy_files,
)
@job
def relax_job(
atoms: Atoms,
use_gfnff: bool = True,
relax_cell: bool = False,
keywords: list[str] | None = None,
options: list[str] | None = None,
library: str | None = None,
copy_files: SourceDirectory | dict[SourceDirectory, Filenames] | None = None,
) -> RunSchema:
"""
Carry out a structure relaxation.
Parameters
----------
atoms
Atoms object
use_gfnff
True if (p)GFN-FF should be used; False if not.
relax_cell
True if the volume should be relaxed; False if not.
keywords
List of custom `keyword` kwargs for the GULP calculator. To remove entries
from the defaults, put a `#` in front of the name. For a list of
available keys, refer to the `ase.calculators.gulp.GULP` calculator.
options
Dictionary of custom `options` kwargs for the GULP calculator. To remove entries
from the defaults, put a `#` in front of the name. For a list of
available keys, refer to the `ase.calculators.gulp.GULP` calculator.
library
Filename of the potential library file, if required.
copy_files
Files to copy (and decompress) from source to the runtime directory.
Returns
-------
RunSchema
Dictionary of results from [quacc.schemas.ase.summarize_run][].
See the type-hint for the data structure.
"""
keyword_defaults = ["opti", "conp" if relax_cell else "conv"]
if use_gfnff:
keyword_defaults += ["gfnff", "gwolf"]
option_defaults = ["dump every gulp.res"]
return run_and_summarize(
atoms,
library=library,
keyword_defaults=keyword_defaults,
option_defaults=option_defaults,
keyword_swaps=keywords,
option_swaps=options,
additional_fields={"name": "GULP Relax"},
copy_files=copy_files,
)