~pablolopez/siesta/propagators-mature

« back to all changes in this revision

Viewing changes to Src/SiestaXC/cellxc.F90

  • Committer: Alberto Garcia
  • Date: 2019-02-13 11:22:14 UTC
  • mfrom: (560.1.506 4.1)
  • Revision ID: albertog@icmab.es-20190213112214-g4bh6pmxhvs5mofw
Merge 4.1:1066: streamline choice btw SiestaXC and BSC's cellxc

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
CONTAINS ! nothing else but public routine cellXC
233
233
 
234
234
SUBROUTINE cellXC( irel, cell, nMesh, lb1, ub1, lb2, ub2, lb3, ub3, &
235
 
                   nSpin, dens, Ex, Ec, Dx, Dc, stress, Vxc, dVxcdD )
 
235
                   nSpin, dens, Ex, Ec, Dx, Dc, stress, Vxc, dVxcdD, &
 
236
                   keep_input_distribution )
236
237
 
237
238
  ! Module routines
238
239
  use mesh3D,  only: addMeshData   ! Accumulates a mesh array
303
304
                                     ! (spin) xc potential
304
305
  real(gp),intent(out),optional:: &  ! dVxc/dDens (LDA only)
305
306
                         dVxcdD(0:ub1-lb1,0:ub2-lb2,0:ub3-lb3,1:nSpin**2) 
 
307
  logical, intent(in),optional::  keep_input_distribution
306
308
 
307
309
  ! Fix the order of the numerical derivatives
308
310
  ! nn is the number of points used in each coordinate and direction,
404
406
  type(allocDefaults):: &
405
407
     prevAllocDefaults
406
408
 
 
409
  logical :: keep_input_distr
 
410
 
407
411
#ifdef DEBUG_XC
408
412
  ! Variables for debugging
409
413
  real(dp):: GDtot(3), q, dqdD, dqdGD(3)
415
419
  ! Start time counter
416
420
  call timer_start( myName )
417
421
 
 
422
  keep_input_distr = .false.
 
423
  if (present(keep_input_distribution)) then
 
424
     keep_input_distr =   keep_input_distribution
 
425
  endif
 
426
     
418
427
#ifdef DEBUG_XC
419
428
  ! Initialize udebug variable
420
429
  call setDebugOutputUnit()
469
478
  ! Get ID of the I/O distribution of mesh points
470
479
  call setMeshDistr( ioDistr, nMesh, ioBox )
471
480
 
 
481
  if (keep_input_distr) then
 
482
 
 
483
     myDistr = ioDistr
 
484
 
 
485
  else
 
486
 
472
487
  ! If nMesh has changed, use input distribution also initially as myDistr
473
488
  if (any(nMesh/=oldMesh)) call setMeshDistr( myDistr, nMesh, ioBox )
474
489
  oldMesh = nMesh
519
534
#endif /* DEBUG_XC */
520
535
  end if ! (nodes>1 .and. timeDisp/timeAvge>maxUnbalance)
521
536
 
 
537
  endif
522
538
#ifdef DEBUG_XC
523
539
  ! Keep input distribution for the time being
524
540
!  myDistr = ioDistr
535
551
  ! - The parallel mesh distribution is changed internally (even with LDA)
536
552
  ! - We need finite differences (GGA) and have a distributed mesh
537
553
  if (.not.sameMeshDistr(myDistr,ioDistr) .or. (GGA .and. myDistr/=0)) then
 
554
 
538
555
    m11=myBox(1,1); m12=myBox(1,2); m13=myBox(1,3)
539
556
    m21=myBox(2,1); m22=myBox(2,2); m23=myBox(2,3)
540
557
    ns = nSpin  ! Just a shorter name