Merge lp:~nickpapior/siesta/4.1-fdf-blocks into lp:siesta/4.1

Proposed by Nick Papior
Status: Merged
Approved by: Alberto Garcia
Approved revision: 984
Merged at revision: 986
Proposed branch: lp:~nickpapior/siesta/4.1-fdf-blocks
Merge into: lp:siesta/4.1
Diff against target: 770 lines (+112/-109)
31 files modified
Src/Makefile (+4/-4)
Src/broyden_optim.F (+2/-0)
Src/cell_broyden_optim.F (+2/-0)
Src/cgvc.F (+2/-0)
Src/cgvc_zmatrix.F (+2/-0)
Src/chemical.f (+5/-13)
Src/coor.F (+5/-9)
Src/fdf_extra.F90 (+19/-19)
Src/get_target_stress.f (+2/-0)
Src/kgrid.F (+1/-1)
Src/kgridinit.F (+2/-1)
Src/kpoint_grid.F90 (+1/-0)
Src/kpoint_pdos.F90 (+2/-1)
Src/ksvinit.F (+1/-1)
Src/ldau_specs.f (+1/-1)
Src/local_DOS.F (+1/-0)
Src/m_efield.F (+3/-6)
Src/m_new_dm.F90 (+1/-1)
Src/m_spin.F90 (+4/-1)
Src/m_target_stress.F (+2/-0)
Src/m_ts_io_ctype.f90 (+11/-26)
Src/m_ts_kpoints.F90 (+1/-0)
Src/meshsubs.F (+1/-0)
Src/metaforce.F (+24/-17)
Src/projected_DOS.F (+3/-4)
Src/read_xc_info.F (+1/-0)
Src/readsp.F (+1/-0)
Src/redcel.F (+4/-2)
Src/reoptical.F (+1/-0)
Src/zm_broyden_optim.F (+2/-1)
version.info (+1/-1)
To merge this branch: bzr merge lp:~nickpapior/siesta/4.1-fdf-blocks
Reviewer Review Type Date Requested Status
Alberto Garcia Approve
Review via email: mp+354532@code.launchpad.net

Commit message

Implemented closing of the majority of commonly used blocks

Closing of blocks in the log when using fdf_b* calls was problematic
if the code did not read the last line of the block (i.e. this was
the only way to ensure the %endblock <label> in the fdf-*.log.

There are some problems with this and transiesta because the transiesta
codes are using fdf_bbackspace (which re-writes to the log file).
However, for Siesta the above should work.%

Description of the change

Since this change touches some core places I think it is better if you had a glance at it.

I have tested a few tests and it now writes out the %endblock in the log file.

It does, however, have some problems when using the fdf_bbackspace methods.

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

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Src/Makefile'
--- Src/Makefile 2018-09-04 11:56:15 +0000
+++ Src/Makefile 2018-09-09 19:50:11 +0000
@@ -865,7 +865,7 @@
865m_ncdf_io.o: class_Sparsity.o m_io_s.o parallel.o precision.o865m_ncdf_io.o: class_Sparsity.o m_io_s.o parallel.o precision.o
866m_ncdf_siesta.o: atm_types.o atmparams.o atomlist.o class_Sparsity.o files.o866m_ncdf_siesta.o: atm_types.o atmparams.o atomlist.o class_Sparsity.o files.o
867m_ncdf_siesta.o: kpoint_grid.o m_energies.o m_forces.o m_kinetic.o m_ncdf_io.o867m_ncdf_siesta.o: kpoint_grid.o m_energies.o m_forces.o m_kinetic.o m_ncdf_io.o
868m_ncdf_siesta.o: m_ntm.o m_spin.o m_stress.o m_ts_electype.o m_ts_kpoints.o868m_ncdf_siesta.o: m_spin.o m_stress.o m_ts_electype.o m_ts_kpoints.o
869m_ncdf_siesta.o: m_ts_options.o parallel.o precision.o radial.o siesta_geom.o869m_ncdf_siesta.o: m_ts_options.o parallel.o precision.o radial.o siesta_geom.o
870m_ncdf_siesta.o: siesta_options.o sparse_matrices.o timestamp.o870m_ncdf_siesta.o: siesta_options.o sparse_matrices.o timestamp.o
871m_new_dm.o: alloc.o atomlist.o class_Data2D.o class_Fstack_Data1D.o871m_new_dm.o: alloc.o atomlist.o class_Data2D.o class_Fstack_Data1D.o
@@ -1238,9 +1238,9 @@
1238siesta_analysis.o: write_subs.o writewave.o zmatrix.o1238siesta_analysis.o: write_subs.o writewave.o zmatrix.o
1239siesta_cmlsubs.o: files.o m_uuid.o parallel.o siesta_cml.o timestamp.o1239siesta_cmlsubs.o: files.o m_uuid.o parallel.o siesta_cml.o timestamp.o
1240siesta_cmlsubs.o: 1240siesta_cmlsubs.o:
1241siesta_dicts.o: atomlist.o files.o kpoint_grid.o m_energies.o m_forces.o1241siesta_dicts.o: atomlist.o class_SpData1D.o files.o kpoint_grid.o m_energies.o
1242siesta_dicts.o: m_mixing_scf.o m_steps.o m_stress.o precision.o siesta_geom.o1242siesta_dicts.o: m_forces.o m_mixing_scf.o m_steps.o m_stress.o precision.o
1243siesta_dicts.o: siesta_options.o1243siesta_dicts.o: siesta_geom.o siesta_options.o sparse_matrices.o
1244siesta_end.o: alloc.o bands.o densematrix.o diag.o extrae_eventllist.o1244siesta_end.o: alloc.o bands.o densematrix.o diag.o extrae_eventllist.o
1245siesta_end.o: flook_siesta.o m_dscfcomm.o m_fixed.o m_io.o m_mixing_scf.o1245siesta_end.o: flook_siesta.o m_dscfcomm.o m_fixed.o m_io.o m_mixing_scf.o
1246siesta_end.o: m_rhog.o m_wallclock.o meshdscf.o meshphi.o moremeshsubs.o1246siesta_end.o: m_rhog.o m_wallclock.o meshdscf.o meshphi.o moremeshsubs.o
12471247
=== modified file 'Src/broyden_optim.F'
--- Src/broyden_optim.F 2016-01-25 16:00:16 +0000
+++ Src/broyden_optim.F 2018-09-09 19:50:11 +0000
@@ -187,6 +187,8 @@
187 sxy = fdf_bvalues(pline,4)187 sxy = fdf_bvalues(pline,4)
188 sxz = fdf_bvalues(pline,5)188 sxz = fdf_bvalues(pline,5)
189 syz = fdf_bvalues(pline,6)189 syz = fdf_bvalues(pline,6)
190 call fdf_bclose(bfdf)
191
190 tstres(1,1) = - sxx * tp192 tstres(1,1) = - sxx * tp
191 tstres(2,2) = - syy * tp193 tstres(2,2) = - syy * tp
192 tstres(3,3) = - szz * tp194 tstres(3,3) = - szz * tp
193195
=== modified file 'Src/cell_broyden_optim.F'
--- Src/cell_broyden_optim.F 2016-01-25 16:00:16 +0000
+++ Src/cell_broyden_optim.F 2018-09-09 19:50:11 +0000
@@ -180,6 +180,8 @@
180 sxy = fdf_bvalues(pline,4)180 sxy = fdf_bvalues(pline,4)
181 sxz = fdf_bvalues(pline,5)181 sxz = fdf_bvalues(pline,5)
182 syz = fdf_bvalues(pline,6)182 syz = fdf_bvalues(pline,6)
183 call fdf_bclose(bfdf)
184
183 target_stress(1,1) = - sxx * tp185 target_stress(1,1) = - sxx * tp
184 target_stress(2,2) = - syy * tp186 target_stress(2,2) = - syy * tp
185 target_stress(3,3) = - szz * tp187 target_stress(3,3) = - szz * tp
186188
=== modified file 'Src/cgvc.F'
--- Src/cgvc.F 2016-01-25 16:00:16 +0000
+++ Src/cgvc.F 2018-09-09 19:50:11 +0000
@@ -145,6 +145,8 @@
145 sxy = fdf_bvalues(pline,4)145 sxy = fdf_bvalues(pline,4)
146 sxz = fdf_bvalues(pline,5)146 sxz = fdf_bvalues(pline,5)
147 syz = fdf_bvalues(pline,6)147 syz = fdf_bvalues(pline,6)
148 call fdf_bclose(bfdf)
149
148 tstres(1,1) = - sxx * tp150 tstres(1,1) = - sxx * tp
149 tstres(2,2) = - syy * tp151 tstres(2,2) = - syy * tp
150 tstres(3,3) = - szz * tp152 tstres(3,3) = - szz * tp
151153
=== modified file 'Src/cgvc_zmatrix.F'
--- Src/cgvc_zmatrix.F 2016-01-25 16:00:16 +0000
+++ Src/cgvc_zmatrix.F 2018-09-09 19:50:11 +0000
@@ -141,6 +141,8 @@
141 sxy = fdf_bvalues(pline,4)141 sxy = fdf_bvalues(pline,4)
142 sxz = fdf_bvalues(pline,5)142 sxz = fdf_bvalues(pline,5)
143 syz = fdf_bvalues(pline,6)143 syz = fdf_bvalues(pline,6)
144 call fdf_bclose(bfdf)
145
144 tstres(1,1) = - sxx * tp146 tstres(1,1) = - sxx * tp
145 tstres(2,2) = - syy * tp147 tstres(2,2) = - syy * tp
146 tstres(3,3) = - szz * tp148 tstres(3,3) = - szz * tp
147149
=== modified file 'Src/chemical.f'
--- Src/chemical.f 2017-01-25 10:42:39 +0000
+++ Src/chemical.f 2018-09-09 19:50:11 +0000
@@ -115,22 +115,17 @@
115 if ( present(silent) ) lsilent = silent115 if ( present(silent) ) lsilent = silent
116 if ( Node /= 0 ) lsilent = .true.116 if ( Node /= 0 ) lsilent = .true.
117117
118 ! Default to 0
119 nsp = fdf_integer('Number_of_species',0)
120
118 ! The most important thing to find is121 ! The most important thing to find is
119 ! the block containing the species122 ! the block containing the species
120 found = fdf_block('Chemical_species_label',bfdf)123 found = fdf_block('Chemical_species_label', bfdf)
121 if (.not. found )124 if (.not. found )
122 $ call die("Block Chemical_species_label does not exist.")125 $ call die("Block Chemical_species_label does not exist.")
123126
124 ! Default to 0
125 nsp = fdf_integer('Number_of_species',0)
126 if ( nsp == 0 ) then127 if ( nsp == 0 ) then
127 ! try and guess the number of species128 ns_read = fdf_block_linecount('Chemical_species_label', 'iin')
128 ns_read = 0
129 do while( fdf_bline(bfdf,pline) )
130 if ( fdf_bmatch(pline,'iin') ) then
131 ns_read = ns_read + 1
132 end if
133 end do
134 else129 else
135 ns_read = nsp130 ns_read = nsp
136 end if131 end if
@@ -144,9 +139,6 @@
144 allocate(chemical_list%z(nsp))139 allocate(chemical_list%z(nsp))
145 chemical_list%no_of_species = nsp140 chemical_list%no_of_species = nsp
146141
147 ! Rewind the block
148 call fdf_brewind(bfdf)
149
150 ns_read = 0142 ns_read = 0
151 do while( fdf_bline(bfdf,pline) )143 do while( fdf_bline(bfdf,pline) )
152 if ( .not. fdf_bmatch(pline,'iin') ) cycle144 if ( .not. fdf_bmatch(pline,'iin') ) cycle
153145
=== modified file 'Src/coor.F'
--- Src/coor.F 2016-09-14 10:57:36 +0000
+++ Src/coor.F 2018-09-09 19:50:11 +0000
@@ -138,13 +138,8 @@
138 if ( na == 0 ) then138 if ( na == 0 ) then
139 ! estimate the number of atoms by reading the block139 ! estimate the number of atoms by reading the block
140 ! Currently we do not try to estimate from a Z-matrix140 ! Currently we do not try to estimate from a Z-matrix
141 if (fdf_block('AtomicCoordinatesAndAtomicSpecies',bfdf)) then141 na = fdf_block_linecount('AtomicCoordinatesAndAtomicSpecies',
142 na = 0142 & 'vvvi')
143 do while ( fdf_bline(bfdf,pline) )
144 ! each line should contain one atom
145 na = na + 1
146 end do
147 end if
148 end if143 end if
149 if ( na == 0 ) then144 if ( na == 0 ) then
150 call die("Must specify number of atoms AND coordinates!")145 call die("Must specify number of atoms AND coordinates!")
@@ -170,6 +165,7 @@
170 origin(1) = fdf_bvalues(pline,1)165 origin(1) = fdf_bvalues(pline,1)
171 origin(2) = fdf_bvalues(pline,2)166 origin(2) = fdf_bvalues(pline,2)
172 origin(3) = fdf_bvalues(pline,3)167 origin(3) = fdf_bvalues(pline,3)
168 call fdf_bclose(bfdf)
173 else169 else
174 origin = 0._dp170 origin = 0._dp
175 endif171 endif
@@ -195,7 +191,7 @@
195 else191 else
196192
197C If Z matrix hasn't been found, read regular atomic coordinates193C If Z matrix hasn't been found, read regular atomic coordinates
198 if (fdf_block('AtomicCoordinatesAndAtomicSpecies',bfdf)) then194 if ( fdf_block('AtomicCoordinatesAndAtomicSpecies',bfdf) ) then
199 do ia= 1, nua195 do ia= 1, nua
200 if (.not. fdf_bline(bfdf,pline))196 if (.not. fdf_bline(bfdf,pline))
201 . call die('coor: ERROR in ' //197 . call die('coor: ERROR in ' //
@@ -209,7 +205,7 @@
209 endif205 endif
210206
211 enddo207 enddo
212208 call fdf_bclose(bfdf)
213 else209 else
214 call die("coor: You must specify the atomic coordinates")210 call die("coor: You must specify the atomic coordinates")
215 endif211 endif
216212
=== modified file 'Src/fdf_extra.F90'
--- Src/fdf_extra.F90 2018-07-30 10:26:25 +0000
+++ Src/fdf_extra.F90 2018-09-09 19:50:11 +0000
@@ -73,13 +73,13 @@
73 call fdf_blists(pline,il,i1,list(n+1:))73 call fdf_blists(pline,il,i1,list(n+1:))
74 if ( i1 + n > size(list) ) then74 if ( i1 + n > size(list) ) then
75 print *,'Parsed line: ',trim(pline%line)75 print *,'Parsed line: ',trim(pline%line)
76 call die('fdf_extra: number of elements in block list &76 call die('fdf_brange: number of elements in block list &
77 &is too many to fit the maximal range of the &77 &is too many to fit the maximal range of the &
78 &list. Please correct.')78 &list. Please correct.')
79 end if79 end if
80 if ( i1 == 0 ) then80 if ( i1 == 0 ) then
81 print *,'Parsed line: ',trim(pline%line)81 print *,'Parsed line: ',trim(pline%line)
82 call die('fdf_extra: a block list with zero elements is not &82 call die('fdf_brange: a block list with zero elements is not &
83 &allowed, please correct input.')83 &allowed, please correct input.')
84 end if84 end if
8585
@@ -102,14 +102,14 @@
102 g = fdf_bnames(pline,2)102 g = fdf_bnames(pline,2)
103 if ( .not. leqi(g,'from') ) then103 if ( .not. leqi(g,'from') ) then
104 print *,'Parsed line: ',trim(pline%line)104 print *,'Parsed line: ',trim(pline%line)
105 call die('fdf_extra: error in range block: &105 call die('fdf_brange: error in range block: &
106 &from <int> to/plus/minus <int> is ill formatted')106 &from <int> to/plus/minus <int> is ill formatted')
107 end if107 end if
108108
109 g = fdf_bnames(pline,3)109 g = fdf_bnames(pline,3)
110 if ( fdf_bnintegers(pline) < 2 ) then110 if ( fdf_bnintegers(pline) < 2 ) then
111 print *,'Parsed line: ',trim(pline%line)111 print *,'Parsed line: ',trim(pline%line)
112 call die('fdf_extra: error in range block &112 call die('fdf_brange: error in range block &
113 &from <int> to/plus/minus <int> is ill formatted')113 &from <int> to/plus/minus <int> is ill formatted')
114 end if114 end if
115115
@@ -135,7 +135,7 @@
135 i2 = i1 - i2 + 1135 i2 = i1 - i2 + 1
136 else136 else
137 print *,'Parsed line: ',trim(pline%line)137 print *,'Parsed line: ',trim(pline%line)
138 call die('fdf_extra: unrecognized designator of ending range, &138 call die('fdf_brange: unrecognized designator of ending range, &
139 &[to, plus, minus] accepted.')139 &[to, plus, minus] accepted.')
140 end if140 end if
141141
@@ -153,7 +153,7 @@
153 (i1 > i2 .and. step > 0) ) then153 (i1 > i2 .and. step > 0) ) then
154 print *,'Parsed line: ',trim(pline%line)154 print *,'Parsed line: ',trim(pline%line)
155 print *,i1,i2,step155 print *,i1,i2,step
156 call die('fdf_extra: block range is not consecutive')156 call die('fdf_brange: block range is not consecutive')
157 end if157 end if
158158
159 ! Create list159 ! Create list
@@ -166,14 +166,14 @@
166 else166 else
167167
168 print *,'Parsed line: ',trim(pline%line)168 print *,'Parsed line: ',trim(pline%line)
169 call die('fdf_extra: error in range block, input not recognized')169 call die('fdf_brange: error in range block, input not recognized')
170170
171 end if171 end if
172172
173 do j = 1 , n173 do j = 1 , n
174 if ( list(j) < low .or. high < list(j) ) then174 if ( list(j) < low .or. high < list(j) ) then
175 print *,'Parsed line: ',trim(pline%line)175 print *,'Parsed line: ',trim(pline%line)
176 call die('fdf_extra: error in range block. Input is beyond range')176 call die('fdf_brange: error in range block. Input is beyond range')
177 end if177 end if
178 end do178 end do
179179
@@ -240,16 +240,16 @@
240 n_r = 0240 n_r = 0
241 if ( allocated(rgns) ) deallocate(rgns)241 if ( allocated(rgns) ) deallocate(rgns)
242242
243 ! If the block does not exist, simply return243 ! Get number of regions
244 if ( .not. fdf_block(bName,bfdf) ) return244 il = fdf_block_linecount(bName)
245245 if ( il == 0 ) return
246 ! the initial number of regions246
247 il = 0247 if ( .not. fdf_block(bName,bfdf) ) then
248 do while ( fdf_bnext(bfdf,pline) ) 248 call die('fdf_bregions: failed implementation.')
249 il = il + 1249 end if
250 end do250
251 ! allocate
251 allocate(rlist(il))252 allocate(rlist(il))
252 call fdf_brewind(bfdf)
253253
254 ! first count number of differently named regions254 ! first count number of differently named regions
255 do while ( fdf_bnext(bfdf,pline) ) 255 do while ( fdf_bnext(bfdf,pline) )
@@ -302,7 +302,7 @@
302 call fdf_brange(pline,r1,1,n)302 call fdf_brange(pline,r1,1,n)
303 if ( r1%n == 0 ) then303 if ( r1%n == 0 ) then
304 print *,'Region: ',trim(g)304 print *,'Region: ',trim(g)
305 call die('fdf_extra: Could not read in anything in region!')305 call die('fdf_bregions: Could not read in anything in region!')
306 end if306 end if
307 call rgn_union(rgns(il),r1,rgns(il))307 call rgn_union(rgns(il),r1,rgns(il))
308 rgns(il)%name = trim(g)308 rgns(il)%name = trim(g)
@@ -312,7 +312,7 @@
312 call fdf_brange(pline,r1,1,n)312 call fdf_brange(pline,r1,1,n)
313 if ( r1%n == 0 ) then313 if ( r1%n == 0 ) then
314 print *,'Region: ',trim(g)314 print *,'Region: ',trim(g)
315 call die('fdf_extra: Could not read in anything in region!')315 call die('fdf_bregions: Could not read in anything in region!')
316 end if316 end if
317 call rgn_union(rgns(ic),r1,rgns(ic))317 call rgn_union(rgns(ic),r1,rgns(ic))
318 rgns(ic)%name = trim(g)318 rgns(ic)%name = trim(g)
319319
=== modified file 'Src/get_target_stress.f'
--- Src/get_target_stress.f 2016-01-25 16:00:16 +0000
+++ Src/get_target_stress.f 2018-09-09 19:50:11 +0000
@@ -42,6 +42,8 @@
42 sxy = fdf_bvalues(pline,4)42 sxy = fdf_bvalues(pline,4)
43 sxz = fdf_bvalues(pline,5)43 sxz = fdf_bvalues(pline,5)
44 syz = fdf_bvalues(pline,6)44 syz = fdf_bvalues(pline,6)
45 call fdf_bclose(bfdf)
46
45 tstres(1,1) = - sxx * tp47 tstres(1,1) = - sxx * tp
46 tstres(2,2) = - syy * tp48 tstres(2,2) = - syy * tp
47 tstres(3,3) = - szz * tp49 tstres(3,3) = - szz * tp
4850
=== modified file 'Src/kgrid.F'
--- Src/kgrid.F 2016-01-25 16:00:16 +0000
+++ Src/kgrid.F 2018-09-09 19:50:11 +0000
@@ -63,7 +63,7 @@
63 parameter (tiny = 1.d-12)63 parameter (tiny = 1.d-12)
6464
65C Find out if there is spiral arrangement of spins65C Find out if there is spiral arrangement of spins
66 spiral = fdf_block('SpinSpiral',bfdf)66 spiral = fdf_isblock('SpinSpiral')
6767
68C Find total number of points (determinant of kscell)68C Find total number of points (determinant of kscell)
69 nktot = abs( kscell(1,1) * kscell(2,2) * kscell(3,3) +69 nktot = abs( kscell(1,1) * kscell(2,2) * kscell(3,3) +
7070
=== modified file 'Src/kgridinit.F'
--- Src/kgridinit.F 2017-10-10 19:47:15 +0000
+++ Src/kgridinit.F 2018-09-09 19:50:11 +0000
@@ -92,7 +92,7 @@
9292
93 genlogic = .false.93 genlogic = .false.
94C Find out if there is spiral arrangement of spins 94C Find out if there is spiral arrangement of spins
95 spiral = fdf_block('SpinSpiral',bfdf)95 spiral = fdf_isblock('SpinSpiral')
9696
97C Find total number of points (determinant of kscell)97C Find total number of points (determinant of kscell)
98 nktot = abs( kscell(1,1) * kscell(2,2) * kscell(3,3) +98 nktot = abs( kscell(1,1) * kscell(2,2) * kscell(3,3) +
@@ -118,6 +118,7 @@
118 displ(i) = 0._dp118 displ(i) = 0._dp
119 end if119 end if
120 enddo120 enddo
121 call fdf_bclose(bfdf)
121 nktot = abs( kscell(1,1) * kscell(2,2) * kscell(3,3) +122 nktot = abs( kscell(1,1) * kscell(2,2) * kscell(3,3) +
122 . kscell(2,1) * kscell(3,2) * kscell(1,3) +123 . kscell(2,1) * kscell(3,2) * kscell(1,3) +
123 . kscell(3,1) * kscell(1,2) * kscell(2,3) -124 . kscell(3,1) * kscell(1,2) * kscell(2,3) -
124125
=== modified file 'Src/kpoint_grid.F90'
--- Src/kpoint_grid.F90 2018-04-14 23:14:53 +0000
+++ Src/kpoint_grid.F90 2018-09-09 19:50:11 +0000
@@ -145,6 +145,7 @@
145 kdispl(i) = 0._dp145 kdispl(i) = 0._dp
146 end if146 end if
147 enddo147 enddo
148 call fdf_bclose(bfdf)
148 firm_displ = .true.149 firm_displ = .true.
149150
150 else151 else
151152
=== modified file 'Src/kpoint_pdos.F90'
--- Src/kpoint_pdos.F90 2018-04-14 23:14:53 +0000
+++ Src/kpoint_pdos.F90 2018-09-09 19:50:11 +0000
@@ -159,7 +159,8 @@
159 else159 else
160 kdispl(i) = 0._dp160 kdispl(i) = 0._dp
161 end if161 end if
162 enddo162 enddo
163 call fdf_bclose(bfdf)
163 firm_displ = .true.164 firm_displ = .true.
164165
165 else166 else
166167
=== modified file 'Src/ksvinit.F'
--- Src/ksvinit.F 2016-01-25 16:00:16 +0000
+++ Src/ksvinit.F 2018-09-09 19:50:11 +0000
@@ -229,7 +229,7 @@
229 endif229 endif
230230
231 enddo231 enddo
232232 call fdf_bclose(bfdf)
233 endif233 endif
234234
235 end subroutine repol235 end subroutine repol
236236
=== modified file 'Src/ldau_specs.f'
--- Src/ldau_specs.f 2016-11-25 18:04:25 +0000
+++ Src/ldau_specs.f 2018-09-09 19:50:11 +0000
@@ -428,7 +428,7 @@
428 nprojsldau(:) = 0428 nprojsldau(:) = 0
429429
430! Read the LDAU.proj block430! Read the LDAU.proj block
431 if (.not. fdf_block('LDAU.proj',bfdf)) RETURN431 if (.not. fdf_block('LDAU.proj', bfdf)) RETURN
432432
433 ! Add citation433 ! Add citation
434 if ( IONode ) then434 if ( IONode ) then
435435
=== modified file 'Src/local_DOS.F'
--- Src/local_DOS.F 2018-06-25 11:33:42 +0000
+++ Src/local_DOS.F 2018-09-09 19:50:11 +0000
@@ -70,6 +70,7 @@
70 factor = fdf_convfac( fdf_bnames(pline,1), 'Ry' )70 factor = fdf_convfac( fdf_bnames(pline,1), 'Ry' )
71 e1 = fdf_bvalues(pline,1)*factor71 e1 = fdf_bvalues(pline,1)*factor
72 e2 = fdf_bvalues(pline,2)*factor72 e2 = fdf_bvalues(pline,2)*factor
73 call fdf_bclose(bfdf)
7374
74 !Find the density matrix for states between e1 and e275 !Find the density matrix for states between e1 and e2
75 if ((isolve .eq. SOLVE_DIAGON) .or.76 if ((isolve .eq. SOLVE_DIAGON) .or.
7677
=== modified file 'Src/m_efield.F'
--- Src/m_efield.F 2018-01-26 13:17:30 +0000
+++ Src/m_efield.F 2018-09-09 19:50:11 +0000
@@ -52,7 +52,6 @@
5252
53 real(dp), intent(out) :: input_field(3)53 real(dp), intent(out) :: input_field(3)
5454
55 logical :: found
56 type(block_fdf) :: bfdf55 type(block_fdf) :: bfdf
57 type(parsed_line), pointer :: pline => null()56 type(parsed_line), pointer :: pline => null()
5857
@@ -63,10 +62,8 @@
6362
64 input_field(1:3) = 0.0_dp63 input_field(1:3) = 0.0_dp
6564
66 found = fdf_block('ExternalElectricField',bfdf)65 if (.not. fdf_block('ExternalElectricField',bfdf) ) RETURN
67 if (.not. found ) RETURN66 do while ( fdf_bline(bfdf,pline) )
68 loop: DO
69 if (.not. fdf_bline(bfdf,pline)) exit loop
70 if (.not. fdf_bmatch(pline,"vvvn"))67 if (.not. fdf_bmatch(pline,"vvvn"))
71 $ call die("Wrong format in ElectricField block")68 $ call die("Wrong format in ElectricField block")
72 eunits = fdf_bnames(pline,1)69 eunits = fdf_bnames(pline,1)
@@ -74,7 +71,7 @@
74 do ix = 1,371 do ix = 1,3
75 input_field(ix) = fdf_bvalues(pline,ix) * cfactor72 input_field(ix) = fdf_bvalues(pline,ix) * cfactor
76 enddo73 enddo
77 enddo loop74 enddo
7875
79 end subroutine get_user_specified_field76 end subroutine get_user_specified_field
80!----------------------------------------------------------------77!----------------------------------------------------------------
8178
=== modified file 'Src/m_new_dm.F90'
--- Src/m_new_dm.F90 2018-06-28 13:53:17 +0000
+++ Src/m_new_dm.F90 2018-09-09 19:50:11 +0000
@@ -981,7 +981,7 @@
981 981
982 ! Read the data from the block and then we populate DM982 ! Read the data from the block and then we populate DM
983 na = 0983 na = 0
984 do while( fdf_bline(bfdf,pline) .and. na < na_u )984 do while( fdf_bline(bfdf,pline) )
985 985
986 ! Read number of names, integers and reals on this line986 ! Read number of names, integers and reals on this line
987 ni = fdf_bnintegers(pline)987 ni = fdf_bnintegers(pline)
988988
=== modified file 'Src/m_spin.F90'
--- Src/m_spin.F90 2018-02-27 14:03:49 +0000
+++ Src/m_spin.F90 2018-09-09 19:50:11 +0000
@@ -338,7 +338,7 @@
338 subroutine init_spiral( ucell )338 subroutine init_spiral( ucell )
339 use fdf, only : fdf_get, leqi339 use fdf, only : fdf_get, leqi
340 use fdf, only: block_fdf, parsed_line340 use fdf, only: block_fdf, parsed_line
341 use fdf, only: fdf_block, fdf_bline341 use fdf, only: fdf_block, fdf_bline, fdf_bclose
342 use fdf, only: fdf_bnames, fdf_bvalues342 use fdf, only: fdf_bnames, fdf_bvalues
343 use units, only: Pi343 use units, only: Pi
344344
@@ -381,6 +381,9 @@
381 call die('init_spiral: ERROR: ReciprocalCoordinates must be' // &381 call die('init_spiral: ERROR: ReciprocalCoordinates must be' // &
382 ' ''Cubic'' or ''ReciprocalLatticeVectors''')382 ' ''Cubic'' or ''ReciprocalLatticeVectors''')
383 end if383 end if
384
385 call fdf_bclose(bfdf)
386
384 end subroutine init_spiral387 end subroutine init_spiral
385388
386 function fname_spin(nspin,ispin,slabel,suffix,basename) result(fname)389 function fname_spin(nspin,ispin,slabel,suffix,basename) result(fname)
387390
=== modified file 'Src/m_target_stress.F'
--- Src/m_target_stress.F 2016-10-31 21:00:50 +0000
+++ Src/m_target_stress.F 2018-09-09 19:50:11 +0000
@@ -73,6 +73,8 @@
73 sxy = fdf_bvalues(pline,4)73 sxy = fdf_bvalues(pline,4)
74 sxz = fdf_bvalues(pline,5)74 sxz = fdf_bvalues(pline,5)
75 syz = fdf_bvalues(pline,6)75 syz = fdf_bvalues(pline,6)
76 call fdf_bclose(bfdf)
77
76 target_stress(1,1) = - sxx * tp78 target_stress(1,1) = - sxx * tp
77 target_stress(2,2) = - syy * tp79 target_stress(2,2) = - syy * tp
78 target_stress(3,3) = - szz * tp80 target_stress(3,3) = - szz * tp
7981
=== modified file 'Src/m_ts_io_ctype.f90'
--- Src/m_ts_io_ctype.f90 2018-05-04 10:51:06 +0000
+++ Src/m_ts_io_ctype.f90 2018-09-09 19:50:11 +0000
@@ -98,26 +98,11 @@
98 character(len=*), intent(in) :: suffix98 character(len=*), intent(in) :: suffix
99 integer :: n99 integer :: n
100100
101 ! prepare to read in the data...
102 type(block_fdf) :: bfdf
103 type(parsed_line), pointer :: pline => null()
104
105 logical :: found
106
107 n = 0
108 if ( len_trim(suffix) == 0 ) then101 if ( len_trim(suffix) == 0 ) then
109 found = fdf_block(trim(prefix)//'.Contours',bfdf)102 n = fdf_block_linecount(trim(prefix)//'.Contours', 'l')
110 else103 else
111 found = fdf_block(trim(prefix)//'.Contours.'//trim(suffix),bfdf)104 n = fdf_block_linecount(trim(prefix)//'.Contours'//trim(suffix), 'l')
112 end if105 end if
113 if ( .not. found ) return
114
115 ! first count the number of electrodes
116 n = 0
117 do while ( fdf_bline(bfdf,pline) )
118 if ( fdf_bnnames(pline) == 0 ) cycle
119 n = n + 1
120 end do
121106
122 end function fdf_nc_iotype107 end function fdf_nc_iotype
123108
@@ -143,15 +128,16 @@
143 end if128 end if
144 if ( .not. found ) return129 if ( .not. found ) return
145130
146 ! first count the number of electrodes131 ! Find the name of the contour
147 n = 0132 n = 0
148 do while ( fdf_bline(bfdf,pline) )133 do while ( fdf_bline(bfdf,pline) )
149 if ( fdf_bnnames(pline) == 0 ) cycle134 if ( fdf_bnnames(pline) == 0 ) cycle
150 n = n + 1 135 n = n + 1
151 if ( n == i ) then136 if ( n == i ) then
152 name = fdf_bnames(pline,1)137 name = fdf_bnames(pline,1)
153 return138 call fdf_bclose(bfdf)
154 end if139 return
140 end if
155 end do141 end do
156142
157 end function fdf_name_c_iotype143 end function fdf_name_c_iotype
@@ -226,7 +212,6 @@
226 type(block_fdf), optional :: bfdf212 type(block_fdf), optional :: bfdf
227 logical :: exist213 logical :: exist
228214
229 type(block_fdf) :: bfdf_tmp
230 character(len=c_N) :: g215 character(len=c_N) :: g
231216
232 ! if the block does not exist, return217 ! if the block does not exist, return
@@ -242,7 +227,7 @@
242 bfdf%label = trim(g)227 bfdf%label = trim(g)
243 end if228 end if
244 else229 else
245 exist = fdf_block(trim(g),bfdf_tmp)230 exist = fdf_isblock(trim(g))
246 end if231 end if
247232
248 end function ts_exists_contour_block233 end function ts_exists_contour_block
249234
=== modified file 'Src/m_ts_kpoints.F90'
--- Src/m_ts_kpoints.F90 2017-11-23 14:17:27 +0000
+++ Src/m_ts_kpoints.F90 2018-09-09 19:50:11 +0000
@@ -131,6 +131,7 @@
131 'kgrid_Monkhorst_Pack block' )131 'kgrid_Monkhorst_Pack block' )
132 endif132 endif
133 enddo133 enddo
134 call fdf_bclose(bfdf)
134 ts_firm_displ = .true.135 ts_firm_displ = .true.
135 136
136 else137 else
137138
=== modified file 'Src/meshsubs.F'
--- Src/meshsubs.F 2017-07-01 00:59:38 +0000
+++ Src/meshsubs.F 2018-09-09 19:50:11 +0000
@@ -334,6 +334,7 @@
334 else334 else
335 call die('initmesh: ERROR in MeshSizes block')335 call die('initmesh: ERROR in MeshSizes block')
336 endif336 endif
337 call fdf_bclose(bfdf)
337 RealCutoff = huge(1.0_dp)338 RealCutoff = huge(1.0_dp)
338 call chkgmx( k0, rcell, ntm, RealCutoff )339 call chkgmx( k0, rcell, ntm, RealCutoff )
339 if (RealCutoff < G2max) then340 if (RealCutoff < G2max) then
340341
=== modified file 'Src/metaforce.F'
--- Src/metaforce.F 2016-01-25 16:00:16 +0000
+++ Src/metaforce.F 2018-09-09 19:50:11 +0000
@@ -11,13 +11,12 @@
1111
12 implicit none12 implicit none
1313
14 integer, save :: maxGauss = 100
15 integer, save :: nGauss = 014 integer, save :: nGauss = 0
16 logical, save :: lMetaForce15 logical, save :: lMetaForce = .false.
17 integer, pointer, save :: nGaussPtr(:,:)16 integer, pointer, save :: nGaussPtr(:,:) => null()
18 real(dp), pointer, save :: GaussK(:)17 real(dp), pointer, save :: GaussK(:) => null()
19 real(dp), pointer, save :: GaussR0(:)18 real(dp), pointer, save :: GaussR0(:) => null()
20 real(dp), pointer, save :: GaussZeta(:)19 real(dp), pointer, save :: GaussZeta(:) => null()
2120
22 CONTAINS21 CONTAINS
2322
@@ -41,34 +40,42 @@
41 type(block_fdf) :: bfdf40 type(block_fdf) :: bfdf
42 type(parsed_line), pointer :: pline41 type(parsed_line), pointer :: pline
4342
44C Find if there are any Gaussians specified43C Find if there are any Gaussians specified
45 lMetaForce = fdf_defined('MetaForce')44 nGauss = fdf_block_linecount('MetaForce', 'iirrr')
46 if (lMetaForce) then45 lMetaForce = nGauss > 0
46 if ( lMetaForce ) then
4747
48C Allocate arrays for Gaussian data48C Allocate arrays for Gaussian data
49 call re_alloc( nGaussPtr, 1, 2, 1, maxGauss, 'nGaussPtr',49 call re_alloc( nGaussPtr, 1, 2, 1, nGauss, 'nGaussPtr',
50 & 'initmeta' )50 & 'initmeta' )
51 call re_alloc( GaussK, 1, maxGauss, 'GaussK', 'initmeta' )51 call re_alloc( GaussK, 1, nGauss, 'GaussK', 'initmeta' )
52 call re_alloc( GaussR0, 1, maxGauss, 'GaussR0', 'initmeta' )52 call re_alloc( GaussR0, 1, nGauss, 'GaussR0', 'initmeta' )
53 call re_alloc( GaussZeta, 1, maxGauss, 'GaussZeta', 'initmeta' )53 call re_alloc( GaussZeta, 1, nGauss, 'GaussZeta', 'initmeta' )
5454
55C Read Gaussians from block55C Read Gaussians from block
56 lMetaForce = fdf_block('MetaForce',bfdf)56 lMetaForce = fdf_block('MetaForce', bfdf)
5757
58 do k= 1, maxGauss58 do while ( fdf_bline(bfdf, pline) )
59C Read and parse data line59C Read and parse data line
60 if (.not. fdf_bline(bfdf,pline))
61 . call die('initmeta: ERROR in MetaForce block')
62 ni = fdf_bnintegers(pline)60 ni = fdf_bnintegers(pline)
63 nr = fdf_bnreals(pline)61 nr = fdf_bnreals(pline)
6462
65C Check that correct info is given63C Check that correct info is given
66 if ((ni .ge. 2) .and. (nr .ge. 3)) then64 if ((ni .ge. 2) .and. (nr .ge. 3)) then
67 nGauss = nGauss + 165 nGauss = nGauss + 1
66 ! Atom 1
68 nGaussPtr(1,nGauss) = abs(fdf_bintegers(pline,1))67 nGaussPtr(1,nGauss) = abs(fdf_bintegers(pline,1))
68 ! Atom 2
69 nGaussPtr(2,nGauss) = abs(fdf_bintegers(pline,2))69 nGaussPtr(2,nGauss) = abs(fdf_bintegers(pline,2))
70 ! Gaussian pre-factor for the force
71 ! Unit: Ry
70 GaussK(nGauss) = fdf_breals(pline,1)72 GaussK(nGauss) = fdf_breals(pline,1)
73 ! Distance in r - r_0, where r is the distance between
74 ! atom i and j
75 ! Unit: Ang
71 GaussR0(nGauss) = fdf_breals(pline,2)/0.529177_dp76 GaussR0(nGauss) = fdf_breals(pline,2)/0.529177_dp
77 ! Gaussian prefactor
78 ! Unit: 1/Bohr**2
72 GaussZeta(nGauss) = fdf_breals(pline,3)79 GaussZeta(nGauss) = fdf_breals(pline,3)
73 endif80 endif
74 enddo81 enddo
7582
=== modified file 'Src/projected_DOS.F'
--- Src/projected_DOS.F 2018-06-25 11:33:42 +0000
+++ Src/projected_DOS.F 2018-09-09 19:50:11 +0000
@@ -22,17 +22,15 @@
22 subroutine init_projected_DOS()22 subroutine init_projected_DOS()
2323
24 USE siesta_options24 USE siesta_options
25 use fdf, only: fdf_block, block_fdf25 use fdf, only: fdf_block, fdf_isblock
26 use Kpoint_pdos26 use Kpoint_pdos
27 use parallel, only: IOnode, Nodes27 use parallel, only: IOnode, Nodes
28 use siesta_geom, only: ucell28 use siesta_geom, only: ucell
29 use m_spin, only: spin29 use m_spin, only: spin
3030
31 type(block_fdf) :: bfdf
32
33!-------------------------------------------------------------------------BEGIN31!-------------------------------------------------------------------------BEGIN
34! Compute the projected density of states32! Compute the projected density of states
35 do_pdos = fdf_block('ProjectedDensityOfStates', bfdf)33 do_pdos = fdf_isblock('ProjectedDensityOfStates')
36 if ( .not. do_pdos ) return34 if ( .not. do_pdos ) return
37 35
38 if (isolve.ne.SOLVE_DIAGON) then36 if (isolve.ne.SOLVE_DIAGON) then
@@ -108,6 +106,7 @@
108 $ 'siesta: e1, e2, sigma, nhist: ',106 $ 'siesta: e1, e2, sigma, nhist: ',
109 $ e1/eV,' eV',e2/eV,' eV',sigma/eV,' eV', nhist107 $ e1/eV,' eV',e2/eV,' eV',sigma/eV,' eV', nhist
110 end if108 end if
109 call fdf_bclose(bfdf)
111110
112! If the k points have been set specifically for the PDOS then use this set111! If the k points have been set specifically for the PDOS then use this set
113 if (different_pdos_grid) then112 if (different_pdos_grid) then
114113
=== modified file 'Src/read_xc_info.F'
--- Src/read_xc_info.F 2016-01-25 16:00:16 +0000
+++ Src/read_xc_info.F 2018-09-09 19:50:11 +0000
@@ -78,6 +78,7 @@
78 XCweightC(n) = 1.0_dp78 XCweightC(n) = 1.0_dp
79 endif79 endif
80 enddo80 enddo
81 call fdf_bclose(bfdf)
81 else82 else
82 nXCfunc = 1 83 nXCfunc = 1
83 XCfunc(1) = fdf_string('xc.functional','LDA')84 XCfunc(1) = fdf_string('xc.functional','LDA')
8485
=== modified file 'Src/readsp.F'
--- Src/readsp.F 2016-01-25 16:00:16 +0000
+++ Src/readsp.F 2018-09-09 19:50:11 +0000
@@ -84,6 +84,7 @@
84 call die('redata: ERROR: ReciprocalCoordinates must be' //84 call die('redata: ERROR: ReciprocalCoordinates must be' //
85 . ' ''Cubic'' or ''ReciprocalLatticeVectors''')85 . ' ''Cubic'' or ''ReciprocalLatticeVectors''')
86 endif86 endif
87 call fdf_bclose(bfdf)
87 else88 else
88 spiral = .false.89 spiral = .false.
89 q(1) = 0.d090 q(1) = 0.d0
9091
=== modified file 'Src/redcel.F'
--- Src/redcel.F 2016-01-25 16:00:16 +0000
+++ Src/redcel.F 2018-09-09 19:50:11 +0000
@@ -43,8 +43,8 @@
4343
44C Lattice vectors44C Lattice vectors
4545
46 if ( fdf_block('LatticeParameters',bfdf) .and.46 if ( fdf_isblock('LatticeParameters') .and.
47 . fdf_block('LatticeVectors',bfdf) ) then47 . fdf_isblock('LatticeVectors') ) then
48 call die('redcel: ERROR: Lattice vectors doubly ' //48 call die('redcel: ERROR: Lattice vectors doubly ' //
49 $ 'specified: by LatticeVectors and by LatticeParameters.')49 $ 'specified: by LatticeVectors and by LatticeParameters.')
50 endif50 endif
@@ -97,6 +97,7 @@
97 cell(i,i) = 1.0_dp97 cell(i,i) = 1.0_dp
98 enddo98 enddo
99 endif99 endif
100 call fdf_bclose(bfdf)
100101
101 ! Note that cell will be zero if alat is not specified102 ! Note that cell will be zero if alat is not specified
102 ! This is not very intuitive103 ! This is not very intuitive
@@ -117,6 +118,7 @@
117 mscell(2,i) = fdf_bvalues(pline,2)118 mscell(2,i) = fdf_bvalues(pline,2)
118 mscell(3,i) = fdf_bvalues(pline,3)119 mscell(3,i) = fdf_bvalues(pline,3)
119 enddo120 enddo
121 call fdf_bclose(bfdf)
120 else122 else
121 do i = 1,3123 do i = 1,3
122 do j = 1,3124 do j = 1,3
123125
=== modified file 'Src/reoptical.F'
--- Src/reoptical.F 2016-03-21 22:47:29 +0000
+++ Src/reoptical.F 2018-09-09 19:50:11 +0000
@@ -138,6 +138,7 @@
138 nmeshk(1) = fdf_bintegers(pline,1)138 nmeshk(1) = fdf_bintegers(pline,1)
139 nmeshk(2) = fdf_bintegers(pline,2)139 nmeshk(2) = fdf_bintegers(pline,2)
140 nmeshk(3) = fdf_bintegers(pline,3)140 nmeshk(3) = fdf_bintegers(pline,3)
141 call fdf_bclose(bfdf)
141 endif142 endif
142143
143C Read whether this is a polarised, unpolarised or polycrystal calc144C Read whether this is a polarised, unpolarised or polycrystal calc
144145
=== modified file 'Src/zm_broyden_optim.F'
--- Src/zm_broyden_optim.F 2016-03-01 14:24:48 +0000
+++ Src/zm_broyden_optim.F 2018-09-09 19:50:11 +0000
@@ -175,7 +175,8 @@
175 sxy = fdf_bvalues(pline,4)175 sxy = fdf_bvalues(pline,4)
176 sxz = fdf_bvalues(pline,5)176 sxz = fdf_bvalues(pline,5)
177 syz = fdf_bvalues(pline,6)177 syz = fdf_bvalues(pline,6)
178178 call fdf_bclose(bfdf)
179
179 tstres(1,1) = - sxx * tp180 tstres(1,1) = - sxx * tp
180 tstres(2,2) = - syy * tp181 tstres(2,2) = - syy * tp
181 tstres(3,3) = - szz * tp182 tstres(3,3) = - szz * tp
182183
=== modified file 'version.info'
--- version.info 2018-09-08 04:18:59 +0000
+++ version.info 2018-09-09 19:50:11 +0000
@@ -1,1 +1,1 @@
1siesta-4.1--9831siesta-4.1--983--fdf-close-1

Subscribers

People subscribed via source and target branches