File size: 1,296 Bytes
5ccb4fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Copyright (c) 2026 Simulacra Research Inc.
# SPDX-License-Identifier: Apache-2.0


from __future__ import annotations

from typing import Any

import jax

from hamiltonzero.energy.kernel import (
    _vmc_energy_custom_lap_finetune,
    _vmc_energy_custom_lap_prebuilt,
)


def vmc_energy_custom_lap_compiled(
    kernel: Any,
    tree: Any,
    energy_frame: Any,
    q_routed: jax.Array,
    *,
    chunk_size: int | None = 512,
) -> tuple[jax.Array, jax.Array, jax.Array, jax.Array]:
    return _vmc_energy_custom_lap_prebuilt(
        kernel,
        tree,
        energy_frame,
        q_routed,
        chunk_size=chunk_size,
    )


def vmc_energy_custom_lap_finetune(
    model: Any,
    energy_frame: Any,
    q_routed: jax.Array,
    *,
    chunk_size: int | None = 512,
) -> tuple[jax.Array, jax.Array, jax.Array, jax.Array]:
    from hamiltonzero.compiled.model import CompiledFinetuneWaveFunction

    if not isinstance(model, CompiledFinetuneWaveFunction):
        raise TypeError("fine-tune energy requires CompiledFinetuneWaveFunction")
    return _vmc_energy_custom_lap_finetune(
        model,
        energy_frame,
        q_routed,
        0.0,
        chunk_size=chunk_size,
    )


__all__ = [
    "vmc_energy_custom_lap_compiled",
    "vmc_energy_custom_lap_finetune",
]