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
=== modified file 'Docs/siesta.tex'
--- Docs/siesta.tex 2018-06-19 11:00:00 +0000
+++ Docs/siesta.tex 2018-06-25 12:35:49 +0000
@@ -5762,7 +5762,6 @@
5762 5762
5763\begin{fdflogicalF}{ForceAuxCell}5763\begin{fdflogicalF}{ForceAuxCell}
57645764
5765
5766If \fdftrue, the program uses an auxiliary cell even for gamma-point-only5765If \fdftrue, the program uses an auxiliary cell even for gamma-point-only
5767calculations. This might be needed for COOP/COHP calculations, as5766calculations. This might be needed for COOP/COHP calculations, as
5768noted above, \index{COOP/COHP curves!Folding in Gamma-point5767noted above, \index{COOP/COHP curves!Folding in Gamma-point
@@ -5781,6 +5780,32 @@
57815780
5782\end{fdflogicalF}5781\end{fdflogicalF}
57835782
5783\begin{fdfentry}{NaiveAuxiliaryCell}[logical]<\fdfvalue{MD.TypeOfRun}>
5784
5785 The auxiliary supercell is determined using the atomic positions,
5786 the orbital extend and the lattice parameters. For a fixed geometry
5787 configuration the auxiliary supercell is uniquely defined. However,
5788 when performing MD simulations (or relaxations) the displacement of
5789 certain atoms may result in another required auxiliary supercell. In
5790 those cases \siesta\ will currently crash unless this option is
5791 \fdftrue. When this is \fdftrue\ the used supercell will always be
5792 maximized based on the orbital extend (fixed for \emph{any}
5793 calculation) and the lattice vectors (depends on
5794 \fdf{MD.VariableCell}).
5795
5796 By default this will be \fdffalse\ when performing
5797 \fdf{MD.TypeOfRun:CG} with \fdf{MD.NumCGsteps:1} or below. Otherwise
5798 this will default to \fdftrue.
5799
5800 \note one may try to set this to \fdffalse\ for better performance,
5801 however at the risk of \siesta\ crashing after each MD step.
5802
5803 \note this option may made obsolete in later versions when a
5804 supercell conversion routine is in place.
5805
5806\end{fdfentry}
5807
5808
57845809
5785\subsection{Calculation of the electronic structure}5810\subsection{Calculation of the electronic structure}
57865811
57875812
=== modified file 'Src/read_options.F90'
--- Src/read_options.F90 2018-05-15 09:48:18 +0000
+++ Src/read_options.F90 2018-06-25 12:35:49 +0000
@@ -97,6 +97,8 @@
97 ! 6 = Force constants97 ! 6 = Force constants
98 ! 7 = Deprecated (Forces for PHONON program)98 ! 7 = Deprecated (Forces for PHONON program)
99 ! 8 = Force evaluation99 ! 8 = Force evaluation
100 ! 9 = Explicit set of coordinates
101 ! 10 = Lua controlled dynamics
100 ! integer istart : Initial time step for MD102 ! integer istart : Initial time step for MD
101 ! integer ifinal : Final time step for MD103 ! integer ifinal : Final time step for MD
102 ! integer nmove : Number of CG steps in CG optimization104 ! integer nmove : Number of CG steps in CG optimization
@@ -1579,6 +1581,14 @@
1579 end select1581 end select
1580 end if1582 end if
15811583
1584
1585 ! Default variable depending on the action required
1586 if ( idyn == 0 .and. nmove <= 1 ) then
1587 naive_aux_cell = fdf_get( 'NaiveAuxiliaryCell', .false. )
1588 else
1589 naive_aux_cell = fdf_get( 'NaiveAuxiliaryCell', .true. )
1590 end if
1591
1582 writec = fdf_get( 'WriteCoorStep', outlng )1592 writec = fdf_get( 'WriteCoorStep', outlng )
1583 savehs = fdf_get( 'SaveHS', .false. )1593 savehs = fdf_get( 'SaveHS', .false. )
1584 initdmaux = fdf_get( 'ReInitialiseDM', .TRUE. )1594 initdmaux = fdf_get( 'ReInitialiseDM', .TRUE. )
15851595
=== modified file 'Src/siesta_init.F'
--- Src/siesta_init.F 2018-06-07 20:08:23 +0000
+++ Src/siesta_init.F 2018-06-25 12:35:49 +0000
@@ -609,16 +609,17 @@
609! Find required supercell609! Find required supercell
610! 2*rmaxh is used to guarantee that two given orbitals in the610! 2*rmaxh is used to guarantee that two given orbitals in the
611! supercell can only overlap once611! supercell can only overlap once
612 if (gamma) then612 if ( gamma ) then
613 nsc(1:3) = 1613 nsc(1:3) = 1
614 else614 else if ( naive_aux_cell ) then
615 ! Discussion with Jose-Soler we get this size ! NPA615 ! The auxiliary supercell is symmetric in the connections,
616 ! hence we need a factor of 2.
616 do i = 1 , 3617 do i = 1 , 3
617 veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)618 veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)
618 nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )619 nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )
619 end do620 end do
620 ! The above is kept for historical reasons,621 else
621 ! but a tight supercell can be found from the atom-graph info:622 ! Determine the actual required number of supercells
622 call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)623 call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)
623 end if624 end if
624625
625626
=== modified file 'Src/siesta_options.F90'
--- Src/siesta_options.F90 2018-05-15 09:48:18 +0000
+++ Src/siesta_options.F90 2018-06-25 12:35:49 +0000
@@ -181,6 +181,9 @@
181 integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM181 integer :: call_diagon_default ! Default number of SCF steps for which to use diagonalization before OMM
182 integer :: call_diagon_first_step ! Number of SCF steps for which to use diagonalization before OMM (first MD step)182 integer :: call_diagon_first_step ! Number of SCF steps for which to use diagonalization before OMM (first MD step)
183183
184 logical :: naive_aux_cell ! Control whether the auxiliary superc-cell will always be the maximal allowed cell size
185 ! This will default to true for MD, FC and Lua controlled calculations since atoms may move
186
184 real(dp) :: beta ! Inverse temperature for Chebishev expansion.187 real(dp) :: beta ! Inverse temperature for Chebishev expansion.
185 real(dp) :: bulkm ! Bulk modulus188 real(dp) :: bulkm ! Bulk modulus
186 real(dp) :: charnet ! Net electric charge189 real(dp) :: charnet ! Net electric charge
187190
=== modified file 'Src/state_init.F'
--- Src/state_init.F 2018-05-15 09:48:18 +0000
+++ Src/state_init.F 2018-06-25 12:35:49 +0000
@@ -258,16 +258,16 @@
258 & 'state_init' )258 & 'state_init' )
259259
260! Find required supercell260! Find required supercell
261 if (gamma) then261 if ( gamma ) then
262 nsc(1:3) = 1262 nsc(1:3) = 1
263 else if ( naive_aux_cell ) then
264 do i = 1 , 3
265 veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)
266 nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )
267 end do
263 else268 else
264 do i = 1 , 3269 ! Determine the actual required number of supercells
265 veclen = sqrt(ucell(1,i)**2+ucell(2,i)**2+ucell(3,i)**2)270 call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)
266 nsc(i) = 1 + 2 * ceiling( rmaxh / veclen )
267 end do
268 ! The above is kept for historical reasons,
269 ! but a tight supercell can be found from the atom-graph info:
270 call exact_sc_ag(negl,ucell,na_u,isa,xa,nsc)
271 endif271 endif
272272
273 mscell = 0.0_dp273 mscell = 0.0_dp
274274
=== modified file 'version.info'
--- version.info 2018-06-19 11:00:00 +0000
+++ version.info 2018-06-25 12:35:49 +0000
@@ -1,1 +1,1 @@
1siesta-4.1--9331siesta-4.1--933--naive-aux-cell-1

Subscribers

People subscribed via source and target branches