Merge lp:~nickpapior/siesta/4.0-nrtab into lp:siesta/4.0

Proposed by Nick Papior
Status: Merged
Merged at revision: 560
Proposed branch: lp:~nickpapior/siesta/4.0-nrtab
Merge into: lp:siesta/4.0
Diff against target: 179 lines (+51/-13)
7 files modified
Docs/compatibility.tex (+3/-5)
Docs/siesta.tex (+14/-0)
Src/Makefile (+1/-1)
Src/new_matel.F (+10/-3)
Src/read_options.F90 (+16/-2)
Src/siesta_options.F90 (+6/-1)
version.info (+1/-1)
To merge this branch: bzr merge lp:~nickpapior/siesta/4.0-nrtab
Reviewer Review Type Date Requested Status
Alberto Garcia Needs Fixing
Review via email: mp+342574@code.launchpad.net

Commit message

Enabled old NRTAB behaviour via pre-processing flags.

By specifying SIESTA__LEGACY_NRTAB one recaptures the old
NRTAB behaviour which may be used to compare against older
siesta versions.

The compatibility.tex document has been updated to reflect this.

Description of the change

I simply added what we discussed at Slack (changing the pre-processor name).

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

Please forgive me for having second (third?) thoughts about this. An increasing number of users now depend on having SIESTA installed by a third person, be it a supercomputer center's staff or some grumpy sysadmin who cannot be counted on to provide a full range of SIESTA versions with all possible preprocessing options...

Thus, those users will be most likely locked into the new default value for NRTAB, and will be unable to reproduce older results with the new version.

This problem is not restricted to this issue, of course.

I have tentatively produced a patch that will make NRTAB configurable at two levels: a "legacy" switch to reproduce old results, and a full setter for people who want to try different values (not all of them would be allowed, as NQ must be compatible with NRTAB...).

(I will attach the patch somehow)

review: Needs Fixing
lp:~nickpapior/siesta/4.0-nrtab updated
561. By Nick Papior

Implemented NRTAB compatibility as an option

This enables users to change NRTAB with fdf files
rather than recompiling siesta.

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

I have amended our discussion.

I have also documented the fdf-option.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Docs/compatibility.tex'
2--- Docs/compatibility.tex 2018-02-19 08:15:36 +0000
3+++ Docs/compatibility.tex 2018-04-05 07:11:38 +0000
4@@ -3,8 +3,8 @@
5 \usepackage[a4paper]{geometry}
6
7 \newcommand\siesta{\textsc{SIESTA}}
8-\newcommand{\opt}[1]{{\bf #1}}
9-\newcommand{\code}[1]{{\tt #1}}
10+\newcommand{\opt}[1]{\textbf{#1}}
11+\newcommand{\code}[1]{\texttt{#1}}
12
13 \title{Compatibility issues across versions}
14 \author{\siesta}
15@@ -23,9 +23,7 @@
16
17 \item[\emph{any} --- 4.0.2] %
18 Internal tabulated values. We have increased the tabulated grid quantities related to
19- orbital basis functions. This change \emph{increases} precision for Siesta. To compare
20- with prior versions of Siesta set \texttt{integer, parameter :: NRTAB = 128} in
21- \texttt{Src/new\_matel.f}.
22+ orbital basis functions. Please see \opt{Compat.Matel.NRTAB} for details.
23
24 \item[\emph{any} --- 4.0-b2] The following compatibility issues should be remarked when
25 comparing with any later version of \siesta.
26
27=== modified file 'Docs/siesta.tex'
28--- Docs/siesta.tex 2018-02-15 15:45:23 +0000
29+++ Docs/siesta.tex 2018-04-05 07:11:38 +0000
30@@ -4153,6 +4153,20 @@
31
32 See also the {\bf WriteDMHS.NetCDF} and {\bf WriteDMHS.History.NetCDF}
33 options.
34+
35+
36+\item[{\bf Compat.Matel.NRTAB}] ({\it logical}):
37+\index{Compat.Matel.NRTAB@{\bf Compat.Matel.NRTAB@}}
38+Internally the matrix element calculations are tabulated with a preset number of
39+elements. In versions 4.0.1 and prior this was default to 128. Since 4.0.2 the default
40+value has been increased to 1024 which translates to higher precision matrix element
41+calculations.
42+
43+This option is a compatibility option that enables comparison with 4.0.1 and prior
44+versions. Should \emph{only} be set to true to compare. Otherwise use the default value.
45+
46+{\it Default value:} {\tt .false.}
47+
48 \end{description}
49
50 \subsubsection{The auxiliary supercell}
51
52=== modified file 'Src/Makefile'
53--- Src/Makefile 2018-02-01 10:42:36 +0000
54+++ Src/Makefile 2018-04-05 07:11:38 +0000
55@@ -695,7 +695,7 @@
56 new_dm.o: precision.o siesta_geom.o siesta_options.o sparse_matrices.o sys.o
57 new_dm.o: units.o
58 new_matel.o: alloc.o errorf.o interpolation.o matel_registry.o parallel.o
59-new_matel.o: precision.o radfft.o spher_harm.o sys.o
60+new_matel.o: precision.o radfft.o siesta_options.o spher_harm.o sys.o
61 nlefsm.o: alloc.o atmfuncs.o mneighb.o new_matel.o parallel.o parallelsubs.o
62 nlefsm.o: precision.o
63 normalize_dm.o: atomlist.o m_mpi_utils.o m_spin.o parallel.o precision.o
64
65=== renamed file 'Src/new_matel.f' => 'Src/new_matel.F'
66--- Src/new_matel.f 2018-02-19 08:15:36 +0000
67+++ Src/new_matel.F 2018-04-05 07:11:38 +0000
68@@ -78,6 +78,7 @@
69 use spher_harm, only: reset_spher_harm
70 use sys, only: die
71 use m_radfft
72+ use siesta_options, only: matel_NRTAB
73 C -------------------------------------------------------------------
74
75 C Argument types and dimensions -------------------------------------
76@@ -98,14 +99,14 @@
77 C FFTOL is the tolerance for considering equal the radial part of
78 C two orbitals.
79 C TINY is a small number to avoid a zero denominator
80- INTEGER, PARAMETER :: NRTAB = 1024
81+ INTEGER, save :: NRTAB = 1024
82 INTEGER, PARAMETER :: NQ = 1024
83 real(dp), PARAMETER :: EXPAND = 1.20_dp
84 real(dp), PARAMETER :: Q2CUT = 2.50e3_dp
85 real(dp), PARAMETER :: GWBYDR = 1.5_dp
86 real(dp), PARAMETER :: FFTOL = 1.e-8_dp
87 real(dp), PARAMETER :: TINY = 1.e-12_dp
88- CHARACTER(LEN=*), PARAMETER :: MYNAME = 'MATEL '
89+ CHARACTER(LEN=*), PARAMETER :: MYNAME = 'MATEL'
90 C -------------------------------------------------------------------
91
92 C Internal variable types and dimensions ----------------------------
93@@ -160,6 +161,12 @@
94 CALL RE_ALLOC( INDFFY, 0,MFF, 'INDFFY', MYNAME )
95 INDFFY(0) = 0
96 NULLIFIED = .TRUE.
97+
98+! Set only at specific times. If matel_nrtab is changed the new
99+! value will not take effect unless there is a re-initialization,
100+! to avoid corruption of the tables.
101+ NRTAB = matel_NRTAB
102+
103 ENDIF
104
105 C Check if tables must be re-initialized
106@@ -214,7 +221,7 @@
107 & MAX(IOPER,3).GT.UBOUND(INDF,2) ) THEN
108 CALL RE_ALLOC( INDF, 1, MAX(UBOUND(INDF,1),IG1,IG2),
109 & 1,MAX(UBOUND(INDF,2),IOPER,3),
110- & 'INDF', MYNAME )
111+ & 'INDF', MYNAME)
112 CALL RE_ALLOC( NLM, 1,MAX(UBOUND(INDF,1),IG1,IG2),
113 & 1,MAX(UBOUND(INDF,2),IOPER,3),
114 & 'NLM', MYNAME )
115
116=== modified file 'Src/read_options.F90'
117--- Src/read_options.F90 2017-06-30 08:31:34 +0000
118+++ Src/read_options.F90 2018-04-05 07:11:38 +0000
119@@ -292,12 +292,26 @@
120 partial_charges_at_every_scf_step = &
121 fdf_get('PartialChargesAtEveryScfStep',.false.)
122
123+
124+ if ( fdf_get('Compat.Matel.NRTAB', .false.) ) then
125+ matel_NRTAB = 128
126+ else
127+ matel_NRTAB = 1024
128+ end if
129+ if ( IONode ) then
130+ write(6,4) 'redata: Matel table size (NRTAB) = ', matel_NRTAB
131+ end if
132+ if (cml_p) then
133+ call cmlAddParameter( xf=mainXML, name='MatelNRTAB',value=matel_NRTAB, &
134+ dictRef='siesta:matel_nrtab', units="cmlUnits:countable")
135+ end if
136
137 ! Planewave cutoff of the real space mesh ...
138 g2cut = fdf_get('MeshCutoff',g2cut_default,'Ry')
139 if (ionode) then
140- write(6,6) 'redata: Mesh Cutoff = ', g2cut,' Ry'
141- endif
142+ write(6,6)'redata: Mesh Cutoff = ', g2cut,' Ry'
143+ endif
144+
145
146 if (cml_p) then
147 call cmlAddParameter( xf=mainXML, name='MeshCutOff', value=g2cut, &
148
149=== modified file 'Src/siesta_options.F90'
150--- Src/siesta_options.F90 2017-03-05 19:42:40 +0000
151+++ Src/siesta_options.F90 2018-04-05 07:11:38 +0000
152@@ -9,6 +9,8 @@
153
154 implicit none
155 integer, parameter, private :: dp = selected_real_kind(10,100)
156+
157+ save
158
159 PUBLIC
160
161@@ -181,7 +183,10 @@
162 real(dp) :: wmix ! Mixing weight for DM in SCF iteration
163 real(dp) :: wmixkick ! Mixing weight for DM in special 'kick' SCF steps
164
165- character(len=150) :: sname ! System name, used to initialise read
166+ ! Matrix element compatibility variable
167+ integer :: matel_NRTAB = 1024
168+
169+ character(len=164) :: sname ! System name, used to initialise read
170
171 integer, parameter :: SOLVE_DIAGON = 0
172 integer, parameter :: SOLVE_ORDERN = 1
173
174=== modified file 'version.info'
175--- version.info 2018-02-22 10:50:23 +0000
176+++ version.info 2018-04-05 07:11:38 +0000
177@@ -1,1 +1,1 @@
178-siesta-4.0--559
179+siesta-4.0--559--nrtab-2

Subscribers

People subscribed via source and target branches