-
Notifications
You must be signed in to change notification settings - Fork 0
/
m_pawxmlps.F90
3095 lines (2797 loc) · 101 KB
/
m_pawxmlps.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!!****m* ABINIT/m_pawxmlps
!! NAME
!! m_pawxmlps
!!
!! FUNCTION
!! This module reads a PAW pseudopotential file written in XML.
!! Can use either FoX or pure Fortran routines.
!!
!! COPYRIGHT
!! Copyright (C) 2005-2022 ABINIT group (MT, FJ)
!! This file is distributed under the terms of the
!! GNU General Public License, see ~abinit/COPYING
!! or http://www.gnu.org/copyleft/gpl.txt .
!!
!! NOTES
!! FOR DEVELOPPERS: in order to preserve the portability of libPAW library,
!! please consult ~abinit/src/??_libpaw/libpaw-coding-rules.txt
!!
!! SOURCE
#include "libpaw.h"
module m_pawxmlps
USE_DEFS
USE_MSG_HANDLING
USE_MEMORY_PROFILING
#if defined LIBPAW_HAVE_FOX
use fox_sax
#endif
use m_pawrad , only : pawrad_type, pawrad_init, pawrad_free, pawrad_ifromr, bound_deriv
use m_paw_numeric, only : paw_spline, paw_splint
implicit none
private
!Procedures used for the Fortran reader
public :: rdpawpsxml
public :: rdpawpsxml_header
public :: rdpawpsxml_core
!Procedures used for the FoX reader (called from xml_parser in response to events)
#if defined LIBPAW_HAVE_FOX
public :: paw_begin_element1
public :: paw_end_element1
public :: pawdata_chunk
#endif
! private procedures and global variables.
private :: paw_rdfromline
! This type of real is used by the datatypes below
integer,parameter,private :: dpxml = selected_real_kind(14)
! The maximum length of a record in a file connected for sequential access.
integer,parameter,private :: XML_RECL = 50000
integer,parameter,private :: NGAUSSIAN_MAX = 100
!!***
!!****t* m_pawxmlps/radial_grid_t
!! NAME
!! radial_grid_t
!!
!! FUNCTION
!! Radial grid type for the FoX XML reader
!!
!! SOURCE
type, public :: radial_grid_t
logical :: tread=.false.
character(len=20) :: eq
character(len=4) :: id
real(dpxml) :: aa
real(dpxml) :: bb
real(dpxml) :: dd
integer :: nn
integer :: istart
integer :: iend
end type radial_grid_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/radial_func_t
!! NAME
!! radial_func_t
!!
!! FUNCTION
!! Radial function type for the FoX XML reader
!!
!! SOURCE
type, public :: radialfunc_t
logical :: tread=.false.
character(len=6) :: grid=' ' !vz_z
character(len=6) :: state=' ' !vz_z
real(dpxml),allocatable :: data(:)
end type radialfunc_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/gaussian_expansion_t
!! NAME
!! radial_func_t
!!
!! FUNCTION
!! Radial function type for the FoX XML reader
!!
!! SOURCE
type, public :: gaussian_expansion_t
logical :: tread=.false.
integer :: ngauss=0
character(len=6) :: state=' '
real(dpxml), dimension(2, NGAUSSIAN_MAX) :: factors
real(dpxml), dimension(2, NGAUSSIAN_MAX) :: expos
end type gaussian_expansion_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/shape_function_t
!! NAME
!! shape_function_t
!!
!! FUNCTION
!! Shape function type for the FoX XML reader
!!
!! SOURCE
type, public :: shape_function_t
logical :: tread=.false.
character(len=20) :: gtype
real(dpxml) :: rc=0
character(len=6) :: grid
integer :: lamb
real(dpxml), allocatable :: data(:,:)
end type shape_function_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/state_t
!! NAME
!! state_t
!!
!! FUNCTION
!! State type for the FoX XML reader
!!
!! SOURCE
type, public :: state_t
logical :: tread=.false.
character(len=6) :: id
real(dpxml) :: ff
real(dpxml) :: rc
real(dpxml) :: ee
integer :: nn
integer :: ll
integer :: kk
end type state_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/valence_states_t
!! NAME
!! valence_states_t
!!
!! FUNCTION
!! Valence state type for the FoX XML reader
!!
!! SOURCE
type, public :: valence_states_t
logical :: tread=.false.
integer :: nval
type(state_t),allocatable :: state(:)
end type valence_states_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/generator_t
!! NAME
!! generator_t
!!
!! FUNCTION
!! Generator type for the FoX XML reader
!!
!! SOURCE
type, public :: generator_t
logical :: tread=.false.
character(len=20) :: gen
character(len=20) :: name
end type generator_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/xc_functional_t
!! NAME
!! xc_functional_t function_t
!!
!! FUNCTION
!! XC functional type for the FoX XML reader
!!
!! SOURCE
type, public :: xc_functional_t
logical :: tread=.false.
character(len=12) :: functionaltype
character(len=100) :: name
end type xc_functional_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/atom_t
!! NAME
!! atom_t
!!
!! FUNCTION
!! Atom type for the FoX XML reader
!!
!! SOURCE
type, public :: atom_t
logical :: tread=.false.
character(len=2) :: symbol
real(dpxml) :: znucl
real(dpxml) :: zion
real(dpxml) :: zval
end type atom_t
!!***
!-------------------------------------------------------------------------
!!****t* m_pawxmlps/paw_setup_t
!! NAME
!! paw_setup_t
!!
!! FUNCTION
!! PAW setup type (contain all the data for a PAW setup)
!!
!! SOURCE
type, public :: paw_setup_t
character(len=3) :: version
logical :: tread=.false.
integer :: ngrid
real(dpxml) :: rpaw
real(dpxml) :: ex_cc
character(len=4) :: idgrid
character(len=12) :: optortho
type(atom_t) :: atom
type(xc_functional_t) :: xc_functional
type(generator_t) :: generator
type(valence_states_t) :: valence_states
type(radial_grid_t), allocatable :: radial_grid(:)
type(shape_function_t) :: shape_function
type(radialfunc_t) :: ae_core_density
type(radialfunc_t) :: pseudo_core_density
type(radialfunc_t) :: pseudo_valence_density
type(radialfunc_t) :: zero_potential
type(radialfunc_t) :: LDA_minus_half_potential
type(radialfunc_t) :: ae_core_kinetic_energy_density
type(radialfunc_t) :: pseudo_core_kinetic_energy_density
type(radialfunc_t),allocatable :: ae_partial_wave(:)
type(radialfunc_t),allocatable :: pseudo_partial_wave(:)
type(radialfunc_t),allocatable :: projector_function(:)
type(gaussian_expansion_t),allocatable :: projector_fit(:)
type(radialfunc_t) :: kresse_joubert_local_ionic_potential
type(radialfunc_t) :: blochl_local_ionic_potential
type(radialfunc_t) :: kinetic_energy_differences
type(radialfunc_t) :: exact_exchange_matrix
end type paw_setup_t
public :: paw_setup_free ! Free memory
public :: paw_setup_copy ! Copy object
!!***
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
!------------- PUBLIC AND PRIVATE VARIABLES ------------------------------
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
!Public variables (common to both readers)
integer,save,public,allocatable :: ipsp2xml(:)
integer,save,public :: npsp_pawxml
type(paw_setup_t),public,target,allocatable,save :: paw_setup(:)
type(paw_setup_t),public,target,save :: paw_setuploc
!Private variables (for the FoX reader)
#if defined LIBPAW_HAVE_FOX
logical,private,save :: in_valenceStates = .false.,in_data=.false.
logical,private,save :: in_generator =.false.
integer,private,save :: ndata
integer,private,save :: ii,ival,igrid,ishpf,lmax,mesh_size
!Pointers to make it easier to manage the data
type(radialfunc_t),private,save,pointer :: rp
type(state_t),private,save,pointer :: valstate (:)
type(radial_grid_t),private,save,pointer :: grids (:)
type(radialfunc_t),private,save,pointer :: shpf(:)
#endif
!!***
CONTAINS
!===========================================================
!!***
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
!------------- ROUTINES AND FUNCTIONS FOR THE FOX READER -----------------
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
#if defined LIBPAW_HAVE_FOX
!!****f* m_pawxmlps/paw_begin_element1
!! NAME
!! begin_element
!!
!! FUNCTION
!! Read an XML tag with a given name.
!! Fills the present module private data.
!!
!! INPUTS
!! namespaceURI = universal resource indicator for XML namespace??? Not used.
!! localName = local equivalent of tag name?? Not used.
!! name = name of XML tag which has been read in
!! attributes = attributes of XML tag
!!
!! OUTPUT
!! Fills private data in present module.
!!
!! SOURCE
subroutine paw_begin_element1(namespaceURI,localName,name,attributes)
character(len=*),intent(in) :: namespaceURI,localName,name
type(dictionary_t),intent(in) :: attributes
character(len=100) :: msg,value
integer ::iaewf=0,iproj=0,ipswf=0,iprojfit=0,igauss=0
!Just to fool abirules
value=localName
value=namespaceURI
select case(name)
case ("paw_setup")
paw_setuploc%tread=.true.
igrid=0;ishpf=0
paw_setuploc%rpaw=-1.d0
LIBPAW_DATATYPE_ALLOCATE(grids,(10))
LIBPAW_DATATYPE_ALLOCATE(shpf,(7))
value = getValue(attributes,"version")
write(std_out,'(3a)') "Processing a PSEUDO version ",trim(value)," XML file"
paw_setuploc%version=trim(value)
case ("atom")
paw_setuploc%atom%tread=.true.
value = getValue(attributes,"symbol")
if (value == "" ) then
msg="Cannot determine atomic symbol"
LIBPAW_ERROR(msg)
end if
paw_setuploc%atom%symbol = trim(value)
value = getValue(attributes,"Z")
if (value == "" ) then
msg="Cannot determine znucl"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) paw_setuploc%atom%znucl
value = getValue(attributes,"core")
if (value == "" ) then
msg="Cannot determine zion"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) paw_setuploc%atom%zion
value = getValue(attributes,"valence")
if (value == "" ) then
msg="Cannot determine zval"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) paw_setuploc%atom%zval
case ("xc_functional")
paw_setuploc%xc_functional%tread=.true.
value = getValue(attributes,"type")
if (value == "" ) then
msg="Cannot determine xc-functional-type"
LIBPAW_ERROR(msg)
end if
paw_setuploc%xc_functional%functionaltype = trim(value)
value = getValue(attributes,"name")
if (value == "" ) then
msg="Cannot determine xc-functional-name "
LIBPAW_ERROR(msg)
end if
paw_setuploc%xc_functional%name= trim(value)
case ("generator")
paw_setuploc%generator%tread=.true.
in_generator =.true.
value = getValue(attributes,"type")
if (value == "" ) value = "unknown"
paw_setuploc%generator%gen = trim(value)
value = getValue(attributes,"name")
if (value == "" ) value = "unknown"
paw_setuploc%generator%name = trim(value)
case ("PAW_radius")
value = getValue(attributes,"rpaw")
if (value == "" ) then
msg="Cannot determine rpaw"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) paw_setuploc%rpaw
case ("valence_states")
paw_setuploc%valence_states%tread=.true.
in_valenceStates=.true.
ival=0
lmax=0
LIBPAW_DATATYPE_ALLOCATE(valstate,(50))
case ("state")
ival=ival+1
value = getValue(attributes,"n")
if (value == "" ) then
valstate(ival)%nn=-1
else
read(unit=value,fmt=*) valstate(ival)%nn
end if
value = getValue(attributes,"l")
if (value == "" ) then
msg="Cannot determine l"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) valstate(ival)%ll
if(valstate(ival)%ll>lmax) lmax=valstate(ival)%ll
value = getValue(attributes,"f")
if (value == "" ) then
valstate(ival)%ff=-1.d0
else
read(unit=value,fmt=*) valstate(ival)%ff
end if
value = getValue(attributes,"rc")
if (value == "" ) then
msg="Cannot determine rc"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) valstate(ival)%rc
value = getValue(attributes,"e")
if (value == "" ) then
msg="Cannot determine e"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) valstate(ival)%ee
value = getValue(attributes,"id")
if (value == "" ) value = "unknown"
valstate(ival)%id = trim(value)
case ("radial_grid")
igrid=igrid+1
value = getValue(attributes,"eq")
if (value == "" ) value = "unknown"
grids(igrid)%eq = trim(value)
value = getValue(attributes,"a")
if (value == "" ) then
grids(igrid)%aa=0.d0
else
read(unit=value,fmt=*) grids(igrid)%aa
end if
value = getValue(attributes,"n")
if (value == "" ) then
grids(igrid)%nn=0
else
read(unit=value,fmt=*) grids(igrid)%nn
end if
value = getValue(attributes,"d")
if (value == "" ) then
grids(igrid)%dd=0.d0
else
read(unit=value,fmt=*) grids(igrid)%dd
end if
value = getValue(attributes,"b")
if (value == "" ) then
grids(igrid)%bb=0.d0
else
read(unit=value,fmt=*) grids(igrid)%bb
end if
value = getValue(attributes,"istart")
if (value == "" ) then
msg="Cannot determine istart"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) grids(igrid)%istart
value = getValue(attributes,"iend")
if (value == "" ) then
msg="Cannot determine iend"
LIBPAW_ERROR(msg)
end if
read(unit=value,fmt=*) grids(igrid)%iend
value = getValue(attributes,"id")
if (value == "" ) value = "unknown"
grids(igrid)%id = trim(value)
end select
select case(name)
case ("shape_function")
paw_setuploc%shape_function%tread=.true.
value = getValue(attributes,"type")
if (value == "" ) value = "unknown"
paw_setuploc%shape_function%gtype = trim(value)
value = getValue(attributes,"grid")
paw_setuploc%shape_function%grid=trim(value)
if (value /= "" ) then
paw_setuploc%shape_function%gtype ="num"
do ii=1,igrid
if(trim(paw_setuploc%shape_function%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
ishpf=ishpf+1
LIBPAW_ALLOCATE(shpf(ishpf)%data,(mesh_size))
rp=>shpf(ishpf)
in_data=.true.
ndata = 0
end if
value = getValue(attributes,"rc")
if (value == "" ) then
if(paw_setuploc%shape_function%gtype /="num") then
msg="Cannot determine rc"
LIBPAW_ERROR(msg)
end if
else
read(unit=value,fmt=*) paw_setuploc%shape_function%rc
end if
value = getValue(attributes,"lamb")
if (value == "" ) then
paw_setuploc%shape_function%lamb=0
else
read(unit=value,fmt=*) paw_setuploc%shape_function%lamb
end if
case ("pseudo_partial_wave")
ipswf=ipswf+1
paw_setuploc%pseudo_partial_wave(ipswf)%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%idgrid = trim(value)
paw_setuploc%pseudo_partial_wave(ipswf)%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) then
msg="Cannot determine pseudo_partial_wave state"
LIBPAW_ERROR(msg)
end if
paw_setuploc%pseudo_partial_wave(ipswf)%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%pseudo_partial_wave(ipswf)%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%pseudo_partial_wave(ipswf)%data,(mesh_size))
rp=>paw_setuploc%pseudo_partial_wave(ipswf)
if(ipswf==paw_setuploc%valence_states%nval) ipswf=0
in_data=.true.
ndata = 0
case ("ae_partial_wave")
iaewf=iaewf+1
paw_setuploc%ae_partial_wave(iaewf)%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%ae_partial_wave(iaewf)%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) then
LIBPAW_ERROR("Cannot determine ae_partial_wave state")
end if
paw_setuploc%ae_partial_wave(iaewf)%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%ae_partial_wave(iaewf)%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%ae_partial_wave(iaewf)%data,(mesh_size))
rp=>paw_setuploc%ae_partial_wave(iaewf)
if(iaewf==paw_setuploc%valence_states%nval) iaewf=0
in_data=.true.
ndata = 0
case ("projector_function")
iproj=iproj+1
paw_setuploc%projector_function(iproj)%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%projector_function(iproj)%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) then
msg="Cannot determine projector_function state"
LIBPAW_ERROR(msg)
end if
paw_setuploc%projector_function(iproj)%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%projector_function(iproj)%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%projector_function(iproj)%data,(mesh_size))
rp=>paw_setuploc%projector_function(iproj)
if(iproj==paw_setuploc%valence_states%nval) iproj=0
in_data=.true.
ndata = 0
case ("projector_fit")
if(.not.allocated(paw_setuploc%projector_fit)) then
LIBPAW_DATATYPE_ALLOCATE(paw_setuploc%projector_fit,(paw_setuploc%valence_states%nval))
end if
iprojfit=iprojfit+1
paw_setuploc%projector_fit(iprojfit)%tread=.true.
value = getValue(attributes,"state")
if (value == "" ) then
msg="Cannot determine projector_fit state"
LIBPAW_ERROR(msg)
end if
paw_setuploc%projector_fit(iprojfit)%state=trim(value)
if(iprojfit==paw_setuploc%valence_states%nval) iprojfit=0
igauss = 0
case ("gaussian")
igauss = igauss + 1
value = getValue(attributes,"factor")
if (value == "" ) then
msg="Cannot determine gaussian factor"
LIBPAW_ERROR(msg)
end if
read(value(2:100), *) paw_setuploc%projector_fit(iprojfit)%factors(1, igauss)
read(value(index(value, ',') + 1:100), *) paw_setuploc%projector_fit(iprojfit)%factors(2, igauss)
value = getValue(attributes,"exponent")
if (value == "" ) then
msg="Cannot determine gaussian exponent"
LIBPAW_ERROR(msg)
end if
read(value(2:100), *) paw_setuploc%projector_fit(iprojfit)%expos(1, igauss)
read(value(index(value, ',') + 1:100), *) paw_setuploc%projector_fit(iprojfit)%expos(2, igauss)
case ("ae_core_density")
paw_setuploc%ae_core_density%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%ae_core_density%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%ae_core_density%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%ae_core_density%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%ae_core_density%data,(mesh_size))
rp=>paw_setuploc%ae_core_density
in_data=.true.
ndata = 0
case ("pseudo_core_density")
paw_setuploc%pseudo_core_density%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%pseudo_core_density%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%pseudo_core_density%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%pseudo_core_density%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%pseudo_core_density%data,(mesh_size))
rp=>paw_setuploc%pseudo_core_density
in_data=.true.
ndata = 0
case ("pseudo_valence_density")
paw_setuploc%pseudo_valence_density%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%pseudo_valence_density%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%pseudo_valence_density%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%pseudo_valence_density%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%pseudo_valence_density%data,(mesh_size))
rp=>paw_setuploc%pseudo_valence_density
in_data=.true.
ndata = 0
case ("zero_potential")
paw_setuploc%zero_potential%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%zero_potential%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%zero_potential%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%zero_potential%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%zero_potential%data,(mesh_size))
rp=>paw_setuploc%zero_potential
in_data=.true.
ndata = 0
case ("LDA_minus_half_potential")
paw_setuploc%LDA_minus_half_potential%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%LDA_minus_half_potential%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%LDA_minus_half_potential%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%LDA_minus_half_potential%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%LDA_minus_half_potential%data,(mesh_size))
rp=>paw_setuploc%LDA_minus_half_potential
in_data=.true.
ndata = 0
case ("ae_core_kinetic_energy_density")
paw_setuploc%ae_core_kinetic_energy_density%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%ae_core_kinetic_energy_density%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%ae_core_kinetic_energy_density%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%ae_core_kinetic_energy_density%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%ae_core_kinetic_energy_density%data,(mesh_size))
rp=>paw_setuploc%ae_core_kinetic_energy_density
in_data=.true.
ndata = 0
case ("pseudo_core_kinetic_energy_density")
paw_setuploc%pseudo_core_kinetic_energy_density%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%pseudo_core_kinetic_energy_density%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%pseudo_core_kinetic_energy_density%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%pseudo_core_kinetic_energy_density%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%pseudo_core_kinetic_energy_density%data,(mesh_size))
rp=>paw_setuploc%pseudo_core_kinetic_energy_density
in_data=.true.
ndata = 0
case ("kresse_joubert_local_ionic_potential")
paw_setuploc%kresse_joubert_local_ionic_potential%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%kresse_joubert_local_ionic_potential%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%kresse_joubert_local_ionic_potential%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%kresse_joubert_local_ionic_potential%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%kresse_joubert_local_ionic_potential%data,(mesh_size))
rp=>paw_setuploc%kresse_joubert_local_ionic_potential
in_data=.true.
ndata = 0
case ("blochl_local_ionic_potential")
paw_setuploc%blochl_local_ionic_potential%tread=.true.
value = getValue(attributes,"grid")
if (value == "" ) value = "unknown"
paw_setuploc%blochl_local_ionic_potential%grid=trim(value)
value = getValue(attributes,"state")
if (value == "" ) value = "unknown"
paw_setuploc%blochl_local_ionic_potential%state=trim(value)
do ii=1,igrid
if(trim(paw_setuploc%blochl_local_ionic_potential%grid)==trim(grids(ii)%id)) then
mesh_size=grids(ii)%iend-grids(ii)%istart+1
end if
end do
LIBPAW_ALLOCATE(paw_setuploc%blochl_local_ionic_potential%data,(mesh_size))
rp=>paw_setuploc%blochl_local_ionic_potential
in_data=.true.
ndata = 0
case ("kinetic_energy_differences")
paw_setuploc%kinetic_energy_differences%tread=.true.
mesh_size=paw_setuploc%valence_states%nval*paw_setuploc%valence_states%nval
LIBPAW_ALLOCATE(paw_setuploc%kinetic_energy_differences%data,(mesh_size))
rp=>paw_setuploc%kinetic_energy_differences
in_data=.true.
ndata = 0
end select
end subroutine paw_begin_element1
!!***
!-------------------------------------------------------------------------
!!****f* m_pawxmlps/paw_end_element1
!! NAME
!! end_element
!!
!! FUNCTION
!! End XML tag effect: switches flags in private data of this module
!!
!! INPUTS
!! namespaceURI = universal resource indicator for XML namespace??? Not used.
!! localName = local equivalent of tag name?? Not used.
!! name = name of XML tag which has been read in
!!
!! OUTPUT
!! side effect: private data flags in present module are turned to .false.
!!
!! SOURCE
subroutine paw_end_element1(namespaceURI,localName,name)
character(len=*),intent(in) :: namespaceURI,localName,name
character(len=100) :: msg,value
!Just to fool abirules
value=localName
value=namespaceURI
select case(name)
case ("generator")
in_generator = .false.
case ("valence_states")
in_valenceStates = .false.
if(ival>50) then
msg="ival>50"
LIBPAW_ERROR(msg)
end if
if(ival>0)then
LIBPAW_DATATYPE_ALLOCATE(paw_setuploc%valence_states%state,(ival))
paw_setuploc%valence_states%state(ival)%tread=.true.
paw_setuploc%valence_states%nval=ival
do ii=1,ival
paw_setuploc%valence_states%state(ii)=valstate(ii)
end do
end if
LIBPAW_DATATYPE_DEALLOCATE(valstate)
if(.not.allocated(paw_setuploc%ae_partial_wave)) then
LIBPAW_DATATYPE_ALLOCATE(paw_setuploc%ae_partial_wave,(paw_setuploc%valence_states%nval))
end if
if(.not.allocated(paw_setuploc%pseudo_partial_wave)) then
LIBPAW_DATATYPE_ALLOCATE(paw_setuploc%pseudo_partial_wave,(paw_setuploc%valence_states%nval))
end if
if(.not.allocated(paw_setuploc%projector_function)) then
LIBPAW_DATATYPE_ALLOCATE(paw_setuploc%projector_function,(paw_setuploc%valence_states%nval))
end if
case ("paw_setup")
if(igrid>10) then
msg="igrid>10"
LIBPAW_ERROR(msg)
end if
LIBPAW_DATATYPE_ALLOCATE(paw_setuploc%radial_grid,(igrid))
paw_setuploc%radial_grid(igrid)%tread=.true.
paw_setuploc%ngrid=igrid
do ii=1,igrid
paw_setuploc%radial_grid(ii)=grids(ii)
end do
LIBPAW_DATATYPE_DEALLOCATE(grids)
do ii=1,igrid
if(trim(paw_setuploc%shape_function%grid)==trim(paw_setuploc%radial_grid(ii)%id)) then
mesh_size=paw_setuploc%radial_grid(ii)%iend-paw_setuploc%radial_grid(ii)%istart+1
end if
end do
if(ishpf>10) then
msg="ishpf>7"
LIBPAW_ERROR(msg)
end if
LIBPAW_ALLOCATE(paw_setuploc%shape_function%data,(mesh_size,ishpf))
do ii=1,ishpf
paw_setuploc%shape_function%data(:,ii)=shpf(ii)%data(:)
LIBPAW_DEALLOCATE(shpf(ii)%data)
end do
LIBPAW_DATATYPE_DEALLOCATE(shpf)
case ("shape_function")
in_data=.false.
case ("pseudo_partial_wave")
in_data=.false.
case ("ae_partial_wave")
in_data=.false.
case ("projector_function")
in_data=.false.
case ("ae_core_density")
in_data=.false.
case ("pseudo_core_density")
in_data=.false.
case ("pseudo_valence_density")
in_data=.false.
case ("zero_potential")
in_data=.false.