Merge lp:~nickpapior/siesta/4.1-scf-first into lp:siesta

Proposed by Nick Papior
Status: Superseded
Proposed branch: lp:~nickpapior/siesta/4.1-scf-first
Merge into: lp:siesta
Diff against target: 135 lines (+37/-10) (has conflicts)
2 files modified
Src/m_new_dm.F90 (+33/-10)
version.info (+4/-0)
Text conflict in version.info
To merge this branch: bzr merge lp:~nickpapior/siesta/4.1-scf-first
Reviewer Review Type Date Requested Status
Alberto Garcia Pending
Review via email: mp+370710@code.launchpad.net

This proposal has been superseded by a proposal from 2019-07-29.

Commit message

Fixing SCF-first for re-reading DM files

Previously one could not restart and perform mixing for the
first SCF step. This helps for big systems when needing restart
effects.

In some cases (for really large systems) it *could* be advantegeous
to also allow mixing in the first SCF step since any perturbation
cause huge dDmax/dHmax. In those cases we probably need some kind
of handler to allow mixing first step anyhow.

  SCF.Mix.First.MD <T|F> ?

Description of the change

This is a result of https://bugs.launchpad.net/siesta/+bug/1834949 where restart is not working properly or large systems.

Initially we had disabled scf.mix.first for all simulations which did a restart. This commit fixes this in the sense that iff the sparsity pattern is exactly the same, it will allow one to do mixing in the first iteration, otherwise not.

However, this *could* potentially still be a problem for very large systems where minor displacements are present. In that case it could still be viable to do small linear mixing for a few steps using the final DM from a different geometry.
Perhaps we need to introduce a new keyword (see above).

To post a comment you must log in.
lp:~nickpapior/siesta/4.1-scf-first updated
1085. By Nick Papior

Added SCF.Mix.First.Force to overrule siesta heuristics

Now the user can decide to *always* override the Siesta heuristics
regarding mixing the first SCF step. This may be useful for very large
systems.

Added a print-out to users regarding this forced behaviour when
the heuristic would have chosen another method.

1086. By Alberto Garcia

Longer explanation in manual. Change in warning

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Src/m_new_dm.F90'
2--- Src/m_new_dm.F90 2018-11-23 10:32:56 +0000
3+++ Src/m_new_dm.F90 2019-07-29 12:02:45 +0000
4@@ -79,6 +79,16 @@
5 logical :: DM_init ! Initialize density matrix from file or from atomic density
6 logical :: read_DM
7 integer :: DM_in_history, n_depth
8+
9+ ! Variable to signal how the initialization was performed.
10+ ! The following table lists the (current) possibilities:
11+ ! 0: DM is filled from atomic information (no information present)
12+ ! 1: .DM file is read, Siesta continuation
13+ ! 2: An extrapolation of previous geometries.
14+ ! The DM's from the previous coordinates are kept in memory
15+ ! 3: .TSDE file is read, TranSiesta continuation
16+ ! If the value is negative it means that one cannot mix in the
17+ ! first step, regardless of user inquiry!
18 integer :: init_method
19
20 real(dp), pointer :: DM(:,:), EDM(:,:)
21@@ -192,8 +202,8 @@
22 call print_type(DM_2D)
23 end if
24
25- ! Defines the initialiazation to be re-using
26- init_method = -1
27+ ! A negative value specifies that one cannot mix in the initial step
28+ init_method = -3
29
30 end if
31
32@@ -290,7 +300,7 @@
33
34 old_Ef = Ef
35 Ef = fdf_get('TS.Fermi.Initial',Ef,'Ry')
36- if ( init_method == 2 ) then
37+ if ( abs(init_method) == 3 ) then
38 ! As the fermi-level has been read in from a previous
39 ! calculation (TSDE), the EDM should only be shifted by the difference
40 diff_Ef = Ef - old_Ef
41@@ -301,10 +311,10 @@
42
43 if ( IONode ) then
44 write(*,*) ! new-line
45- if ( init_method < 2 ) then
46+ if ( abs(init_method) < 3 ) then
47 write(*,'(a,f9.5,a)')'transiesta: Setting the Fermi-level to: ', &
48 Ef / eV,' eV'
49- else if ( init_method == 2 ) then
50+ else if ( abs(init_method) == 3 ) then
51 write(*,'(a,2(f10.6,a))')'transiesta: Changing Fermi-level from -> to: ', &
52 old_Ef / eV,' -> ',Ef / eV, ' eV'
53 end if
54@@ -337,7 +347,9 @@
55 ! this would lead to non-degenerate transverse eigenmodes for simple molecules
56 if ( init_method == 0 ) then ! atomicly filled data
57 ! allow mix_scf_first
58- else if ( mix_scf_first ) then
59+ else if ( mix_scf_first .and. init_method < 0 ) then
60+ ! Do not allow mixing first SCF step since we are reusing a DM
61+ ! from another geometry.
62 mix_scf_first = .false.
63 end if
64
65@@ -385,7 +397,7 @@
66 ! integer init_method : returns method it has read the data with
67 ! 0 == atomic filling (possibly user-defined
68 ! 1 == .DM read
69- ! 2 == .TSDE read
70+ ! 3 == .TSDE read
71 ! *******************************************************************
72
73 ! The spin-configuration that is used to determine the spin-order.
74@@ -457,7 +469,7 @@
75 else
76
77 ! Print-out whether transiesta is starting, or siesta is starting
78- call ts_method_init( init_method == 2 )
79+ call ts_method_init( abs(init_method) == 3 )
80
81 end if
82
83@@ -559,7 +571,7 @@
84 ! method used to read the DM/EDM
85 ! 0 == not read
86 ! 1 == .DM read
87- ! 2 == .TSDE read
88+ ! 3 == .TSDE read
89 ! *******************************************************************
90
91 !> The spin-configuration that is used to determine the spin-order.
92@@ -592,6 +604,7 @@
93
94 ! The currently read stuff
95 type(dSpData2D) :: DM_read
96+ type(Sparsity), pointer :: sp_read
97 type(dSpData2D) :: EDM_read
98
99 ! Signal the file has not been found.
100@@ -614,7 +627,7 @@
101
102 if ( TSDE_found ) then
103 ! Signal we have read TSDE
104- init_method = 2
105+ init_method = 3
106
107 DM_found = .true.
108
109@@ -670,6 +683,16 @@
110 ! Density matrix size checks
111 if ( DM_found ) then
112
113+ ! Specify the *correct* init_method
114+ ! In cases where the sparsity pattern changes, we assume this has to do with
115+ ! MD simulations and thus a geometry change.
116+ ! By default we do not allow mixing the first step when re-using a DM from another
117+ ! geometry. This is because of idempotency.
118+ sp_read => spar(DM_read)
119+ if ( .not. equivalent(sp, sp_read) ) then
120+ init_method = -init_method
121+ end if
122+
123 corrected_nsc = .false.
124 if ( nsc_read(1) /= 0 .and. any(nsc /= nsc_read) ) then
125
126
127=== modified file 'version.info'
128--- version.info 2019-06-27 10:51:17 +0000
129+++ version.info 2019-07-29 12:02:45 +0000
130@@ -1,1 +1,5 @@
131+<<<<<<< TREE
132 trunk-766
133+=======
134+siesta-4.1-1083--scf-first-1
135+>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches