Skip to content

Catch unsupported elements#189

Merged
marvinfriede merged 5 commits intodftd4:mainfrom
marvinfriede:exit-unsupported-elements
Feb 23, 2023
Merged

Catch unsupported elements#189
marvinfriede merged 5 commits intodftd4:mainfrom
marvinfriede:exit-unsupported-elements

Conversation

@marvinfriede
Copy link
Copy Markdown
Member

  • exit if elements between 87 (Fr) and 111 (Rg) are in the structure
  • catch unsupported reference charge option instead of implicitly using EEQ charges

@marvinfriede marvinfriede linked an issue Feb 5, 2023 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 5, 2023

Codecov Report

Merging #189 (81d514f) into main (ee8b54f) will increase coverage by 0.34%.
The diff coverage is 59.52%.

@@            Coverage Diff             @@
##             main     #189      +/-   ##
==========================================
+ Coverage   42.44%   42.79%   +0.34%     
==========================================
  Files          31       31              
  Lines        2554     2636      +82     
  Branches     1047     1094      +47     
==========================================
+ Hits         1084     1128      +44     
- Misses        957      971      +14     
- Partials      513      537      +24     
Impacted Files Coverage Δ
app/driver.f90 0.00% <0.00%> (ø)
src/dftd4/api.f90 45.14% <12.50%> (-1.07%) ⬇️
test/unit/test_model.f90 55.72% <57.14%> (-0.19%) ⬇️
src/dftd4/model.f90 69.19% <64.22%> (-5.62%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Copy Markdown
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handle best goes first or last in the argument list. Also, can we avoid breaking the Fortran API by providing a compatibility subroutine with the old signature?

@marvinfriede
Copy link
Copy Markdown
Member Author

marvinfriede commented Feb 5, 2023

Also, can we avoid breaking the Fortran API by providing a compatibility subroutine with the old signature?

Would it then be better to check before calling new_d4_model (here) to avoid this?

However, this would not cover the error check for the reference charge option. I could change the error to an info.

if (ref_charge == d4_ref%gfn2) then
  do isp = 1, mol%nid
      izp = mol%num(isp)
      call set_refq_gfn2(self%q(:, isp), izp)
      call set_refalpha_gfn2(self%aiw(:, :, isp), self%ga, self%gc, izp)
  end do
else
  if (ref_charge /= d4_ref%eeq) then
      write(output_unit, '(a)') "[Info] Unsupported option for reference charges. Defaulting to EEQ charges."
  end if
  do isp = 1, mol%nid
      izp = mol%num(isp)
      call set_refq_eeq(self%q(:, isp), izp)
      call set_refalpha_eeq(self%aiw(:, :, isp), self%ga, self%gc, izp)
  end do
end if

@marvinfriede
Copy link
Copy Markdown
Member Author

marvinfriede commented Feb 19, 2023

Since I think that the check should be within new_d4_model, I created an interface for this routine, which avoids breaking the API and supports both versions.

I also added the info from the above comment to the old version.

@marvinfriede marvinfriede requested a review from awvwgk February 22, 2023 21:32
Copy link
Copy Markdown
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, one minor comment regarding the dllexport, but I'm no expert there.

@marvinfriede marvinfriede merged commit c31218f into dftd4:main Feb 23, 2023
@marvinfriede marvinfriede deleted the exit-unsupported-elements branch February 23, 2023 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gradients only available up to Rn?

3 participants