xtb
qcop.adapters.xtb.XTBAdapter
¶
XTBAdapter()
Adapter for xtb-python.
Source code in qcop/adapters/xtb.py
38 39 40 41 |
|
supported_calctypes
class-attribute
instance-attribute
¶
supported_calctypes = [energy, gradient]
Supported calculation types.
validate_input
¶
validate_input(inp_obj: ProgramInput) -> None
Validate the input for xtb-python.
Source code in qcop/adapters/xtb.py
43 44 45 46 47 48 49 50 51 52 53 |
|
program_version
¶
program_version(stdout: Optional[str] = None) -> str
Get the program version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stdout |
Optional[str]
|
The stdout from the program. |
None
|
Returns:
Type | Description |
---|---|
str
|
The program version. |
Source code in qcop/adapters/xtb.py
55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
compute_results
¶
compute_results(
inp_obj: ProgramInput,
update_func: Optional[Callable] = None,
update_interval: Optional[float] = None,
**kwargs
) -> tuple[SinglePointResults, str]
Execute xtb on the given input.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inp_obj |
ProgramInput
|
The qcio ProgramInput object for a computation. |
required |
update_func |
Optional[Callable]
|
A callback function to call as the program executes. |
None
|
update_interval |
Optional[float]
|
The minimum time in seconds between calls to the update_func. |
None
|
Returns:
Type | Description |
---|---|
tuple[SinglePointResults, str]
|
A tuple of SinglePointComputedProps and the stdout str. |
Source code in qcop/adapters/xtb.py
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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
Example¶
"""Must run script like this: python -m examples.xtb"""
from qcio import CalcType, ProgramInput, Structure
from qcop import compute
# Create the structure
# Can also open a structure from a file
# structure = Structure.open("path/to/h2o.xyz")
structure = Structure(
symbols=["O", "H", "H"],
geometry=[ # type: ignore
[0.0, 0.0, 0.0],
[0.52421003, 1.68733646, 0.48074633],
[1.14668581, -0.45032174, -1.35474466],
],
)
# Define the program input
prog_input = ProgramInput(
structure=structure,
calctype=CalcType.energy,
model={"method": "GFN2xTB"}, # type: ignore
keywords={"max_iterations": 150},
)
prog_output = compute("xtb", prog_input)
print(prog_output)