Skip to content

Commit

Permalink
Remove blocking of constraints with transport
Browse files Browse the repository at this point in the history
Add test case for open boundary + constraints
  • Loading branch information
bhourahine committed Nov 9, 2024
1 parent 00b31fb commit 919909d
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 7 deletions.
12 changes: 8 additions & 4 deletions doc/dftb+/manual/dftbp.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ \subsection{Extended Tight Binding Hamiltonian}

\subsection{ElectronicConstraints}
\label{sec:dftbp.ElectronicConstraints}
Allows to impose constraints on the electronic ground state by finding
Allows imposition of constraints on the electronic ground state by finding
the ground state of the system in a (carefully chosen) external
potential~\cite{Hourahine2010}.

Expand Down Expand Up @@ -1903,9 +1903,13 @@ \subsection{ElectronicConstraints}
\item[\iscb{LBFGS}] Propagate micro-iterations using the LBFGS
algorithm. See p.~\pref{sec:dftbp.Optimiser.LBFGS}.
\end{description}
Please note, that the \kw{SteepestDescent\cb} and \kw{FIRE\cb} optimiser proved to be most
stable, when propagating the micro-iterations. However, your experience may vary and
manual testing based on your particular system is advised.
Please note, that the \kw{SteepestDescent\cb} and \kw{FIRE\cb}
optimiser proved to be most stable, when propagating the
micro-iterations. However, your experience may vary and manual
testing based on your particular system is advised.\footnote{For
transport calculations, section~\ref{app:transp}, gradient-only
optimizers, i.e., \kw{SteepestDescent\cb} and \kw{FIRE\cb} are to be
preferred.}

\item[\is{ConstrTolerance}] Stopping criteria for the micro-iterations.
Specifies the tolerance for the maximum difference in any condition of
Expand Down
3 changes: 0 additions & 3 deletions src/dftbp/dftbplus/initprogram.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2110,9 +2110,6 @@ subroutine initProgramVariables(this, input, env)
if (this%isHybridXc) then
call error("Range separated calculations do not yet work with transport calculations")
end if
if (this%isElecConstr) then
call error("Constrained DFTB calculations do not yet support electron transport.")
end if
end if
#:endif

Expand Down
33 changes: 33 additions & 0 deletions test/app/dftb+/elecconstraints/H-chain_transport/30h.gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
31 C
H
20 1 13.0000 0.000000 0.000000
21 1 14.00000 0.000000 0.000000
22 1 15.0000 0.000000 0.000000
23 1 16.0000 0.000000 0.000000
24 1 17.0000 0.000000 0.000000
25 1 18.0000 0.000000 0.000000
26 1 19.00000 0.000000 0.000000
27 1 20.0000 0.000000 0.000000
28 1 21.0000 0.000000 0.000000
29 1 22.0000 0.000000 0.000000
30 1 23.0000 0.000000 0.000000
31 1 24.0000 0.000000 0.000000
32 1 25.0000 0.000000 0.000000
33 1 26.0000 0.000000 0.000000
34 1 27.0000 0.000000 0.000000
35 1 28.0000 0.000000 0.000000
36 1 29.00000 0.000000 0.000000
37 1 30.0000 0.000000 0.000000
38 1 31.0000 0.000000 0.000000
39 1 32.0000 0.000000 0.000000
40 1 33.0000 0.000000 0.000000
19 1 12.0000 0.000000 0.000000
18 1 11.0000 0.000000 0.000000
17 1 10.0000 0.000000 0.000000
16 1 9.00000 0.000000 0.000000
15 1 8.0000 0.000000 0.000000
14 1 7.0000 0.000000 0.000000
13 1 6.0000 0.000000 0.000000
12 1 5.0000 0.000000 0.000000
11 1 4.00000 0.000000 0.000000
10 1 3.00000 0.000000 0.000000
50 changes: 50 additions & 0 deletions test/app/dftb+/elecconstraints/H-chain_transport/_autotest.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
orbital_charges :real:2:1,31
0.106970613494445E+001 0.982767767519546E+000 0.107096873653657E+001
0.948070923038914E+000 0.120442246666626E+001 0.499991859788723E+000
0.123351691065948E+001 0.938715997954630E+000 0.106811595346809E+001
0.955290631674371E+000 0.102843255893214E+001 0.100000000011919E+001
0.999999999880814E+000 0.100000000011919E+001 0.999999999880813E+000
0.100000000011919E+001 0.999999999880813E+000 0.100000000011919E+001
0.999999999880814E+000 0.100000000011919E+001 0.999999999880814E+000
0.999999999965735E+000 0.100000000003426E+001 0.999999999965735E+000
0.100000000003426E+001 0.999999999965735E+000 0.100000000003426E+001
0.999999999965736E+000 0.100000000003426E+001 0.999999999965735E+000
0.100000000003426E+001
total_energy :real:0:
-0.584437823730094E+001
end_coords :real:2:3,31
0.245664378515260E+002 0.000000000000000E+000 0.000000000000000E+000
0.264561638401049E+002 0.000000000000000E+000 0.000000000000000E+000
0.283458898286838E+002 0.000000000000000E+000 0.000000000000000E+000
0.302356158172628E+002 0.000000000000000E+000 0.000000000000000E+000
0.321253418058417E+002 0.000000000000000E+000 0.000000000000000E+000
0.340150677944206E+002 0.000000000000000E+000 0.000000000000000E+000
0.359047937829995E+002 0.000000000000000E+000 0.000000000000000E+000
0.377945197715785E+002 0.000000000000000E+000 0.000000000000000E+000
0.396842457601574E+002 0.000000000000000E+000 0.000000000000000E+000
0.415739717487363E+002 0.000000000000000E+000 0.000000000000000E+000
0.434636977373152E+002 0.000000000000000E+000 0.000000000000000E+000
0.453534237258942E+002 0.000000000000000E+000 0.000000000000000E+000
0.472431497144731E+002 0.000000000000000E+000 0.000000000000000E+000
0.491328757030520E+002 0.000000000000000E+000 0.000000000000000E+000
0.510226016916309E+002 0.000000000000000E+000 0.000000000000000E+000
0.529123276802098E+002 0.000000000000000E+000 0.000000000000000E+000
0.548020536687888E+002 0.000000000000000E+000 0.000000000000000E+000
0.566917796573677E+002 0.000000000000000E+000 0.000000000000000E+000
0.585815056459466E+002 0.000000000000000E+000 0.000000000000000E+000
0.604712316345255E+002 0.000000000000000E+000 0.000000000000000E+000
0.623609576231045E+002 0.000000000000000E+000 0.000000000000000E+000
0.226767118629471E+002 0.000000000000000E+000 0.000000000000000E+000
0.207869858743682E+002 0.000000000000000E+000 0.000000000000000E+000
0.188972598857892E+002 0.000000000000000E+000 0.000000000000000E+000
0.170075338972103E+002 0.000000000000000E+000 0.000000000000000E+000
0.151178079086314E+002 0.000000000000000E+000 0.000000000000000E+000
0.132280819200525E+002 0.000000000000000E+000 0.000000000000000E+000
0.113383559314735E+002 0.000000000000000E+000 0.000000000000000E+000
0.944862994289462E+001 0.000000000000000E+000 0.000000000000000E+000
0.755890395431569E+001 0.000000000000000E+000 0.000000000000000E+000
0.566917796573677E+001 0.000000000000000E+000 0.000000000000000E+000
dipole_moments :real:2:3,1
0.594226675693738E+000 0.000000000000000E+000 0.000000000000000E+000
scaled_dipole :real:2:3,1
0.594226675693738E+000 0.000000000000000E+000 0.000000000000000E+000
88 changes: 88 additions & 0 deletions test/app/dftb+/elecconstraints/H-chain_transport/dftb_in.hsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
geometry = genformat {
<<< "30h.gen"
}

Transport {
Device {
AtomRange = 1 11
}
Contact {
Id = "Source"
AtomRange = 12 21
FermiLevel [eV] = -6.4926472360850
Potential [eV] = 0.0
}
Contact {
Id = "Drain"
AtomRange = 22 31
FermiLevel [eV] = -6.4926472360850
Potential [eV] = 2.0
}
ReadBinaryContact = No
}

Hamiltonian = Dftb {
Scc = yes
SccTolerance = 1E-6
MaxAngularMomentum = {
H = s
}

Electrostatics = Poisson {
Poissonbox [Angstrom] = 20.0 20.0 20.0
MinimalGrid [Angstrom] = 0.4 0.4 0.4
AtomDensityCutoff [Angstrom] = 7.05
CutoffCheck = No
SavePotential = Yes
PoissonAccuracy = 1e-5
BuildBulkPotential = Yes
}

SlaterKosterFiles = {
Prefix = {slakos/origin/transtest/}
H-H = "H-H-noS.skf"
}

Solver = GreensFunction{
Verbosity = 51
RealAxisPoints = 100
EnclosedPoles = 3
}

ElectronicConstraints {
Regions {
Atoms {
Domain = 6
Population = 0.5
}
Atoms {
Domain = 1:11
Population = 11
}
}
MaxConstrIterations = 10
ConstrTolerance = 1.0E-5
}
}

Analysis{
TunnelingAndDOS{
EnergyRange [eV] = -0.0 0.0
EnergyStep [eV] = 0.02
}
}

Parallel = {
Blacs{BlockSize = 4}
# Allow OMP threads explicitely to test for hybrid parallelisation with
# MPI-binary. (Check the manual before using this in production runs!)
UseOmpThreads = Yes
}

Options = {
WriteAutotesttag = yes
}

ParserOptions = {
ParserVersion = 14
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
10 1 1 1
1 1 1 1 1 1
1 1 1 1
0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000
0.999999999965735 1.00000000003426 0.999999999965735
1.00000000003426 0.999999999965735 1.00000000003426
0.999999999965736 1.00000000003426 0.999999999965735
1.00000000003426
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
10 1 1 1
1 1 1 1 1 1
1 1 1 1
0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000 0.000000000000000E+000 0.000000000000000E+000
0.000000000000000E+000
1.00000000011919 0.999999999880814 1.00000000011919
0.999999999880813 1.00000000011919 0.999999999880813
1.00000000011919 0.999999999880814 1.00000000011919
0.999999999880814
1 change: 1 addition & 0 deletions test/app/dftb+/tests
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ elecconstraints/H2O_scc #? MPI_PROCS <= 1
elecconstraints/H2O_gfn1 #? WITH_TBLITE and MPI_PROCS <= 1
elecconstraints/H2O_non-converged #? MPI_PROCS <= 1
elecconstraints/Si8_spin #? MPI_PROCS <= 1
elecconstraints/H-chain_transport #? WITH_TRANSPORT and MPI_PROCS <= 4

chimes/CNOH #? WITH_CHIMES and MPI_PROCS <= 1

Expand Down

0 comments on commit 919909d

Please sign in to comment.