lambda_m

This keyword sets the weight of Cartesian magnetic-force RMSE in the loss.

Syntax

lambda_m <weight>

Alternatively, use both of the following keywords:

lambda_m_parallel <weight_parallel>
lambda_m_perp <weight_perp>

Parameters

The weight must be non-negative and defaults to 1. It multiplies the RMSE of the Cartesian magnetic force

\[\boldsymbol{M}_i=-\frac{\partial U}{\partial\boldsymbol{s}_i},\]

whose unit is eV/muB. Only frames containing mforce:R:3 and atoms enabled by spin_type enter this RMSE. A frame without magnetic-force labels can still contribute energy, force, or virial data.

Set lambda_m 0 to remove the Cartesian magnetic-force RMSE from the optimization objective.

To fit magnetic-moment magnitude and direction separately, set both lambda_m_parallel and lambda_m_perp instead of lambda_m. Each coefficient must be finite and non-negative. A zero coefficient disables that component. These keywords cannot be combined with lambda_m. When neither is specified, lambda_m controls the Cartesian objective.

Output

In split mode, loss.out adds four columns after rmse_tau_test and before any energy-difference columns: rmse_m_parallel_train, rmse_m_perp_train, rmse_m_parallel_test, and rmse_m_perp_test. Read the # columns header; the Cartesian and torque diagnostics are retained. Training metrics describe the reported batch. Test metrics are zero when no test set is supplied.

Examples

Fit the Cartesian magnetic force:

lambda_m 1.0

Alternatively, fit parallel and perpendicular components with separate weights:

lambda_m_parallel 1.0
lambda_m_perp 1.0

Notes

Independent parallel and perpendicular losses

For residual \(\delta\boldsymbol M_i=\boldsymbol M_i-\boldsymbol M_i^{ref}\) and the input spin direction \(\hat{\boldsymbol s}_i\), define

\[\begin{split}R_\parallel &= \sqrt{\frac{1}{N_{mag}}\sum_i (\delta\boldsymbol M_i\cdot\hat{\boldsymbol s}_i)^2},\\ R_\perp &= \sqrt{\frac{1}{2N_{mag}}\sum_i |\delta\boldsymbol M_i-(\delta\boldsymbol M_i\cdot\hat{\boldsymbol s}_i) \hat{\boldsymbol s}_i|^2},\\ L_{mag} &= \lambda_{m,\parallel}R_\parallel+ \lambda_{m,\perp}R_\perp.\end{split}\]

Both reductions use the same labeled, active atoms as lambda_m; the normalization counts one parallel and two perpendicular degrees of freedom. At exactly zero spin, squared residuals are assigned isotropically: one third to the parallel channel and two thirds to the perpendicular channel. Every nonzero spin defines a direction, without a small-moment cutoff. During optimization, squared configuration weights multiply each squared residual; reported RMSEs are unweighted.

SNES minimizes a weighted sum of RMSEs. In general no pair of constant coefficients makes the sum of the parallel and perpendicular RMSEs equal to Cartesian RMSE. Use lambda_m to supervise Cartesian magnetic force. The raw metrics obey \(3 R_M^2=R_\parallel^2+2R_\perp^2\).

lambda_tau controls an independent torque term. Torque weights the perpendicular residual by spin magnitude and is not the same as R_perp. These loss settings do not change the model format or predicted magnetic force.

On restart, the objective is taken from nep.in; the model/restart files do not store these loss coefficients.