Skip to content

geomeTRIC

qcop.adapters.geometric.GeometricAdapter

GeometricAdapter()

Adapter for geomeTRIC.

Source code in qcop/adapters/geometric.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def __init__(self):
    super().__init__()
    # Check that geomeTRIC is installed
    self.geometric = self._ensure_geometric_installed()
    # Dictionary from geometric.run_json; copying QCSchema workflow
    self.coordsys_params = {
        "cart": (self.geometric.internal.CartesianCoordinates, False, False),
        "prim": (self.geometric.internal.PrimitiveInternalCoordinates, True, False),
        "dlc": (
            self.geometric.internal.DelocalizedInternalCoordinates,
            True,
            False,
        ),
        "hdlc": (
            self.geometric.internal.DelocalizedInternalCoordinates,
            False,
            True,
        ),
        "tric": (
            self.geometric.internal.DelocalizedInternalCoordinates,
            False,
            False,
        ),
    }

supported_calctypes class-attribute instance-attribute

supported_calctypes = [optimization, transition_state]

Supported calculation types.

program_version

program_version(*args) -> str

Get the program version.

Source code in qcop/adapters/geometric.py
71
72
73
def program_version(self, *args) -> str:
    """Get the program version."""
    return self.geometric.__version__

compute_results

compute_results(
    inp_obj: DualProgramInput,
    update_func: Optional[Callable] = None,
    update_interval: Optional[float] = None,
    propagate_wfn: bool = True,
    **kwargs
) -> tuple[OptimizationResults, str]

Compute the requested calculation.

Parameters:

Name Type Description Default
inp_obj DualProgramInput

The qcio DualProgramInput object for a computation.

required
propagate_wfn bool

Whether to propagate the wavefunction between steps of the optimization.

True
Source code in qcop/adapters/geometric.py
 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
def compute_results(
    self,
    inp_obj: DualProgramInput,
    update_func: Optional[Callable] = None,
    update_interval: Optional[float] = None,
    propagate_wfn: bool = True,
    **kwargs,
) -> tuple[OptimizationResults, str]:
    """Compute the requested calculation.

    Args:
        inp_obj: The qcio DualProgramInput object for a computation.
        propagate_wfn: Whether to propagate the wavefunction between steps of the
            optimization.
    """
    # Update the input object based on its calctype
    self._update_inp_obj(inp_obj)
    geometric_molecule = self._create_geometric_molecule(inp_obj.structure)
    internal_coords_sys = self._setup_coords(inp_obj, geometric_molecule)

    qcio_adapter = get_adapter(inp_obj.subprogram, inp_obj, qcng_fallback=True)
    optimizer = self._construct_optimizer(
        inp_obj,
        geometric_molecule,
        internal_coords_sys,
        qcio_adapter,
        propagate_wfn=propagate_wfn,
        update_func=update_func,
        update_interval=update_interval,
        **kwargs,
    )

    # Haven't update DualOutputHandler to send logs using arbitrary update funcs.
    with capture_logs("geometric", update_func, update_interval) as (_, log_string):
        try:
            optimizer.optimizeGeometry()
        except self.geometric.errors.Error as e:
            raise GeometricError() from e

    return (
        OptimizationResults(
            trajectory=optimizer.engine.qcio_trajectory,
        ),
        log_string.getvalue(),
    )