Skip to content

Commit

Permalink
Enforce SCC when hybrid functionals (dftbplus#1571)
Browse files Browse the repository at this point in the history
* Only parse for SCC keyword if not a hybrid DFTB calculation
* Remove SCC keyword from parser when hybrid for parser 14 onwards
  (updating affected v14 tests)
* Trap for non-SCC when invoking hybrid functionals
  • Loading branch information
bhourahine authored Dec 3, 2024
1 parent e445eec commit d065164
Show file tree
Hide file tree
Showing 50 changed files with 24 additions and 54 deletions.
9 changes: 6 additions & 3 deletions doc/dftb+/manual/dftbp.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1411,8 +1411,9 @@ \subsection{Density Functional based Tight Binding}

\begin{description}
\item[\is{SCC}] If set to \is{Yes}, a self consistent charge (SCC)
calculation is made.

calculation is made. {\bf Note:} this keyword is not read for hybrid
calculations (\pref{sec:dftbp.Hybrid}), as these are {\em always}
SCC.
\item[\is{SCCTolerance}] Stopping criteria for the SCC. Specifies the
tolerance for the maximum difference in any charge between two SCC
cycles.
Expand Down Expand Up @@ -4553,7 +4554,9 @@ \subsubsection{DFTB3-D3H5}
\subsection{Hybrid}
\label{sec:dftbp.Hybrid}

The \kw{Hybrid} keyword specifies the use of a (range-separated) hybrid functional.
The \kw{Hybrid} keyword specifies the use of a (range-separated)
hybrid functional. This model automatically enforces self-consistent
(SCC) calculations, so does not use the \kw{SCC} keyword in its input.
For the non-periodic formalism we refer to
Refs.~\cite{niehaus-PSSB-249-237,lutsker-JCP-143-184107}, whereas the formalism for
periodic boundary conditions is developed in Ref.~\cite{vdH-PRM-7-063802}.
Expand Down
1 change: 1 addition & 0 deletions src/dftbp/dftbplus/initprogram.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@ subroutine initProgramVariables(this, input, env)
this%isElecDyn = allocated(input%ctrl%elecDynInp)
this%isLinResp = allocated(input%ctrl%lrespini)
this%isHybridXc = allocated(input%ctrl%hybridXcInp)
if (this%isHybridXc .and. .not. this%tSccCalc) call error("Hybrid calculations must be SCC")
if (this%isHybridXc) then
this%hybridXcAlg = input%ctrl%hybridXcInp%hybridXcAlg
this%checkStopHybridCalc = input%ctrl%checkStopHybridCalc
Expand Down
10 changes: 9 additions & 1 deletion src/dftbp/dftbplus/oldcompat.F90
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ subroutine convert_13_14(root)
!> Root tag of the HSD-tree
type(fnode), pointer :: root

type(fnode), pointer :: ch1
type(fnode), pointer :: ch1, ch2, par, dummy

call getDescendant(root, "Analysis/CalculateForces", ch1)
if (associated(ch1)) then
Expand All @@ -855,6 +855,14 @@ subroutine convert_13_14(root)
call setNodeName(ch1, "Hybrid")
end if

call getDescendant(root, "Hamiltonian/DFTB/Hybrid", ch1)
if (associated(ch1)) then
call detailedWarning(ch1, "'Hamiltonian/DFTB/SCC' keyword removed as hybrid calculations are&
& always SCC.")
call getDescendant(root, "Hamiltonian/DFTB/SCC", ch2, parent=par)
dummy => removeChild(par, ch2)
end if

end subroutine convert_13_14


Expand Down
12 changes: 8 additions & 4 deletions src/dftbp/dftbplus/parser.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,14 @@ subroutine readDFTBHam(node, ctrl, geo, slako, poisson, errStatus)

call parseChimes(node, ctrl%chimesRepInput)

! SCC
call getChildValue(node, "SCC", ctrl%tSCC, .false.)
call parseHybridBlock(node, ctrl%hybridXcInp, geo, skFiles)

if (allocated(ctrl%hybridXcInp)) then
ctrl%tSCC = .true.
else
! SCC
call getChildValue(node, "SCC", ctrl%tSCC, .false.)
end if

if (ctrl%tSCC) then
call getChildValue(node, "ShellResolvedSCC", ctrl%tShellResolved, .false.)
Expand All @@ -1476,8 +1482,6 @@ subroutine readDFTBHam(node, ctrl, geo, slako, poisson, errStatus)
skInterMeth = skEqGridNew
end if

call parseHybridBlock(node, ctrl%hybridXcInp, geo, skFiles)

if (.not. allocated(ctrl%hybridXcInp)) then
call getChild(node, "TruncateSKRange", child, requested=.false.)
if (associated(child)) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1e-08

Charge = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1e-12

Charge = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1.0e-10

Mixer = Broyden {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 50
SccTolerance = 1e-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 1
ReadInitialCharges = Yes
SccTolerance = 1e-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 50
SccTolerance = 1e-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 1
ReadInitialCharges = Yes
SccTolerance = 1e-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 50
SccTolerance = 1e-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 1
ReadInitialCharges = Yes
SccTolerance = 1e-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-08

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
ConvergentSCCOnly = No
ReadInitialCharges = Yes
MaxSccIterations = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
MaxSccIterations = 60

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
ReadInitialCharges = Yes
MaxSccIterations = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
MaxSccIterations = 60

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-12
ReadInitialCharges = Yes
MaxSccIterations = 7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
MaxSccIterations = 60

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
ReadInitialCharges = Yes
MaxSccIterations = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-08

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
ConvergentSCCOnly = No
ReadInitialCharges = Yes
MaxSccIterations = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
MaxSccIterations = 50

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
ReadInitialCharges = Yes
MaxSccIterations = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
MaxSccIterations = 50

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SccTolerance = 1e-10
ReadInitialCharges = Yes
MaxSccIterations = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1e-08

Charge = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1e-10

Charge = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1e-12

Charge = 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
SCCTolerance = 1e-12

Charge = 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-09

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = GenFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-09

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = VaspFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-08

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = VaspFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 100
SccTolerance = 1e-08

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Geometry = VaspFormat {

Hamiltonian = DFTB {

SCC = Yes
MaxSccIterations = 50
SccTolerance = 1e-08

Expand Down
Loading

0 comments on commit d065164

Please sign in to comment.