615
615
use precision, only : dp, grid_p
617
use parallel, only : ProcessorY
619
! Number of Mesh divisions of each cell vector (global)
620
! The status of this variable is confusing
621
617
use parallel, only : Node, Nodes
622
618
use atmfuncs, only : rcut, rcore
623
619
use units, only : Debye, eV, Ang
625
621
use sys, only : die, bye
626
use mesh, only : nsm, nsp
622
use mesh, only : nsm, nsp, meshLim
628
624
use m_iorho, only : write_rho
629
625
use m_forhar, only : forhar
1518
1510
call distMeshData( UNIFORM, fsrc, LINEAR, fdst, KEEP )
1513
if (use_bsc_cellxc) then
1515
call timer("BSC-CellXC",1)
1521
1516
call bsc_cellxc( 0, 0, cell, ntml, ntml, ntpl, 0, aux3, nspin,
1522
1517
& DRho_gga, Ex, Ec, DEx, DEc, Vscf_gga,
1523
1518
& dummy_DVxcdn, stressl )
1520
call timer("BSC-CellXC",2)
1524
call timer("GXC-CellXC",1)
1526
! Note that RG's meshLim is in blocks of nsm points, and 1-based
1528
! 1:16 17:32 (base 1)
1529
! 0:15 16:31 (base 0)
1532
! Add 1 to lb, and nsm to ub:
1533
! 1:32 33:64 (base 1, in units of small-points)
1535
myBox(1,:) = (meshLim(1,:)-1)*nsm + 1
1536
myBox(2,:) = (meshLim(2,:)-1)*nsm + nsm
1538
call cellXC( 0, cell, ntm, myBox(1,1), myBox(2,1),
1539
& myBox(1,2), myBox(2,2),
1540
& myBox(1,3), myBox(2,3), nspin,
1541
& DRho_gga, Ex, Ec, DEx, DEc, stressXC, Vscf_gga,
1542
& keep_input_distribution = .true. )
1543
! Vscf is still sequential after the call to JMS's cellxc
1544
stress = stress + stressXC
1545
call timer("GXC-CellXC",2)
1547
endif ! use_bsc_cellxc
1525
1549
! Go back to uniform distribution
1526
1550
if (nodes.gt.1) then
1527
1551
call setMeshDistr( UNIFORM, nsm, nsp, nml, nmpl, ntml, ntpl)
1536
1560
call de_alloc( DRho_gga, 'DRho_gga', 'dhscf' )
1537
1561
call de_alloc( Vscf_gga, 'Vscf_gga', 'dhscf' )
1538
call timer("BSC-CellXC",2)
1542
call timer("GXC-CellXC",1)
1544
! This is the initial interface to JM Soler's own cellxc routine, which sets
1545
! up further distribution(s) internally. To begin, it is given the parameters
1546
! pertaining to the UNIFORM distribution of mesh points, which is in force at
1549
call jms_setMeshDistr( distrID=JDGdistr, nMesh=ntm,
1550
& nNodesX=1, nNodesY=ProcessorY, nBlock=nsm )
1551
call myMeshBox( ntm, JDGdistr, myBox )
1553
call cellXC( 0, cell, ntm, myBox(1,1), myBox(2,1),
1554
& myBox(1,2), myBox(2,2),
1555
& myBox(1,3), myBox(2,3), nspin,
1556
& DRho, Ex, Ec, DEx, DEc, stressXC, Vscf )
1557
! Vscf is still sequential after the call to JMS's cellxc
1558
stress = stress + stressXC
1559
call timer("GXC-CellXC",2)
1561
endif ! use_bsc_cellxc
1563
1565
if ( debug_dhscf ) then
1564
1566
write(*,debug_fmt) Node,'XC',