Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing misc bugs #88

Merged
merged 7 commits into from
Nov 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add if statement to avoid divided-by-zero error in nissin
  • Loading branch information
zhucaoxiang committed Nov 16, 2022
commit f4e0f67bb7d8e33b7aff2e07854f9fe23e2164f8
7 changes: 6 additions & 1 deletion sources/nissin.f90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ subroutine nisscom(ideriv)
endif

if ( coil(icoil)%Lc /= 0 ) then !if geometry is free;
call nissinDeriv1( icoil, t1N(idof+1:idof+ND), ND, NF )
if (abs(nissin) .le. machprec) then
t1N(idof+1:idof+ND) = 0 ! avoid divided-by-zero-error
else
call nissinDeriv1( icoil, t1N(idof+1:idof+ND), ND, NF )
endif

if (mnissin > 0) then ! L-M format of targets
LM_fjac(inissin+ivec, idof+1:idof+ND) = weight_nissin * t1N(idof+1:idof+ND)
ivec = ivec + 1
Expand Down