add_mfield

Apply a constant external magnetic induction to an atom group or a fractional-coordinate region.

Syntax

add_mfield <group_method> <group_id> <Bx> <By> <Bz>
add_mfield region <amin> <amax> <bmin> <bmax> <cmin> <cmax> <Bx> <By> <Bz>

Parameters

Grouping method and group ID select an existing group in model.xyz. The three finite field components are in tesla (T). There is no separate magnitude or direction normalization. Group selection follows atom identities even when atoms move. Region selection instead follows current fractional coordinates along cell vectors a, b, and c.

Bounds must be finite, in [0, 1], and satisfy min < max. Intervals are half-open: [min, max). Coordinates are evaluated after periodic boundary wrapping. No group labels are needed for region mode.

Output

None.

Examples

Apply a 10 T field along z to group 0 in grouping method 0:

add_mfield 0 0 0 0 10

For a 10 T field along z in the first half of the cell along a:

add_mfield region 0 0.5 0 1 0 1 0 0 10

Notes

Membership is recomputed on every force evaluation: atoms entering the region receive the field, and atoms leaving it no longer do. The sharp boundary gives a discontinuous Zeeman energy. No mechanical boundary impulse is implemented; energy conservation is not guaranteed for atoms crossing this boundary. This is a local magnetic drive, not a smooth conservative gradient-field model.

A Spin potential and spin:R:3 are required. The field acts only on selected atoms whose elements belong to the model’s spin_type. Other elements retain zero effective spin and zero magnetic force.

Declare the field before each run that uses it. Multiple add_mfield commands in the same run add their contributions, including overlapping groups or regions. Field actions are cleared after the run. To run without a field, omit add_mfield before the next run; a zero-valued command contributes zero and does not cancel other field actions.

Spin is in muB, magnetic force is in eV/muB, and energy is in eV. With c_B = 5.7883818060e-5, the added magnetic force is c_B times the field vector; the added per-atom Zeeman energy is minus spin dotted with this force. Both contributions are recomputed at every force evaluation using the actual stored moments and do not accumulate across evaluations. Output energies and magnetic forces include these contributions. No additional g factor is applied. There is no direct mechanical force or virial contribution. Time-dependent fields and linear gradients are not supported.

The field is magnetic induction B, not H in A/m. For example, a 2 muB moment aligned with 1 T has Zeeman energy approximately -1.1576e-4 eV and magnetic force +5.7884e-5 eV/muB along the field.

Fields do not participate in minimize spin_fire. A field declared before minimization applies to the next run and is cleared when that run finishes.