Commit 9e8f530c authored by Alberto Garcia's avatar Alberto Garcia
Browse files

Cleaner fix for init_spin behavior

The nspin, spinor_dim, et al integer pointers in 'm_init' have now
been initialized to 'null()', and the 'init_spin' routine is now
called by all processes in 'siesta_init'.  This is the cleanest way to
fix the problem described in the previous commit.

Note that the PEXSI routines still use the 'nspin' variable internally
to refer to both 'spinor_dim' and 'h_spin_dim'. This will be changed when
mixed-spin solving is implemented.

modified:
  Src/m_spin.F90
  Src/siesta_init.F


parent 11a4dbbe
------------------------------------------------------------
August 3, 2016 A. Garcia trunk-537--pexsi-v0.8-spin-14
Cleaner fix for init_spin behavior
The nspin, spinor_dim, et al integer pointers in 'm_init' have now
been initialized to 'null()', and the 'init_spin' routine is now
called by all processes in 'siesta_init'. This is the cleanest way to
fix the problem described in the previous commit.
Note that the PEXSI routines still use the 'nspin' variable internally
to refer to both 'spinor_dim' and 'h_spin_dim'. This will be changed when
mixed-spin solving is implemented.
modified:
Src/m_spin.F90
Src/siesta_init.F
------------------------------------------------------------
July 31, 2016 A. Garcia trunk-537--pexsi-v0.8-spin-13
Fix bug related to init_spin behavior
......
......@@ -65,17 +65,13 @@ module m_spin
! Create short-hands for the spin-configuration
! DO NOT USE THIS VARIABLE, USE -> type(tSpin) :: spin%Grid
! integer, save, public, pointer :: nspin => null() ! (Grid)
integer, save, public :: nspin ! (Grid)
integer, save, public, pointer :: nspin => null() ! (Grid)
! DO NOT USE THIS VARIABLE, USE -> type(tSpin) :: spin%spinor
! integer, save, public, pointer :: spinor_dim => null() ! (spinor)
integer, save, public :: spinor_dim ! (spinor)
integer, save, public, pointer :: spinor_dim => null() ! (spinor)
! DO NOT USE THIS VARIABLE, USE -> type(tSpin) :: spin%H, spin%DM
! integer, save, public, pointer :: h_spin_dim => null() ! (H and DM)
integer, save, public :: h_spin_dim ! (H and DM)
integer, save, public, pointer :: h_spin_dim => null() ! (H and DM)
! DO NOT USE THIS VARIABLE, USE -> type(tSpin) :: spin%EDM
! integer, save, public, pointer :: e_spin_dim => null() ! (EDM)
integer, save, public :: e_spin_dim ! (EDM)
integer, save, public, pointer :: e_spin_dim => null() ! (EDM)
! DO NOT USE THIS VARIABLE, USE -> type(tSpin) :: spin%none
......@@ -118,10 +114,10 @@ contains
character(len=32) :: opt
! Create pointer assignments...
!!$ call int_pointer(spinor_dim, spin%spinor)
!!$ call int_pointer(nspin , spin%grid)
!!$ call int_pointer(h_spin_dim, spin%H)
!!$ call int_pointer(e_spin_dim, spin%EDM)
call int_pointer(spinor_dim, spin%spinor)
call int_pointer(nspin , spin%grid)
call int_pointer(h_spin_dim, spin%H)
call int_pointer(e_spin_dim, spin%EDM)
! Create pointer assignments...
call log_pointer(NoMagn, spin%none)
......@@ -292,11 +288,6 @@ contains
call re_alloc(qs, 1, spin%spinor, &
name="qs",routine="init_spin")
nspin = spin%grid
h_spin_dim = spin%H
spinor_dim = spin%spinor
e_spin_dim = spin%EDM
contains
subroutine int_pointer(from, to)
......
......@@ -50,7 +50,8 @@
use densematrix, only: Haux, Saux, Psi
use m_energies
use m_steps
use m_spin
use m_spin, only: init_spin, nspin, spinor_dim, SpPol
use m_spin, only: qs, init_spiral
use m_rmaxh
use m_forces
use m_eo
......@@ -196,6 +197,12 @@ C Initialise MPI and set processor number
Nodes = 1
#endif
IOnode = SIESTA_worker .and. (Node .eq. 0)
! Be sure to initialize the spin-configuration data
! for all processors.
call init_spin( )
if (.not. SIESTA_worker) RETURN
#ifdef DEBUG
......@@ -323,10 +330,6 @@ C Initialise MPI and set processor number
call add_citation("10.1088/0953-8984/14/11/302")
end if
! be sure to initialize spin-configuration
! as the first thing.
! Subsequent routines require this to be filled
call init_spin( )
! Initialise exchange-correlation functional information
#ifndef BSC_CELLXC
......
trunk-537--pexsi-v0.8-spin-13
trunk-537--pexsi-v0.8-spin-14
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment