To calculate an electronic structure with an arbitrary spin orientation in the noncollinear DFT, OpenMX Ver. 3.9 provides two kinds of constraint functionals which give a penalty unless the difference between the calculated spin orientation and the initial one is zero [13]. The constraint DFT for the noncollinear spin orientation is available by the following keywords:
scf.Constraint.NC.Spin on # onon2off, default=off scf.Constraint.NC.Spin.v 0.5 # default=0.0(eV)You can introduce the penalty functional by either 'on' or 'on2' for the keyword 'scf.Constraint.NC.Spin'. By 'on', the spin direction is constrained at the initial orientation, but the magnitude of the spin moment can vary so that the total energy can be stabilized. On the other hand, by 'on2', the spin direction and the magnitude of the spin moment are constrained at the initial setting by the keyword 'Atoms.SpeciesAndCoordinates'. The keyword 'scf.Constraint.NC.Spin.v' gives a magnitude which determines the strength of constraint when the constraint is introduced. The constraint is applied on each atom by specifying a flag as follows:
<Atoms.SpeciesAndCoordinates 1 Cr 0.00000 0.00000 0.00000 7.0 5.0 20.0 0.0 0.0 0.0 1 off 2 Cr 0.00000 2.00000 0.00000 7.0 5.0 20.0 0.0 0.0 0.0 1 off Atoms.SpeciesAndCoordinates>

Here we provide tips to calculate a smooth energy curve as a function of spin rotational angle using the constraint DFT method. In many cases, local magnetic moments arises from partially filled localized  and/or orbitals such as orbitals. In this case, the occupation of electrons to the localized orbitals may lead to multiple local minima due to the degree of freedom of the occupation. To avoid such a local minima problem, you can start the calculation with a spin orientation along an easy axis. Once the calculation finishes, the restart file is generated. In the next calculation, you may rotate the spin orientation moderately, e.g., 30 degree, compared to the first calculation, and read the restart file which was generated by the first calculation. The same procedure can be performed for all the spin rotational angle that you want to calculate, and at each calculation the restart file generated by the previous step should be read. The stepbystep approach is very effective to avoid the local minima problem.