~albertog/siesta/4.1-xc

« back to all changes in this revision

Viewing changes to Src/meshsubs.F

  • Committer: Alberto Garcia
  • Date: 2018-12-18 11:38:26 UTC
  • Revision ID: albertog@icmab.es-20181218113826-q1nw0qwlc5smc0xe
Simplify the choice between SiestaXC and BSC's versions of cellxc  

The BSC_CELLXC preprocessor blocks have been removed and replaced
by conditional blocks which can be selected at runtime.

The user can control which version of cellxc is used by means of the
fdf logical variable:
  
     XC.Use.BSC.CellXC  (T/F)  

which is 'false' by default, thus using SiestaXC's cellxc.

The BSC version might be slightly better for GGA operations, and the
SiestaXC version must of course be used when dealing with van der Waals
density functionals.

NOTES:
  
* BSC's version of cellxc now uses ldaxc, ggaxc, and setxc/getxc from
  SiestaXC. This enhances its functionality (more functionals) and
  saves on duplicated code. The old 'xc.f' file has been removed.
  
* In 'meshsubs', 'distriphionmesh' now accepts an extra argument to
  flag the need for stencil initilization.
  
* In 'forhar', a number of 'reord' operations towards 'sequential'
  fine-point ordering (which were compiled-in only for the new
  interface) have been removed, as all the arrays involved are already
  in 'sequential' form.
  
  Tests show that these changes do not seem to affect the results, however.
  
  The 'forhar' interface uses the 'ntm' argument in all cases, to simplify
  the code.

* Removed bogus incompatibility check in ldau.F

Show diffs side-by-side

added added

removed removed

Lines of Context:
1283
1283
 
1284
1284
!------------------------------------------------------------------
1285
1285
      subroutine distriPhiOnMesh( nm, nmpl, norb, iaorb,
1286
 
     &                            iphorb, isa, numphi )
 
1286
     &                            iphorb, isa, numphi,
 
1287
     &                            need_gradients_in_xc )
1287
1288
 
1288
1289
C Computes the number of orbitals that intersects every mesh point
1289
1290
C and calls initMeshDistr in order to compute a new data distribution
1297
1298
C integer iaorb(norb)   : Atom to which each orbital belongs
1298
1299
C integer iphorb(norb)  : Orbital index (within atom) of each orbital
1299
1300
C integer isa(na)       : Species index of all atoms in supercell
1300
 
C
 
1301
C logical need_gradients_in_xc : 
1301
1302
C OUTPUT:
1302
1303
C The output values are in the module moreMeshSubs (New limits of the mesh
1303
1304
C and the information needed to transfer data between data
1337
1338
      use moreMeshSubs, only: initMeshDistr
1338
1339
      use moreMeshSubs, only: allocASynBuffer
1339
1340
      use moreMeshSubs, only: UNIFORM, QUADRATIC, LINEAR
1340
 
      use cellxc_mod,   only: GGA, setGGA
1341
1341
      use alloc,        only: re_alloc, de_alloc
 
1342
      
1342
1343
      implicit none
1343
1344
C     Passed arguments
1344
1345
      integer, intent(in)  :: nm(3), nmpl, norb, iaorb(norb),
1345
1346
     &                        iphorb(norb), isa(*)
1346
1347
      integer, intent(out) :: numphi(nmpl)
 
1348
      logical, intent(in)  :: need_gradients_in_xc
1347
1349
C     Local variables
1348
1350
      integer              :: ii, io, ia, iphi, is, iop, ip0, isp
1349
1351
      real(dp)             :: r2o, dxsp(3,nsp), r2sp(nsp)
1402
1404
          endif
1403
1405
        enddo
1404
1406
        call initMeshDistr( UNIFORM, LINEAR, nm, wload )
1405
 
        if (GGA) call initMeshExtencil( LINEAR, nm )
 
1407
        if (need_gradients_in_xc) call initMeshExtencil( LINEAR, nm )
1406
1408
 
1407
1409
C       Free local memory
1408
1410
        call de_alloc( wload, 'wload', 'distriPhiOnMesh' )