mirror of https://gitlab.com/QEF/q-e.git
Added a check to avoid division by zero.
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@1894 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
8ccf1f9774
commit
5e8b31a464
|
@ -58,6 +58,8 @@ IF (i_cons.LT.3) THEN
|
|||
! the penalty functional in this case is
|
||||
! lambda*(m_loc(z)/|m_loc| - cos(theta) )^2
|
||||
ma = dsqrt(m_loc(1,na)**2+m_loc(2,na)**2+m_loc(3,na)**2)
|
||||
if (ma.lt.1.d-30) call errore('add_bfield', &
|
||||
'local magnetization is zero',1)
|
||||
xx=(m_loc(3,na)/ma - mcons(3,nt))
|
||||
m1(1) = - xx*m_loc(1,na)*m_loc(3,na) / (ma*ma*ma)
|
||||
m1(2) = - xx*m_loc(2,na)*m_loc(3,na) / (ma*ma*ma)
|
||||
|
|
Loading…
Reference in New Issue