-
Notifications
You must be signed in to change notification settings - Fork 0
/
m_paw_an.F90
2268 lines (2065 loc) · 78.3 KB
/
m_paw_an.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_paw_an
!! NAME
!! m_paw_an
!!
!! FUNCTION
!! This module contains the definition of the paw_an_type structured datatype,
!! as well as related functions and methods.
!! paw_an_type variables contain various arrays given on ANgular mesh or ANgular moments
!! for a given atom.
!!
!! COPYRIGHT
!! Copyright (C) 2013-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_paw_an
USE_DEFS
USE_MSG_HANDLING
USE_MPI_WRAPPERS
USE_MEMORY_PROFILING
use m_paral_atom, only : get_my_atmtab, free_my_atmtab, get_my_natom
use m_pawang, only : pawang_type
use m_pawtab, only : pawtab_type
implicit none
private
!public procedures.
public :: paw_an_init
public :: paw_an_free
public :: paw_an_nullify
public :: paw_an_copy
public :: paw_an_print
public :: paw_an_gather
public :: paw_an_redistribute
public :: paw_an_reset_flags
!private procedures.
private :: paw_an_isendreceive_getbuffer
private :: paw_an_isendreceive_fillbuffer
!!***
!----------------------------------------------------------------------
!!****t* m_paw_an/paw_an_type
!! NAME
!! paw_an_type
!!
!! FUNCTION
!! For PAW, various arrays given on ANgular mesh or ANgular moments
!!
!! SOURCE
type,public :: paw_an_type
! WARNING : if you modify this datatype, please check whether there might be creation/destruction/copy routines,
! declared in another part of ABINIT, that might need to take into account your modification.
!Integer scalars
integer :: angl_size
! Dimension of paw angular mesh (angl_size=ntheta*nphi)
integer :: cplex
! cplex=1 if potentials/densities are real, 2 if they are complex
integer :: has_kxc
! set to 1 if xc kernels kxc1 and kxct1 are allocated and used
! 2 if they are already computed
integer :: has_k3xc
! set to 1 if xc kernel derivatives k3xc1 and k3xct1 are allocated and used
! 2 if it is already computed
integer :: has_vhartree
! set to 1 if vh1 and vht1 are allocated and used
! 2 if they are already computed
integer :: has_vxc
! set to 1 if vxc1 and vxct1 are allocated and used
! 2 if they are already computed
integer :: has_vxctau
! set to 1 if vxctau1 and vxcttau1 are allocated and used
! 2 if they are already computed
integer :: has_vxcval
! set to 1 if vxc1_val and vxct1_val are allocated and used
! 2 if they are already computed
integer :: has_vxc_ex
! set to 1 if vxc_ex and is allocated and used
! 2 if it is already computed
integer :: itypat
! itypat=type of the atom
integer :: lm_size
! lm_size=(l_size)**2
! l is Maximum value of l+1 leading to non zero Gaunt coeffs (l_size=2*l_max+1)
integer :: mesh_size
! Dimension of radial mesh for arrays contained in this paw_an datastructure
! May be different from pawrad%mesh_size
integer :: nkxc1
! number of independent components of Kxc1 and Kxct1
! (usually 3 for LDA, 23 for GGA)
integer :: nk3xc1
! number of independent components of K3xc1 and K3xct1
! (usually 4 for LDA, not available for GGA)
integer :: nspden
! Number of spin-density components
!Logical arrays
logical, allocatable :: lmselect(:)
! lmselect(lm_size)
! lmselect(ilm)=select the non-zero LM-moments of "one-center" densities/potentials
!Real (real(dp)) arrays
real(dp), allocatable :: kxc1 (:,:,:)
! kxc1(cplex*mesh_size,lm_size or angl_size,nkxc1)
! Gives xc kernel inside the sphere
! (theta,phi) values of kernel if pawxcdev=0
! LM-moments of kernel if pawxcdev/=0
real(dp), allocatable :: kxct1 (:,:,:)
! kxct1(cplex*mesh_size,lm_size or angl_size,nkxc1)
! Gives xc pseudo kernel inside the sphere
! (theta,phi) values of kernel if pawxcdev=0
! LM-moments of kernel if pawxcdev/=0
real(dp), allocatable :: k3xc1 (:,:,:)
! k3xc1(cplex*mesh_size,lm_size or angl_size,nk3xc1)
! Gives xc kernel derivative inside the sphere
! (theta,phi) values of kernel derivative if pawxcdev=0
! LM-moments of kernel derivative if pawxcdev/=0 => NOT AVAILABLE YET
real(dp), allocatable :: k3xct1 (:,:,:)
! k3xct1(cplex*mesh_size,lm_size or angl_size,nk3xc1)
! Gives xc pseudo kernel derivative inside the sphere
! (theta,phi) values of kernel derivative if pawxcdev=0
! LM-moments of kernel derivative if pawxcdev/=0 => NOT AVAILABLE YET
real(dp), allocatable :: vh1 (:,:,:)
! vh1(cplex*mesh_size,lm_size,nspden)
! Gives Hartree potential LM-moments inside the sphere
real(dp), allocatable :: vht1 (:,:,:)
! vht1(cplex*mesh_size,lm_size,nspden)
! Gives Hartree tilde potential LM-moments inside the sphere
real(dp), allocatable :: vxc1 (:,:,:)
! vxc1(cplex*mesh_size,lm_size or angl_size,nspden)
! Gives xc potential inside the sphere
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
real(dp), allocatable :: vxctau1 (:,:,:)
! vxctau1(cplex*mesh_size,lm_size or angl_size,nspden)
! Gives xc potential inside the sphere
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
real(dp), allocatable :: vxc1_val (:,:,:)
! vxc1_val(cplex*mesh_size,lm_size or angl_size,nspden) (Usually real, Mainly used for GW)
! Gives xc potential inside the sphere arising from valence only electrons
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
real(dp), allocatable :: vxct1 (:,:,:)
! vxct1(cplex*mesh_size,angl_size,nspden)
! Gives xc pseudo potential inside the sphere
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
real(dp), allocatable :: vxcttau1 (:,:,:)
! vxcttau1(cplex*mesh_size,angl_size,nspden)
! Gives xc pseudo potential inside the sphere
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
real(dp), allocatable :: vxct1_val (:,:,:)
! vxct1_val(cplex*mesh_size,angl_size,nspden) (Usually real, Mainly used for GW)
! Gives xc pseudo potential inside the sphere
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
real(dp), allocatable :: vxc_ex (:,:,:)
! vxc_ex(cplex*mesh_size,angl_size,nspden)
! Gives xc potential for local exact exchange inside the sphere
! (theta,phi) values of potential if pawxcdev=0
! LM-moments of potential if pawxcdev/=0
end type paw_an_type
!!***
CONTAINS
!===========================================================
!!***
!----------------------------------------------------------------------
!!****f* m_paw_an/paw_an_init
!! NAME
!! paw_an_init
!!
!! FUNCTION
!! Initialize a paw_an data type.
!!
!! INPUTS
!! mpi_atmtab(:)=--optional-- indexes of the atoms treated by current proc
!! comm_atom=--optional-- MPI communicator over atoms
!!
!! SIDE EFFECTS
!! Paw_an(:)<type(paw_an_type)>=PAW arrays given on ANgular mesh or ANgular moments.
!! Initialized in output
!!
!! SOURCE
subroutine paw_an_init(Paw_an,natom,ntypat,nkxc1,nk3xc1,nspden,cplex,pawxcdev,typat,Pawang,Pawtab,&
& has_vhartree,has_vxc,has_vxctau,has_vxcval,has_kxc,has_k3xc,has_vxc_ex, & ! optional arguments
& mpi_atmtab,comm_atom) ! optional arguments (parallelism)
!Arguments ------------------------------------
!scalars
integer,intent(in) :: natom,nkxc1,nk3xc1,ntypat,cplex,nspden,pawxcdev
integer,optional,intent(in) :: has_vhartree,has_vxc,has_vxctau,has_vxcval,has_kxc,has_k3xc,has_vxc_ex
integer,optional,intent(in) :: comm_atom
!arrays
integer,intent(in) :: typat(natom)
integer,optional,target,intent(in) :: mpi_atmtab(:)
type(Pawang_type),intent(in) :: Pawang
type(Pawtab_type),intent(in) :: Pawtab(ntypat)
type(Paw_an_type),intent(inout) :: Paw_an(:)
!Local variables-------------------------------
!scalars
integer :: iat,iat1,itypat,lm_size,my_comm_atom,my_natom,v_size
logical :: my_atmtab_allocated,paral_atom
!arrays
integer,pointer :: my_atmtab(:)
! *************************************************************************
!@Paw_an_type
!Set up parallelism over atoms
my_natom=size(Paw_an);if (my_natom==0) return
paral_atom=(present(comm_atom).and.(my_natom/=natom))
nullify(my_atmtab);if (present(mpi_atmtab)) my_atmtab => mpi_atmtab
my_comm_atom=xpaw_mpi_comm_self;if (present(comm_atom)) my_comm_atom=comm_atom
call get_my_atmtab(my_comm_atom,my_atmtab,my_atmtab_allocated,paral_atom,natom,my_natom_ref=my_natom)
do iat=1,my_natom
iat1=iat;if (paral_atom) iat1=my_atmtab(iat)
itypat=typat(iat1)
lm_size =Pawtab(itypat)%lcut_size**2
Paw_an(iat)%angl_size =Pawang%angl_size
Paw_an(iat)%cplex =cplex
Paw_an(iat)%itypat =itypat
Paw_an(iat)%lm_size =lm_size
Paw_an(iat)%mesh_size =Pawtab(itypat)%mesh_size
Paw_an(iat)%nkxc1 =nkxc1
Paw_an(iat)%nk3xc1 =nk3xc1
Paw_an(iat)%nspden =nspden
! === Non-zero LM-moments of "one-center" densities/potentials ===
! * Filled in pawdenpot.
LIBPAW_ALLOCATE(Paw_an(iat)%lmselect,(lm_size))
v_size=Paw_an(iat)%lm_size ; if (pawxcdev==0) v_size=Paw_an(iat)%angl_size
! === XC potential inside the sphere ===
! * LM-moments of potential if pawxcdev/=0
! * (theta,phi) values of potential if pawxcdev=0
Paw_an(iat)%has_vxc=0
if (PRESENT(has_vxc)) then
if (has_vxc>0) then
Paw_an(iat)%has_vxc=1
LIBPAW_ALLOCATE(Paw_an(iat)%vxc1 ,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(Paw_an(iat)%vxct1,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
Paw_an(iat)%vxc1=zero;Paw_an(iat)%vxct1=zero
end if
end if
Paw_an(iat)%has_vxctau=0
if (PRESENT(has_vxctau)) then
if (has_vxctau>0) then
Paw_an(iat)%has_vxctau=1
LIBPAW_ALLOCATE(Paw_an(iat)%vxctau1 ,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(Paw_an(iat)%vxcttau1,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
Paw_an(iat)%vxctau1=zero;Paw_an(iat)%vxcttau1=zero
end if
end if
! ==========================
! === Optional arguments ===
! ==========================
! * XC potential inside PAW spheres generated by valence electrons
Paw_an(iat)%has_vxcval=0
if (PRESENT(has_vxcval)) then
if (has_vxcval>0) then
Paw_an(iat)%has_vxcval=1
LIBPAW_ALLOCATE(Paw_an(iat)%vxc1_val ,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(Paw_an(iat)%vxct1_val,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
Paw_an(iat)%vxc1_val=zero;Paw_an(iat)%vxct1_val=zero
end if
end if
! * Hartree potential LM-moments inside the sphere
Paw_an(iat)%has_vhartree=0
if (PRESENT(has_vhartree)) then
if (has_vhartree>0) then
Paw_an(iat)%has_vhartree=1
LIBPAW_ALLOCATE(Paw_an(iat)%vh1,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(Paw_an(iat)%vht1,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
Paw_an(iat)%vh1=zero;Paw_an(iat)%vht1=zero
end if
end if
! xc kernels inside the sphere
Paw_an(iat)%has_kxc=0
if (PRESENT(has_kxc)) then
if (has_kxc>0) then
Paw_an(iat)%has_kxc=1
LIBPAW_ALLOCATE(Paw_an(iat)%kxc1 ,(cplex*Paw_an(iat)%mesh_size,v_size,nkxc1))
LIBPAW_ALLOCATE(Paw_an(iat)%kxct1,(cplex*Paw_an(iat)%mesh_size,v_size,nkxc1))
if (nkxc1>0) then
Paw_an(iat)%kxc1=zero;Paw_an(iat)%kxct1=zero
end if
end if
end if
! xc kernel derivatives inside the sphere
Paw_an(iat)%has_k3xc=0
if (PRESENT(has_k3xc)) then
if (has_k3xc>0) then
Paw_an(iat)%has_k3xc=1
LIBPAW_ALLOCATE(Paw_an(iat)%k3xc1 ,(cplex*Paw_an(iat)%mesh_size,v_size,nk3xc1))
LIBPAW_ALLOCATE(Paw_an(iat)%k3xct1,(cplex*Paw_an(iat)%mesh_size,v_size,nk3xc1))
if (nk3xc1>0) then
Paw_an(iat)%k3xc1=zero;Paw_an(iat)%k3xct1=zero
end if
end if
end if
! local exact-exchange potential inside the sphere
Paw_an(iat)%has_vxc_ex=0
if (PRESENT(has_vxc_ex)) then
if (has_vxc_ex>0.and.Pawtab(itypat)%useexexch/=0) then
Paw_an(iat)%has_vxc_ex=1
LIBPAW_ALLOCATE(Paw_an(iat)%vxc_ex,(cplex*Paw_an(iat)%mesh_size,v_size,nspden))
Paw_an(iat)%vxc_ex=zero
end if
end if
end do !iat
!Destroy atom table used for parallelism
call free_my_atmtab(my_atmtab,my_atmtab_allocated)
end subroutine paw_an_init
!!***
!----------------------------------------------------------------------
!!****f* m_paw_an/paw_an_free
!! NAME
!! paw_an_free
!!
!! FUNCTION
!! Deallocate pointers and nullify flags in a paw_an structure
!!
!! SIDE EFFECTS
!! Paw_an(:)<type(Paw_an_type)>=various arrays given on ANgular mesh or ANgular moments
!!
!! All associated pointers in Paw_an(:) are deallocated
!!
!! SOURCE
subroutine paw_an_free(Paw_an)
!Arguments ------------------------------------
!arrays
type(Paw_an_type),intent(inout) :: Paw_an(:)
!Local variables-------------------------------
integer :: iat,natom
! *************************************************************************
!@Paw_an_type
natom=SIZE(Paw_an);if (natom==0) return
do iat=1,natom
if (allocated(Paw_an(iat)%lmselect )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%lmselect)
end if
if (allocated(Paw_an(iat)%vh1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vh1)
end if
if (allocated(Paw_an(iat)%vht1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vht1)
end if
if (allocated(Paw_an(iat)%vxc1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxc1)
end if
if (allocated(Paw_an(iat)%vxctau1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxctau1)
end if
if (allocated(Paw_an(iat)%vxc1_val )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxc1_val)
end if
if (allocated(Paw_an(iat)%vxct1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxct1)
end if
if (allocated(Paw_an(iat)%vxcttau1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxcttau1)
end if
if (allocated(Paw_an(iat)%vxct1_val)) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxct1_val)
end if
if (allocated(Paw_an(iat)%kxc1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%kxc1)
end if
if (allocated(Paw_an(iat)%kxct1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%kxct1)
end if
if (allocated(Paw_an(iat)%k3xc1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%k3xc1)
end if
if (allocated(Paw_an(iat)%k3xct1 )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%k3xct1)
end if
if (allocated(Paw_an(iat)%vxc_ex )) then
LIBPAW_DEALLOCATE(Paw_an(iat)%vxc_ex)
end if
! === Reset all has_* flags ===
Paw_an(iat)%has_kxc =0
Paw_an(iat)%has_k3xc =0
Paw_an(iat)%has_vhartree=0
Paw_an(iat)%has_vxc =0
Paw_an(iat)%has_vxctau =0
Paw_an(iat)%has_vxcval =0
Paw_an(iat)%has_vxc_ex =0
end do !iat
end subroutine paw_an_free
!!***
!----------------------------------------------------------------------
!!****f* m_paw_an/paw_an_nullify
!! NAME
!! paw_an_nullify
!!
!! FUNCTION
!! Nullify pointers and flags in a paw_an structure
!!
!! INPUTS
!!
!! SIDE EFFECTS
!! Paw_an(:)<type(paw_an_type)>=PAW arrays given on ANgular mesh or ANgular moments.
!! Nullified in output
!!
!! SOURCE
subroutine paw_an_nullify(Paw_an)
!Arguments ------------------------------------
type(Paw_an_type),intent(inout) :: Paw_an(:)
!Local variables-------------------------------
integer :: iat,natom
! *************************************************************************
!@Paw_an_type
! MGPAW: This one could be removed/renamed,
! variables can be initialized in the datatype declaration
! Do we need to expose this in the public API?
natom=SIZE(Paw_an(:));if (natom==0) return
do iat=1,natom
! Set all has_* flags to zero.
Paw_an(iat)%has_kxc =0
Paw_an(iat)%has_k3xc =0
Paw_an(iat)%has_vhartree =0
Paw_an(iat)%has_vxc =0
Paw_an(iat)%has_vxctau =0
Paw_an(iat)%has_vxcval =0
Paw_an(iat)%has_vxc_ex =0
end do
end subroutine paw_an_nullify
!!***
!----------------------------------------------------------------------
!!****f* m_paw_an/paw_an_copy
!! NAME
!! paw_an_copy
!!
!! FUNCTION
!! Copy one paw_an datastructure into another
!! Can take into accound changes of dimensions
!! Can copy a shared paw_an into distributed ones (when parallelism is activated)
!!
!! INPUTS
!! mpi_atmtab(:)=--optional-- indexes of the atoms treated by current proc
!! comm_atom=--optional-- MPI communicator over atoms
!! paw_an_in(:)<type(paw_an_type)>= input paw_an datastructure
!!
!! SIDE EFFECTS
!! paw_an_cpy(:)<type(paw_an_type)>= output paw_an datastructure
!!
!! NOTES
!! paw_an_cpy must have been allocated in the calling function.
!!
!! SOURCE
subroutine paw_an_copy(paw_an_in,paw_an_cpy,&
& mpi_atmtab,comm_atom) ! optional arguments (parallelism)
!Arguments ------------------------------------
!scalars
integer,optional,intent(in) :: comm_atom
!arrays
integer,optional,target,intent(in) :: mpi_atmtab(:)
type(Paw_an_type),intent(in),target :: paw_an_in(:)
type(Paw_an_type),intent(inout),target :: paw_an_cpy(:)
!Local variables-------------------------------
!scalars
integer :: cplx_mesh_size,ij,ij1,lm_size,my_comm_atom,my_natom,nkxc1,nk3xc1,npaw_an_in
integer :: npaw_an_max,npaw_an_out,nspden,paral_case,v_size,sz1
logical :: my_atmtab_allocated,paral_atom
character(len=500) :: msg
type(Paw_an_type),pointer :: paw_an_in1, paw_an_out1
!arrays
integer,pointer :: my_atmtab(:)
type(Paw_an_type), pointer :: paw_an_out(:)
! *************************************************************************
!@Paw_an_type
!Retrieve sizes
npaw_an_in=size(paw_an_in);npaw_an_out=size(paw_an_cpy)
!Set up parallelism over atoms
paral_atom=(present(comm_atom));if (paral_atom) paral_atom=(xpaw_mpi_comm_size(comm_atom)>1)
nullify(my_atmtab);if (present(mpi_atmtab)) my_atmtab => mpi_atmtab
my_comm_atom=xpaw_mpi_comm_self;if (present(comm_atom)) my_comm_atom=comm_atom
my_atmtab_allocated=.false.
!Determine in which case we are (parallelism, ...)
!No parallelism: a single copy operation
paral_case=0;npaw_an_max=npaw_an_in
paw_an_out => paw_an_cpy
if (paral_atom) then
if (npaw_an_out<npaw_an_in) then ! Parallelism: the copy operation is a scatter
call get_my_natom(my_comm_atom,my_natom,npaw_an_in)
if (my_natom==npaw_an_out) then
call get_my_atmtab(my_comm_atom,my_atmtab,my_atmtab_allocated,paral_atom,npaw_an_in)
paral_case=1;npaw_an_max=npaw_an_out
paw_an_out => paw_an_cpy
else
msg=' npaw_an_out should be equal to my_natom !'
LIBPAW_BUG(msg)
end if
else ! Parallelism: the copy operation is a gather
call get_my_natom(my_comm_atom,my_natom,npaw_an_out)
if (my_natom==npaw_an_in) then
paral_case=2;npaw_an_max=npaw_an_in
else
msg=' npaw_ij_in should be equal to my_natom !'
LIBPAW_BUG(msg)
end if
end if
end if
!First case: a simple copy or a scatter
if (npaw_an_max>0.and.((paral_case==0).or.(paral_case==1))) then
call paw_an_free(paw_an_cpy)
call paw_an_nullify(paw_an_cpy)
! Loop on paw_ij components
do ij1=1,npaw_an_max
ij=ij1; if (paral_case==1) ij=my_atmtab(ij1)
paw_an_in1=>paw_an_in(ij)
paw_an_out1=>paw_an_out(ij1)
paw_an_out1%angl_size =paw_an_in1%angl_size
paw_an_out1%cplex =paw_an_in1%cplex
paw_an_out1%has_kxc =paw_an_in1%has_kxc
paw_an_out1%has_k3xc =paw_an_in1%has_k3xc
paw_an_out1%has_vhartree =paw_an_in1%has_vhartree
paw_an_out1%has_vxc =paw_an_in1%has_vxc
paw_an_out1%has_vxctau =paw_an_in1%has_vxctau
paw_an_out1%has_vxcval =paw_an_in1%has_vxcval
paw_an_out1%has_vxc_ex =paw_an_in1%has_vxc_ex
paw_an_out1%itypat =paw_an_in1%itypat
paw_an_out1%lm_size =paw_an_in1%lm_size
paw_an_out1%mesh_size =paw_an_in1%mesh_size
paw_an_out1%nkxc1 =paw_an_in1%nkxc1
paw_an_out1%nk3xc1 =paw_an_in1%nk3xc1
paw_an_out1%nspden =paw_an_in1%nspden
if (allocated(paw_an_in1%lmselect)) then
sz1=size(paw_an_in1%lmselect)
LIBPAW_ALLOCATE(paw_an_out1%lmselect,(sz1))
paw_an_out1%lmselect(:)=paw_an_in1%lmselect(:)
end if
v_size=0
if (paw_an_in1%has_vxc>0) then
v_size=size(paw_an_in1%vxc1,2)
else if (paw_an_in1%has_vxctau>0) then
v_size=size(paw_an_in1%vxctau1,2)
else if (paw_an_in1%has_kxc>0) then
v_size=size(paw_an_in1%kxc1,2)
else if (paw_an_in1%has_k3xc>0) then
v_size=size(paw_an_in1%k3xc1,2)
else if (paw_an_in1%has_vxcval>0) then
v_size=size(paw_an_in1%vxc1_val,2)
else if (paw_an_in1%has_vxc_ex>0) then
v_size=size(paw_an_in1%vxc_ex,2)
else if (paw_an_in1%has_vhartree>0) then
v_size=size(paw_an_in1%vh1,2)
end if
nspden=paw_an_in1%nspden
lm_size=paw_an_in1%lm_size
cplx_mesh_size=paw_an_in1%cplex*paw_an_in1%mesh_size
nkxc1=paw_an_in1%nkxc1
if (paw_an_in1%has_kxc>0) then
LIBPAW_ALLOCATE(paw_an_out1%kxc1,(cplx_mesh_size,v_size,nkxc1))
LIBPAW_ALLOCATE(paw_an_out1%kxct1,(cplx_mesh_size,v_size,nkxc1))
if (paw_an_in1%has_kxc==2.and.nkxc1>0) then
paw_an_out1%kxc1(:,:,:)=paw_an_in1%kxc1(:,:,:)
paw_an_out1%kxct1(:,:,:)=paw_an_in1%kxct1(:,:,:)
end if
end if
nk3xc1=paw_an_in1%nk3xc1
if (paw_an_in1%has_k3xc>0) then
LIBPAW_ALLOCATE(paw_an_out1%k3xc1,(cplx_mesh_size,v_size,nk3xc1))
LIBPAW_ALLOCATE(paw_an_out1%k3xct1,(cplx_mesh_size,v_size,nk3xc1))
if (paw_an_in1%has_k3xc==2.and.nk3xc1>0) then
paw_an_out1%k3xc1(:,:,:)=paw_an_in1%k3xc1(:,:,:)
paw_an_out1%k3xct1(:,:,:)=paw_an_in1%k3xct1(:,:,:)
end if
end if
if (paw_an_in1%has_vhartree>0) then
LIBPAW_ALLOCATE(paw_an_out1%vh1,(cplx_mesh_size,lm_size,nspden))
LIBPAW_ALLOCATE(paw_an_out1%vht1,(cplx_mesh_size,lm_size,nspden))
if (paw_an_in1%has_vhartree==2) then
paw_an_out1%vh1(:,:,:)=paw_an_in1%vh1(:,:,:)
paw_an_out1%vht1(:,:,:)=paw_an_in1%vht1(:,:,:)
end if
end if
if (paw_an_in1%has_vxc>0) then
LIBPAW_ALLOCATE(paw_an_out1%vxc1,(cplx_mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(paw_an_out1%vxct1,(cplx_mesh_size,v_size,nspden))
if (paw_an_in1%has_vxc==2) then
paw_an_out1%vxc1(:,:,:)=paw_an_in1%vxc1(:,:,:)
paw_an_out1%vxct1(:,:,:)=paw_an_in1%vxct1(:,:,:)
end if
end if
if (paw_an_in1%has_vxctau>0) then
LIBPAW_ALLOCATE(paw_an_out1%vxctau1,(cplx_mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(paw_an_out1%vxcttau1,(cplx_mesh_size,v_size,nspden))
if (paw_an_in1%has_vxc==2) then
paw_an_out1%vxctau1(:,:,:)=paw_an_in1%vxctau1(:,:,:)
paw_an_out1%vxcttau1(:,:,:)=paw_an_in1%vxcttau1(:,:,:)
end if
end if
if (paw_an_in1%has_vxcval>0) then
LIBPAW_ALLOCATE(paw_an_out1%vxc1_val,(cplx_mesh_size,v_size,nspden))
LIBPAW_ALLOCATE(paw_an_out1%vxct1_val,(cplx_mesh_size,v_size,nspden))
if (paw_an_in1%has_vxcval==2) then
paw_an_out1%vxc1_val(:,:,:)=paw_an_in1%vxc1_val(:,:,:)
paw_an_out1%vxct1_val(:,:,:)=paw_an_in1%vxct1_val(:,:,:)
end if
end if
if (paw_an_in1%has_vxc_ex>0) then
LIBPAW_ALLOCATE(paw_an_out1%vxc_ex,(cplx_mesh_size,v_size,nspden))
if (paw_an_in1%has_vxc_ex==2) then
paw_an_out1%vxc_ex(:,:,:)=paw_an_in1%vxc_ex(:,:,:)
end if
end if
end do
end if
!Second case: a gather
if (paral_case==2) then
call paw_an_gather(paw_an_in,paw_an_cpy,-1,my_comm_atom,my_atmtab)
end if
!Destroy atom table used for parallelism
call free_my_atmtab(my_atmtab,my_atmtab_allocated)
end subroutine paw_an_copy
!!***
!----------------------------------------------------------------------
!!****f* m_paw_an/paw_an_print
!! NAME
!! paw_an_print
!!
!! FUNCTION
!! Reports basic info on a paw_an datastructure
!!
!! INPUTS
!! [unit]=the unit number for output
!! [mode_paral]=either "COLL" or "PERS"
!! [mpi_atmtab(:)]=indexes of the atoms treated by current proc (can be computed here)
!! [comm_atom]=MPI communicator over atoms (needed if parallelism over atoms is activated)
!! [natom]=total number of atom (needed if parallelism over atoms is activated)
!! if Paw_an is distributed, natom is different from size(Paw_an).
!!
!! OUTPUT
!! (only writing)
!!
!! SOURCE
subroutine paw_an_print(Paw_an,unit,mode_paral, &
& mpi_atmtab,comm_atom,natom)
!Arguments ------------------------------------
!scalars
integer,optional,intent(in) :: comm_atom,natom,unit
character(len=4),optional,intent(in) :: mode_paral
!arrays
integer,optional,target,intent(in) :: mpi_atmtab(:)
type(Paw_an_type),intent(in) :: Paw_an(:)
!Local variables-------------------------------
!scalars
integer :: iatom,iatom_tot,my_comm_atom,my_natom,my_unt,size_paw_an
logical :: my_atmtab_allocated,paral_atom
character(len=4) :: my_mode
character(len=500) :: msg
!arrays
integer,pointer :: my_atmtab(:)
! *************************************************************************
!@Paw_an_type
size_paw_an=SIZE(Paw_an)
my_unt =std_out; if (PRESENT(unit )) my_unt =unit
my_mode ='PERS' ; if (PRESENT(mode_paral)) my_mode =mode_paral
my_natom=size_paw_an; if (PRESENT(natom)) my_natom=natom
!Set up parallelism over atoms
paral_atom=(present(comm_atom).and.my_natom/=size_paw_an)
nullify(my_atmtab);if (present(mpi_atmtab)) my_atmtab => mpi_atmtab
my_comm_atom=xpaw_mpi_comm_self;if (present(comm_atom)) my_comm_atom=comm_atom
call get_my_atmtab(my_comm_atom,my_atmtab,my_atmtab_allocated,paral_atom,my_natom,my_natom_ref=size_paw_an)
write(msg,'(3a)')ch10,' === Content of the pawfgrtab datatype === ',ch10
call wrtout(my_unt,msg,my_mode)
do iatom=1,my_natom
iatom_tot=iatom;if (paral_atom) iatom_tot=my_atmtab(iatom)
write(msg,'(a)')' '
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' ****************************** iatom= ' , iatom_tot
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' Dimension of paw angular mesh= ',paw_an(iatom)%angl_size
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' cplex (1 if potentials/densities are real, 2 if they are complex)= ',&
& paw_an(iatom)%cplex
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_kxc = ',paw_an(iatom)%has_kxc
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_k3xc = ',paw_an(iatom)%has_k3xc
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_vhartree= ',paw_an(iatom)%has_vhartree
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_vxc = ',paw_an(iatom)%has_vxc
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_vxctau = ',paw_an(iatom)%has_vxctau
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_vxcval = ',paw_an(iatom)%has_vxcval
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' has_vxc_ex = ',paw_an(iatom)%has_vxc_ex
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' Atome type = ',paw_an(iatom)%itypat
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' lm_size = ',paw_an(iatom)%lm_size
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' mesh_size = ',paw_an(iatom)%mesh_size
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' nkxc1 = ',paw_an(iatom)%nkxc1
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' nk3xc1 = ',paw_an(iatom)%nk3xc1
call wrtout(my_unt,msg,my_mode)
write(msg,'(a,i4)')' nspden = ',paw_an(iatom)%nspden
call wrtout(my_unt,msg,my_mode)
end do
end subroutine paw_an_print
!!***
!----------------------------------------------------------------------
!!****f* m_paw_an/paw_an_gather
!! NAME
!! paw_an_gather
!!
!! FUNCTION
!! (All)Gather paw_an datastructures
!!
!! INPUTS
!! master=master communicator receiving data ; if -1 do a ALLGATHER
!! comm_atom= communicator over atom
!! mpi_atmtab(:)=--optional-- indexes of the atoms treated by current calling proc
!! paw_an_in(:)<type(paw_an_type)>= input paw_an datastructures on every process
!!
!! OUTPUT
!! paw_an_gathered(:)<type(paw_an_type)>= output paw_an datastructure
!!
!! SOURCE
subroutine paw_an_gather(Paw_an_in,paw_an_gathered,master,comm_atom,mpi_atmtab)
!Arguments ------------------------------------
integer,intent(in) :: master,comm_atom
!arrays
integer,optional,target,intent(in) :: mpi_atmtab(:)
type(Paw_an_type),target,intent(in) :: Paw_an_in(:)
type(Paw_an_type),target,intent(inout) :: Paw_an_gathered(:)
!Local variables-------------------------------
!scalars
integer :: buf_dp_size,buf_dp_size_all,buf_int_size,buf_int_size_all,cplx_mesh_size
integer :: iat,iatot,ierr,has_lm_select,i1,i2,ij,indx_int,indx_dp
integer :: lm_size,me_atom
integer :: my_natom,natom,nkxc1,nk3xc1,npaw_an_in_sum,nproc_atom,nspden,v_size,sz1,sz2,sz3
logical :: my_atmtab_allocated,paral_atom
character(len=500) :: msg
type(Paw_an_type),pointer :: paw_an_in1,paw_an_gathered1
!arrays
integer :: bufsz(2)
integer,allocatable :: buf_int(:),buf_int_all(:)
integer,allocatable :: count_dp(:),count_int(:),count_tot(:),displ_dp(:),displ_int(:)
integer,pointer :: my_atmtab(:)
real(dp),allocatable :: buf_dp(:),buf_dp_all(:)
! *************************************************************************
!@Paw_an_type
if (master/=-1) then
msg='simple gather (master/=-1) not yet implemented !'
LIBPAW_BUG(msg)
end if
my_natom=size(paw_an_in);natom=size(paw_an_gathered)
!Set up parallelism over atoms
paral_atom=(my_natom/=natom)
nullify(my_atmtab);if (present(mpi_atmtab)) my_atmtab => mpi_atmtab
call get_my_atmtab(comm_atom,my_atmtab,my_atmtab_allocated,paral_atom,natom,my_natom_ref=my_natom)
nproc_atom=xpaw_mpi_comm_size(comm_atom)
me_atom=xpaw_mpi_comm_rank(comm_atom)
!Special case: one process (simple copy)
if (nproc_atom==1) then
if (master==-1.or.me_atom==master) then
call paw_an_free(paw_an_gathered)
call paw_an_nullify(paw_an_gathered)
do iat=1,my_natom
paw_an_in1=>paw_an_in(iat)
paw_an_gathered1%itypat =paw_an_in1%itypat
paw_an_gathered1%nspden =paw_an_in1%nspden
paw_an_gathered1%cplex =paw_an_in1%cplex
paw_an_gathered1%mesh_size =paw_an_in1%mesh_size
paw_an_gathered1%angl_size =paw_an_in1%angl_size
paw_an_gathered1%lm_size =paw_an_in1%lm_size
paw_an_gathered1%nkxc1 =paw_an_in1%nkxc1
paw_an_gathered1%nk3xc1 =paw_an_in1%nk3xc1
paw_an_gathered1%has_vxc =paw_an_in1%has_vxc
paw_an_gathered1%has_vxctau =paw_an_in1%has_vxctau
paw_an_gathered1%has_kxc =paw_an_in1%has_kxc
paw_an_gathered1%has_k3xc =paw_an_in1%has_k3xc
paw_an_gathered1%has_vxcval =paw_an_in1%has_vxcval
paw_an_gathered1%has_vxc_ex =paw_an_in1%has_vxc_ex
paw_an_gathered1%has_vhartree =paw_an_in1%has_vhartree
if (allocated(paw_an_in1%lmselect)) then
sz1=size(paw_an_in1%lmselect)
LIBPAW_ALLOCATE(paw_an_gathered1%lmselect,(sz1))
paw_an_gathered1%lmselect(:)=paw_an_in1%lmselect(:)
end if
if (allocated(paw_an_in1%vxc1)) then
sz1=size(paw_an_in1%vxc1,1);sz2=size(paw_an_in1%vxc1,2)
sz3=size(paw_an_in1%vxc1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vxc1,(sz1,sz2,sz3))
paw_an_gathered1%vxc1(:,:,:)=paw_an_in1%vxc1(:,:,:)
end if
if (allocated(paw_an_in1%vxctau1)) then
sz1=size(paw_an_in1%vxctau1,1);sz2=size(paw_an_in1%vxctau1,2)
sz3=size(paw_an_in1%vxctau1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vxctau1,(sz1,sz2,sz3))
paw_an_gathered1%vxctau1(:,:,:)=paw_an_in1%vxctau1(:,:,:)
end if
if (allocated(paw_an_in1%vxcttau1)) then
sz1=size(paw_an_in1%vxcttau1,1);sz2=size(paw_an_in1%vxcttau1,2)
sz3=size(paw_an_in1%vxcttau1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vxcttau1,(sz1,sz2,sz3))
paw_an_gathered1%vxcttau1(:,:,:)=paw_an_in1%vxcttau1(:,:,:)
end if
if (allocated(paw_an_in1%kxc1)) then
sz1=size(paw_an_in1%kxc1,1);sz2=size(paw_an_in1%kxc1,2)
sz3=size(paw_an_in1%kxc1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%kxc1,(sz1,sz2,sz3))
if (sz3>0) paw_an_gathered1%kxc1(:,:,:)=paw_an_in1%kxc1(:,:,:)
end if
if (allocated(paw_an_in1%k3xc1)) then
sz1=size(paw_an_in1%k3xc1,1);sz2=size(paw_an_in1%k3xc1,2)
sz3=size(paw_an_in1%k3xc1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%k3xc1,(sz1,sz2,sz3))
if (sz3>0) paw_an_gathered1%k3xc1(:,:,:)=paw_an_in1%k3xc1(:,:,:)
end if
if (allocated(paw_an_in1%kxct1)) then
sz1=size(paw_an_in1%kxct1,1);sz2=size(paw_an_in1%kxct1,2)
sz3=size(paw_an_in1%kxct1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%kxct1,(sz1,sz2,sz3))
if (sz3>0) paw_an_gathered1%kxct1(:,:,:)=paw_an_in1%kxct1(:,:,:)
end if
if (allocated(paw_an_in1%k3xct1)) then
sz1=size(paw_an_in1%k3xct1,1);sz2=size(paw_an_in1%k3xct1,2)
sz3=size(paw_an_in1%k3xct1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%k3xct1,(sz1,sz2,sz3))
if (sz3>0) paw_an_gathered1%k3xct1(:,:,:)=paw_an_in1%k3xct1(:,:,:)
end if
if (allocated(paw_an_in1%vxc1_val)) then
sz1=size(paw_an_in1%vxc1_val,1);sz2=size(paw_an_in1%vxc1_val,2)
sz3=size(paw_an_in1%vxc1_val,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vxc1_val,(sz1,sz2,sz3))
paw_an_gathered1%vxc1_val(:,:,:)=paw_an_in1%vxc1_val(:,:,:)
end if
if (allocated(paw_an_in1%vxct1_val)) then
sz1=size(paw_an_in1%vxct1_val,1);sz2=size(paw_an_in1%vxct1_val,2)
sz3=size(paw_an_in1%vxct1_val,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vxct1_val,(sz1,sz2,sz3))
paw_an_gathered1%vxct1_val(:,:,:)=paw_an_in1%vxct1_val(:,:,:)
end if
if (allocated(paw_an_in1%vxc_ex)) then
sz1=size(paw_an_in1%vxc_ex,1);sz2=size(paw_an_in1%vxc_ex,2)
sz3=size(paw_an_in1%vxc_ex,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vxc_ex,(sz1,sz2,sz3))
paw_an_gathered1%vxc_ex(:,:,:)=paw_an_in1%vxc_ex(:,:,:)
end if
if (allocated(paw_an_in1%vh1)) then
sz1=size(paw_an_in1%vh1,1);sz2=size(paw_an_in1%vh1,2)
sz3=size(paw_an_in1%vh1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vh1,(sz1,sz2,sz3))
paw_an_gathered1%vh1(:,:,:)=paw_an_in1%vh1(:,:,:)
end if
if (allocated(paw_an_in1%vht1)) then
sz1=size(paw_an_in1%vht1,1);sz2=size(paw_an_in1%vht1,2)
sz3=size(paw_an_in1%vht1,3)
LIBPAW_ALLOCATE(paw_an_gathered1%vht1,(sz1,sz2,sz3))
paw_an_gathered1%vht1(:,:,:)=paw_an_in1%vht1(:,:,:)
end if
end do
end if
return
end if
!Test on sizes
npaw_an_in_sum=my_natom
call xpaw_mpi_sum(npaw_an_in_sum,comm_atom,ierr)
if (master==-1) then
if (natom/=npaw_an_in_sum) then
msg='Wrong sizes sum[npaw_an_in]/=natom !'