FSKTSampler

class snap_simulate.hoomd.FSKTSampler(sim, ptype, kmag=1.1, file_name='fskt_sampler.pkl', sampling_mode='linear', min_interval=10, max_interval=None, Nmag=10, Navg=1, use_multiprocessing=False, auto_load=True)[source]

Intermediate scattering function Fs(k,t) autocorrelation sampler.

The FSKTSampler class inherits from BaseSampler and measures the self-intermediate scattering function (\(F_s(k, t)\)) to evaluate structural relaxation and decorrelation of particle positions.

Overview

FSKTSampler tracks unwrapped particle coordinates for a specified particle type (ptype) and computes:

\[F_s(k, t) = \frac{1}{N} \left\langle \sum_{j=1}^N \exp(i \mathbf{k} \cdot [\mathbf{r}_j(t_0 + t) - \mathbf{r}_j(t_0)]) \right\rangle\]

Calculations are evaluated using the optimized routines in snap_analyze. When use_multiprocessing=True is configured, calculations are performed asynchronously in a background worker process.

Parameters

  • sim (hoomd.Simulation): The active HOOMD-blue simulation instance (used to read integrator timestep size dt and box dimensions box).

  • ptype (int): The particle type index to track and analyze for spatial decorrelation.

  • kmag (float, default 1.1): Magnitude of the scattering wavevector \(k = |\mathbf{k}|\).

  • **kwargs: All additional keyword arguments (file_name, sampling_mode, min_interval, max_interval, Nmag, Navg, use_multiprocessing, auto_load) are inherited directly from BaseSampler. See BaseSampler for parameter details. (Note that file_name defaults to "fskt_sampler.pkl" for FSKTSampler).

Usage Example

from snap_simulate.hoomd import FSKTSampler, minimize_autocorrelation

# Create self-intermediate scattering function sampler for particle type 0
sampler = FSKTSampler(
    sim,
    ptype=0,
    kmag=1.1,
    sampling_mode="logarithmic",
    use_multiprocessing=True
)

# Run simulation until spatial decorrelation is met
result = minimize_autocorrelation(sim, sampler, threshold=0.01, max_steps=1000000)
print(f"Decorrelated: {result['minimized']} in {result['steps_ran']} steps")