.. _move-crankshaft: ========== Crankshaft ========== :Keyword: ``MOVE_CRANKSHAFT`` :Move code: 1 :Status: core (recommended workhorse) How it works ============ The crankshaft is PIMMS' fundamental local move and should make up most of a typical move budget. It perturbs **one bead at a time**: for a chosen bead it finds the lattice sites that keep the chain connected - for an interior bead, the empty sites that are Chebyshev-1 adjacent to *both* of its chain neighbours; for a terminal bead, the empty sites adjacent to its single neighbour - and proposes moving the bead to one of them chosen uniformly at random. The chain's identity and bonding are preserved; only the kink at that bead changes. A single crankshaft *step* is a **megamove**: it performs ``CRANKSHAFT_SUBSTEPS`` such single-bead perturbations in total, each one targeting a randomly chosen bead somewhere in the system and each with its own accept/reject, all inside an optimised Cython kernel. With a large ``CRANKSHAFT_SUBSTEPS`` one step therefore encompasses many thousands of elementary Monte Carlo moves. Why detailed balance holds ========================== The set of valid destination sites for a bead is determined solely by its neighbours' (fixed) positions, not by the bead's current position. Hence the forward proposal "bead at :math:`A \to B`" and the reverse "bead at :math:`B \to A`" are drawn from the *same* set of size :math:`N`, so .. math:: g(x\to y) = g(y\to x) = \tfrac{1}{N}. The proposal is symmetric, and the move is accepted with the plain Metropolis criterion .. math:: A(x\to y) = \min\!\left(1,\; e^{-\Delta E / T}\right), which satisfies detailed balance (see :ref:`the primer `). Each sub-move within the megamove obeys this independently, so the whole sweep leaves the Boltzmann distribution invariant. Configuration ============= ``MOVE_CRANKSHAFT`` : float Probability of selecting a crankshaft step (all ``MOVE_*`` must sum to 1.0). ``CRANKSHAFT_SUBSTEPS`` : int Total number of single-bead perturbations performed per crankshaft step (e.g. 20 000-50 000, larger for big systems). They are spread at random across all beads in the system, so on average each bead is perturbed ``CRANKSHAFT_SUBSTEPS`` / (number of beads) times per step. This is the main lever on how much work a crankshaft step does. The crankshaft is one of three moves with a multi-threaded kernel (along with the slither and pull): see :ref:`PARALLELIZE ` (2D or 3D, and composes with frozen chains). It is fast, ergodic for local relaxation, and a good default to dominate the move set, mixing in small fractions of the other moves for global rearrangement.