Skip to content

simple_position_amplitude

Helper functions for position amplitude data with fixed-width gaussian steps.

SPAData (dict)

TypedDict of positions, amplitudes, and nothing else.

SimplePositionAmplitudeData (dict)

TypedDict of positions, amplitudes, and nothing else.

make_simple_position_amplitude_data(position, amplitude)

Create SimplePositionAmplitudeData from position and amplitude.

Parameters:

Name Type Description Default
position Array

the particle positions

required
amplitude Array

the wavefunction amplitudes

required

Returns:

Type Description
SimplePositionAmplitudeData

SPAData

Source code in vmcnet/mcmc/simple_position_amplitude.py
def make_simple_position_amplitude_data(position: Array, amplitude: Array) -> SPAData:
    """Create SimplePositionAmplitudeData from position and amplitude.

    Args:
        position (Array): the particle positions
        amplitude (Array): the wavefunction amplitudes

    Returns:
        SPAData
    """
    return make_position_amplitude_data(position, amplitude, None)

make_simple_pos_amp_gaussian_step(model_apply, std_move, logabs=True)

Create metropolis step for PositionAmplitudeData with fixed gaussian step width.

Parameters:

Name Type Description Default
model_apply Callable

function which evaluates a model. Has signature (params, position) -> amplitude

required
std_move float32

the standard deviation of the gaussian step

required
logabs bool

whether the provided amplitudes represent psi (logabs = False) or log|psi| (logabs = True). Defaults to True.

True

Returns:

Type Description
Callable

function which does a metropolis step. Has the signature (params, PositionAmplitudeData, key) -> (mean acceptance probability, PositionAmplitudeData, new_key)

Source code in vmcnet/mcmc/simple_position_amplitude.py
def make_simple_pos_amp_gaussian_step(
    model_apply: ModelApply[P],
    std_move: jnp.float32,
    logabs: bool = True,
) -> MetropolisStep[P, SPAData]:
    """Create metropolis step for PositionAmplitudeData with fixed gaussian step width.

    Args:
        model_apply (Callable): function which evaluates a model. Has signature
            (params, position) -> amplitude
        std_move: the standard deviation of the gaussian step
        logabs (bool, optional): whether the provided amplitudes represent psi
            (logabs = False) or log|psi| (logabs = True). Defaults to True.

    Returns:
        Callable: function which does a metropolis step. Has the signature
            (params, PositionAmplitudeData, key)
            -> (mean acceptance probability, PositionAmplitudeData, new_key)
    """
    return make_position_amplitude_gaussian_metropolis_step(
        model_apply, lambda _: std_move, None, logabs
    )