# [Pw_forum] question on constraint magnetic moment calculation

Gabriele Sclauzero gabriele.sclauzero at mat.ethz.ch
Fri Jul 4 16:56:04 CEST 2014

```OK, but here you are showing a different case where you fix the local
magnetic moment (as a vector)...

In this case, for some reason the local moment along z is still a bit
far from the target of 2.8, therefore the penalty energy is still large
(also given the large value of the lambda prefactor). Does it work with
a smaller constrained moment, say 2.5?

GS

On 07/04/2014 04:31 PM, Pang Rui wrote:
> Dear Gabriele Sclauzero:
> I covered the output, so I gave a new one with the same problems.The input
> file can be seen in the end. The only difference is the angle and
> amplitude. The scf converged after 59 steps(In default conv_thr). The
> output of the magnetic moment is as followed
>
> ==============================================================================
>       atom number    1 relative position :    0.3750   0.0000   0.0000
>       charge :    13.367288
>       magnetization :          0.000122    0.000076    2.717489
>       magnetization/charge:    0.000009    0.000006    0.203294
>       polar coord.: r, theta, phi [deg] :     2.717489    0.003039
> 31.837662
>       constrained moment :     0.000000    0.000000    2.800000
>
>
> ==============================================================================
>
>
> ==============================================================================
>       atom number    2 relative position :    0.6250   0.0000   0.0000
>       charge :    13.367507
>       magnetization :          0.000165    0.000174    2.717217
>       magnetization/charge:    0.000012    0.000013    0.203270
>       polar coord.: r, theta, phi [deg] :     2.717217    0.005053
> 46.399234
>       constrained moment :     0.000000    0.000000    2.800000
>
>
> ==============================================================================
> But the constraint energy (Ryd) = 2.04918119.
> The question is, the lambda has been quite large, scf problems will occur
> if it is increased. But the constraint energy is still large. How can I get
> both constraint energy and scf converged in a constraint magnetic moment
> calculation?
>
> INPUTFILE:
>   &control
>      pseudo_dir = "~/pr/QE5/pseudo"
>      outdir="./",
>      calculation="scf",
>   /
>   &system
>      ibrav=  0, nat=  2, ntyp= 2,
>      ecutwfc = 280.0,
>      occupations='smearing',
>      degauss=0.001,
>      smearing='gauss'
>      starting_magnetization(1)=2.8
>      starting_magnetization(2)=2.8
>      angle1(1)=0.0
>      angle1(2)=0.0
>      angle2(1)=0.0
>      angle2(2)=0.0
>      constrained_magnetization="atomic"
>      noncolin=.ture.
>      lambda=150.0
>      nosym=.true.
> /
>   &electrons
>      mixing_beta = 0.1
>      electron_maxstep=200
>   /
> ATOMIC_SPECIES
> Fe1 56 Fe.pbe-sp-hgh.UPF
> Fe2 56 Fe.pbe-sp-hgh.UPF
> ATOMIC_POSITIONS angstrom
> Fe1 3.0 0.0 0.0
> Fe2 5.0 0.0 0.0
> K_POINTS automatic
> 1 1 1 0 0 0
> CELL_PARAMETERS angstrom
>      8.0    0.0000000000000000    0.0000000000000000
>      0.0 8.0    0.0000000000000000
>      0.0 0.0 8.0

--
Dr. Gabriele Sclauzero
ETH Zurich
Materials Theory
HIT G 43.2
Wolfgang-Pauli-Str. 27
8093 Zürich, Switzerland

Phone +41 44 633 94 10
Fax +41 44 633 14 59
gabriele.sclauzero at mat.ethz.ch
http://www.theory.mat.ethz.ch/people/postdocs/gsclauze

```