120
120
use xcmod, only : nXCfunc, XCfunc, XCauth
121
121
use xcmod, only : XCweightX, XCweightC
122
122
use sys, only :die
123
use alloc, only : re_alloc, de_alloc
125
126
use parallel, only : Node, Nodes, ProcessorY
190
real(grid_p), dimension(:,:,:), allocatable, save ::
192
real(grid_p), dimension(:,:), allocatable, save ::
194
integer, dimension(:,:), allocatable, save ::
191
real(grid_p), dimension(:,:,:), pointer :: bdens, bvxc
192
real(grid_p), dimension(:,:), pointer :: bbuffer, dbuffer
193
integer, dimension(:,:), pointer :: PMesh
198
197
C Local variables and arrays
207
206
. DVCDN(mspin*mspin), DVXDN(mspin*mspin),
208
207
. EPSC, EPSX, F1, F2, GD(3,mspin),
209
208
. VOLCEL, volume, stress(3,3)
210
external GGAXC, LDAXC, RECLAT, VOLCEL, memory
209
external GGAXC, LDAXC, RECLAT, VOLCEL
212
211
C Start time counter (intended only for debugging and development)
213
212
call timer( 'cellXC', 1 )
311
310
C Allocate memory for border densities and potential
312
allocate(bdens(NSpan(1)*max(BlockSizeYMax,BlockSizeZMax),
314
call memory('A','X',NSpan(1)*max(BlockSizeYMax,BlockSizeZMax)*
315
. 4*NN*nspin,'cellxc')
316
allocate(bvxc(NSpan(1)*max(BlockSizeYMax,BlockSizeZMax),
318
call memory('A','X',NSpan(1)*max(BlockSizeYMax,BlockSizeZMax)*
319
. 4*NN*nspin,'cellxc')
321
call memory('A','I',12,'cellxc')
313
call re_alloc( bdens,
314
& 1, NSpan(1)*max(BlockSizeYMax,BlockSizeZMax),
315
& 1, 4*NN, 1, nspin, name='bdens',
319
& 1,NSpan(1)*max(BlockSizeYMax,BlockSizeZMax),
320
& 1, 4*NN, 1, nspin, name='bvxc',
323
call re_alloc( PMesh, 1, 3, 1, 4, name='PMesh',
323
326
C Exchange density information in the Z-direction
324
327
if (NMesh(3).ne.NMeshG(3)) then
334
337
C Find size of mesh at nodes to be exchanged with
335
338
call HowManyMeshPerNode(MeshNsm,Pleft3,Nodes,NMeshPN,
337
340
call HowManyMeshPerNode(MeshNsm,Pright3,Nodes,NMeshPN,
340
343
PMesh(ix,3) = PMesh(ix,3)*NSM
341
344
PMesh(ix,4) = PMesh(ix,4)*NSM
350
353
C Allocate arrays for data storage
351
354
nmax = max(nrleft,nrright)
352
allocate(bbuffer(nmax,2))
356
call re_alloc( bbuffer, 1, nmax, 1, 2, name='bbuffer',
353
358
nmax = max(nsleft,nsright)
354
allocate(dbuffer(nmax,2))
360
call re_alloc( dbuffer, 1, nmax, 1, 2, name='dbuffer',
356
363
C Build buffer transfer data array
430
437
C Find size of mesh at nodes to be exchanged with
431
438
call HowManyMeshPerNode(MeshNsm,Pleft2,Nodes,NMeshPN,
433
440
call HowManyMeshPerNode(MeshNsm,Pright2,Nodes,NMeshPN,
436
443
PMesh(ix,1) = PMesh(ix,1)*NSM
437
444
PMesh(ix,2) = PMesh(ix,2)*NSM
446
453
C Allocate transfer arrays
447
454
nmax = max(nrleft,nrright)
448
allocate(bbuffer(nmax,2))
456
call re_alloc( bbuffer, 1, nmax, 1, 2, name='bbuffer',
449
458
nmax = max(nsleft,nsright)
450
allocate(dbuffer(nmax,2))
460
call re_alloc( dbuffer, 1, nmax, 1, 2, name='dbuffer',
452
463
C Fill data array for sending
1199
1210
if (GGA.and.Nodes.gt.1.and..not.NoLocalPoints) then
1200
call memory('D','X',size(bdens),'cellxc')
1202
call memory('D','X',size(bvxc),'cellxc')
1204
call memory('D','I',size(PMesh),'cellxc')
1211
call de_alloc( bdens, name='bdens' )
1212
call de_alloc( bvxc, name='bvxc' )
1213
call de_alloc( PMesh, name='PMesh' )