Merge lp:~nickpapior/siesta/4.1-naive-aux-cell into lp:siesta/4.1

Proposed by Nick Papior
Status: Merged
Merged at revision: 934
Proposed branch: lp:~nickpapior/siesta/4.1-naive-aux-cell
Merge into: lp:siesta/4.1
Diff against target: 149 lines (+54/-15)
6 files modified
Docs/siesta.tex (+26/-1)
Src/read_options.F90 (+10/-0)
Src/siesta_init.F (+6/-5)
Src/siesta_options.F90 (+3/-0)
Src/state_init.F (+8/-8)
version.info (+1/-1)
To merge this branch: bzr merge lp:~nickpapior/siesta/4.1-naive-aux-cell
Reviewer Review Type Date Requested Status
Alberto Garcia Pending
Review via email: mp+348464@code.launchpad.net

Commit message

Reimplemented the NaiveAuxiliaryCell option

And further enhanced it by forcing the aux-cell size to
be the largest one for anything but single-shot calculations.

This does not fix *all* cases of error handling since when performing
variable cell calculations the auxiliary cell may again change.

One solution could be if naive aux-cell is used then the aux-cell is
forced to be the same for cell_can_change calculations?

Description of the change

This reimplements the NaiveAuxiliaryCell option which forces the auxiliary cell to be constant.

However, I would like to get your opinion (Alberto) on the cell_can_change comment above?

To post a comment you must log in.
Revision history for this message
Alberto Garcia (albertog) wrote :

It seems that there are two types of "errors" that can appear:

1. A supercell is not big enough. This causes a crash in 'hsparse', and should be avoided at all costs.

2. The supercell for the new geometry is different (because of cell changes), and thus the DM cannot be reused safely. In this case we could just skip the reuse of the DM for this particular instance.
Hopefully the number of times that this happens is limited, as changes will tend to become smaller and smaller (?).

Now, I believe it is true that the "naive-aux-cell" algorithm gives a safe auxcell for a given unit cell, isn't it? Note that to be completely sure we can run *always* the tight graph algorithm, but I do not think it is necessary.

Then we can leave the code as it is, recomputing nsc at each geometry, but checking whether nscold /= nsc, and in that case forbid the reuse of the DM.

Revision history for this message
Nick Papior (nickpapior) wrote :

1) Yes, that error will (should) only happen in MD simulations when the lattice parameters reduces during the optimization (as far as I know).

2) By looking at m_new_dm I think this is already the case. The DM gets re-initialized if the supercell changes. If so the DM history is reset, and the DM gets atomicly initialized.

Yes, the Naive-aux-cell gives the safest auxiliary cell with a minimum of 3x3x3 because it does not take into account actual atomic positions. This is rather unfortunate but will be handled once we have a DM(nsc) -> DM(nsc') routine.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Docs/siesta.tex'
2--- Docs/siesta.tex 2018-06-19 11:00:00 +0000
3+++ Docs/siesta.tex 2018-06-25 12:35:49 +0000
4@@ -5762,7 +5762,6 @@
5
6 \begin{fdflogicalF}{ForceAuxCell}
7
8-
9 If \fdftrue, the program uses an auxiliary cell even for gamma-point-only
10 calculations. This might be needed for COOP/COHP calculations, as
11 noted above, \index{COOP/COHP curves!Folding in Gamma-point
12@@ -5781,6 +5780,32 @@
13
14 \end{fdflogicalF}
15
16+\begin{fdfentry}{NaiveAuxiliaryCell}[logical]<\fdfvalue{MD.TypeOfRun}>
17+
18+ The auxiliary supercell is determined using the atomic positions,
19+ the orbital extend and the lattice parameters. For a fixed geometry
20+ configuration the auxiliary supercell is uniquely defined. However,
21+ when performing MD simulations (or relaxations) the displacement of
22+ certain atoms may result in another required auxiliary supercell. In
23+ those cases \siesta\ will currently crash unless this option is
24+ \fdftrue. When this is \fdftrue\ the used supercell will always be
25+ maximized based on the orbital extend (fixed for \emph{any}
26+ calculation) and the lattice vectors (depends on
27+ \fdf{MD.VariableCell}).
28+
29+ By default this will be \fdffalse\ when performing
30+ \fdf{MD.TypeOfRun:CG} with \fdf{MD.NumCGsteps:1} or below. Otherwise
31+ this will default to \fdftrue.
32+
33+ \note one may try to set this to \fdffalse\ for better performance,
34+ however at the risk of \siesta\ crashing after each MD step.
35+
36+ \note this option may made obsolete in later versions when a
37+ supercell conversion routine is in place.
38+
39+\end{fdfentry}
40+
41+
42
43 \subsection{Calculation of the electronic structure}
44
45
46=== modified file 'Src/read_options.F90'
47--- Src/read_options.F90 2018-05-15 09:48:18 +0000
48+++ Src/read_options.F90 2018-06-25 12:35:49 +0000
49@@ -97,6 +97,8 @@
50 ! 6 = Force constants
51 ! 7 = Deprecated (Forces for PHONON program)
52 ! 8 = Force evaluation
53+ ! 9 = Explicit set of coordinates
54+ ! 10 = Lua controlled dynamics
55 ! integer istart : Initial time step for MD
56 ! integer ifinal : Final time step for MD
57 ! integer nmove : Number of CG steps in CG optimization
58@@ -1579,6 +1581,14 @@
59 end select
60 end if
61
62+
63+ ! Default variable depending on the action required
64+ if ( idyn == 0 .and. nmove <= 1 ) then
65+ naive_aux_cell = fdf_get( 'NaiveAuxiliaryCell', .false. )
66+ else
67+ naive_aux_cell = fdf_get( 'NaiveAuxiliaryCell', .true. )
68+ end if
69+
70 writec = fdf_get( 'WriteCoorStep', outlng )
71 savehs = fdf_get( 'SaveHS', .false. )
72 initdmaux = fdf_get( 'ReInitialiseDM', .TRUE. )
73
74=== modified file 'Src/siesta_init.F'
75--- Src/siesta_init.F 2018-06-07 20:08:23 +0000
76+++ Src/siesta_init.F 2018-06-25 12:35:49 +0000
77@@ -609,16 +609,17 @@
78 ! Find required supercell
79 ! 2*rmaxh is used to guarantee that two given orbitals in the
80 ! supercell can only overlap once
81- if (gamma) then
82+ if ( gamma ) then
83 nsc(1:3) = 1
84- else
85- ! Discussion with Jose-Soler we get this size ! NPA
86+ else if ( naive_aux_cell ) then
87+ ! The auxiliary supercell is symmetric in the connections,
88+ ! hence we need a factor of 2.
89 do i = 1 , 3
90 veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)
91 nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )
92 end do
93- ! The above is kept for historical reasons,
94- ! but a tight supercell can be found from the atom-graph info:
95+ else
96+ ! Determine the actual required number of supercells
97 call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)
98 end if
99
100
101=== modified file 'Src/siesta_options.F90'
102--- Src/siesta_options.F90 2018-05-15 09:48:18 +0000
103+++ Src/siesta_options.F90 2018-06-25 12:35:49 +0000
104@@ -181,6 +181,9 @@
105 integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM
106 integer :: call_diagon_first_step ! Number of SCF steps for which to use diagonalization before OMM (first MD step)
107
108+ logical :: naive_aux_cell ! Control whether the auxiliary superc-cell will always be the maximal allowed cell size
109+ ! This will default to true for MD, FC and Lua controlled calculations since atoms may move
110+
111 real(dp) :: beta ! Inverse temperature for Chebishev expansion.
112 real(dp) :: bulkm ! Bulk modulus
113 real(dp) :: charnet ! Net electric charge
114
115=== modified file 'Src/state_init.F'
116--- Src/state_init.F 2018-05-15 09:48:18 +0000
117+++ Src/state_init.F 2018-06-25 12:35:49 +0000
118@@ -258,16 +258,16 @@
119 & 'state_init' )
120
121 ! Find required supercell
122- if (gamma) then
123+ if ( gamma ) then
124 nsc(1:3) = 1
125+ else if ( naive_aux_cell ) then
126+ do i = 1 , 3
127+ veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)
128+ nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )
129+ end do
130 else
131- do i = 1 , 3
132- veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)
133- nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )
134- end do
135- ! The above is kept for historical reasons,
136- ! but a tight supercell can be found from the atom-graph info:
137- call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)
138+ ! Determine the actual required number of supercells
139+ call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)
140 endif
141
142 mscell = 0.0_dp
143
144=== modified file 'version.info'
145--- version.info 2018-06-19 11:00:00 +0000
146+++ version.info 2018-06-25 12:35:49 +0000
147@@ -1,1 +1,1 @@
148-siesta-4.1--933
149+siesta-4.1--933--naive-aux-cell-1

Subscribers

People subscribed via source and target branches