ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/UseTheForce/DarkSide/suttonchen.F90
(Generate patch)

Comparing trunk/OOPSE-2.0/src/UseTheForce/DarkSide/suttonchen.F90 (file contents):
Revision 2533 by chuckv, Fri Dec 30 23:15:59 2005 UTC vs.
Revision 2534 by chuckv, Sat Dec 31 22:42:01 2005 UTC

# Line 66 | Line 66 | module suttonchen
66    logical, save :: haveRcut = .false.
67    logical, save :: haveMixingMap = .false.
68    logical, save :: useGeometricDistanceMixing = .false.
69 +  logical, save :: cleanArrays = .true.
70 +  logical, save :: arraysAllocated = .false.
71  
72  
71
72
73    character(len = statusMsgSize) :: errMesg
74    integer :: sc_err
75  
76    character(len = 200) :: errMsg
77    character(len=*), parameter :: RoutineName =  "Sutton-Chen MODULE"
78    !! Logical that determines if eam arrays should be zeroed
79  logical :: cleanme = .true.
79    logical :: nmflag  = .false.
80  
81  
# Line 291 | Line 290 | contains
290  
291    !! routine checks to see if array is allocated, deallocates array if allocated
292    !! and then creates the array to the required size
293 <  subroutine allocateSC(status)
294 <    integer, intent(out) :: status
293 >  subroutine allocateSC()
294 >    integer :: status
295  
296   #ifdef IS_MPI
297      integer :: nAtomsInRow
# Line 300 | Line 299 | contains
299   #endif
300      integer :: alloc_stat
301  
302 <
302 >    
303      status = 0
304   #ifdef IS_MPI
305      nAtomsInRow = getNatomsInRow(plan_atom_row)
# Line 313 | Line 312 | contains
312      allocate(frho(nlocal),stat=alloc_stat)
313      if (alloc_stat /= 0) then
314         status = -1
316       return
315      end if
316  
317      if (allocated(rho)) deallocate(rho)
318      allocate(rho(nlocal),stat=alloc_stat)
319      if (alloc_stat /= 0) then
320         status = -1
323       return
321      end if
322  
323      if (allocated(dfrhodrho)) deallocate(dfrhodrho)
324      allocate(dfrhodrho(nlocal),stat=alloc_stat)
325      if (alloc_stat /= 0) then
326         status = -1
330       return
327      end if
328  
329   #ifdef IS_MPI
# Line 336 | Line 332 | contains
332      allocate(rho_tmp(nlocal),stat=alloc_stat)
333      if (alloc_stat /= 0) then
334         status = -1
339       return
335      end if
336  
337  
# Line 344 | Line 339 | contains
339      allocate(frho_row(nAtomsInRow),stat=alloc_stat)
340      if (alloc_stat /= 0) then
341         status = -1
347       return
342      end if
343      if (allocated(rho_row)) deallocate(rho_row)
344      allocate(rho_row(nAtomsInRow),stat=alloc_stat)
345      if (alloc_stat /= 0) then
346         status = -1
353       return
347      end if
348      if (allocated(dfrhodrho_row)) deallocate(dfrhodrho_row)
349      allocate(dfrhodrho_row(nAtomsInRow),stat=alloc_stat)
350      if (alloc_stat /= 0) then
351         status = -1
359       return
352      end if
353  
354  
# Line 366 | Line 358 | contains
358      allocate(frho_col(nAtomsInCol),stat=alloc_stat)
359      if (alloc_stat /= 0) then
360         status = -1
369       return
361      end if
362      if (allocated(rho_col)) deallocate(rho_col)
363      allocate(rho_col(nAtomsInCol),stat=alloc_stat)
364      if (alloc_stat /= 0) then
365         status = -1
375       return
366      end if
367      if (allocated(dfrhodrho_col)) deallocate(dfrhodrho_col)
368      allocate(dfrhodrho_col(nAtomsInCol),stat=alloc_stat)
369      if (alloc_stat /= 0) then
370         status = -1
381       return
371      end if
372  
373   #endif
374 <
374 >    if (status == -1) then
375 >       call handleError("SuttonChen:allocateSC","Error in allocating SC arrays")
376 >    end if
377 >    arraysAllocated = .true.
378    end subroutine allocateSC
379  
380    !! C sets rcut to be the largest cutoff of any atype
# Line 397 | Line 389 | contains
389  
390    end subroutine setCutoffSC
391  
392 + !! This array allocates module arrays if needed and builds mixing map.
393    subroutine clean_SC()
394 <
394 >    if (.not.arraysAllocated) call allocateSC()
395 >    if (.not.haveMixingMap) call createMixingMap()
396      ! clean non-IS_MPI first
397      frho = 0.0_dp
398      rho  = 0.0_dp
# Line 439 | Line 433 | contains
433  
434      ! check to see if we need to be cleaned at the start of a force loop
435  
436 <    if (.not.haveMixingMap) call createMixingMap()
436 >    if (cleanArrays) call clean_SC()
437 >    cleanArrays = .false.
438  
444
439   #ifdef IS_MPI
440      Atid1 = Atid_row(Atom1)
441      Atid2 = Atid_col(Atom2)
# Line 482 | Line 476 | contains
476      integer :: myid
477  
478  
485    cleanme = .true.
479      !! Scatter the electron density from  pre-pair calculation back to local atoms
480   #ifdef IS_MPI
481      call scatter(rho_row,rho,plan_atom_row,sc_err)
# Line 566 | Line 559 | contains
559      !Local Variables
560  
561      ! write(*,*) "Frho: ", Frho(atom1)
562 +    
563 +    cleanArrays = .true.
564  
570
565      dvpdr = 0.0E0_DP
566  
567  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines