--- branches/mmeineke/OOPSE/libmdtools/force_globals.F90 2003/03/21 17:42:12 377 +++ trunk/OOPSE/libmdtools/force_globals.F90 2004/05/27 00:48:12 1198 @@ -1,4 +1,4 @@ -!! Fortran interface to C entry plug. +! Fortran interface to C entry plug. module force_globals use definitions @@ -14,6 +14,8 @@ module force_globals #ifdef IS_MPI real( kind = dp ), allocatable, dimension(:,:), public :: q_Row real( kind = dp ), allocatable, dimension(:,:), public :: q_Col + real( kind = dp ), allocatable, dimension(:,:), public :: q_group_Row + real( kind = dp ), allocatable, dimension(:,:), public :: q_group_Col real( kind = dp ), allocatable, dimension(:,:), public :: u_l_Row real( kind = dp ), allocatable, dimension(:,:), public :: u_l_Col real( kind = dp ), allocatable, dimension(:,:), public :: A_Row @@ -34,9 +36,10 @@ module force_globals integer, allocatable, dimension(:), public :: atid_Row integer, allocatable, dimension(:), public :: atid_Col -#else - integer, allocatable, dimension(:), public :: atid #endif + + integer, allocatable, dimension(:), public :: atid + real( kind = dp ), allocatable, dimension(:,:), public :: rf real(kind = dp), dimension(9), public :: tau_Temp = 0.0_dp real(kind = dp), public :: virial_Temp = 0.0_dp @@ -47,7 +50,8 @@ contains subroutine InitializeForceGlobals(nlocal, thisStat) integer, intent(out) :: thisStat - integer :: nrow, ncol + integer :: nAtomsInRow, nAtomsInCol + integer :: nGroupsInRow, nGroupsInCol integer :: nlocal integer :: ndim = 3 integer :: alloc_stat @@ -55,57 +59,72 @@ contains thisStat = 0 #ifdef IS_MPI - nrow = getNrow(plan_row) - ncol = getNcol(plan_col) + nAtomsInRow = getNatomsInRow(plan_atom_row) + nAtomsInCol = getNatomsInCol(plan_atom_col) + nGroupsInRow = getNgroupsInRow(plan_group_row) + nGroupsInCol = getNgroupsInCol(plan_group_col) + #endif call FreeForceGlobals() #ifdef IS_MPI - allocate(q_Row(ndim,nrow),stat=alloc_stat) + allocate(q_Row(ndim,nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(q_Col(ndim,ncol),stat=alloc_stat) + allocate(q_Col(ndim,nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif + + allocate(q_group_Row(ndim,nGroupsInRow),stat=alloc_stat) + if (alloc_stat /= 0 ) then + thisStat = -1 + return + endif + + allocate(q_group_Col(ndim,nGroupsInCol),stat=alloc_stat) + if (alloc_stat /= 0 ) then + thisStat = -1 + return + endif - allocate(u_l_Row(ndim,nrow),stat=alloc_stat) + allocate(u_l_Row(ndim,nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(u_l_Col(ndim,ncol),stat=alloc_stat) + allocate(u_l_Col(ndim,nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(A_row(9,nrow),stat=alloc_stat) + allocate(A_row(9,nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(A_Col(9,ncol),stat=alloc_stat) + allocate(A_Col(9,nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(pot_row(nrow),stat=alloc_stat) + allocate(pot_row(nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(pot_Col(ncol),stat=alloc_stat) + allocate(pot_Col(nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return @@ -117,13 +136,13 @@ contains return endif - allocate(f_Row(ndim,nrow),stat=alloc_stat) + allocate(f_Row(ndim,nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(f_Col(ndim,ncol),stat=alloc_stat) + allocate(f_Col(ndim,nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return @@ -135,13 +154,13 @@ contains return endif - allocate(t_Row(ndim,nrow),stat=alloc_stat) + allocate(t_Row(ndim,nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(t_Col(ndim,ncol),stat=alloc_stat) + allocate(t_Col(ndim,nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return @@ -153,30 +172,37 @@ contains return endif - allocate(atid_Row(nrow),stat=alloc_stat) + allocate(atid(nlocal),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(atid_Col(ncol),stat=alloc_stat) + + allocate(atid_Row(nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(rf_Row(ndim,nrow),stat=alloc_stat) + allocate(atid_Col(nAtomsInCol),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif - allocate(rf_Col(ndim,ncol),stat=alloc_stat) + allocate(rf_Row(ndim,nAtomsInRow),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 return endif + allocate(rf_Col(ndim,nAtomsInCol),stat=alloc_stat) + if (alloc_stat /= 0 ) then + thisStat = -1 + return + endif + allocate(rf_Temp(ndim,nlocal),stat=alloc_stat) if (alloc_stat /= 0 ) then thisStat = -1 @@ -214,6 +240,7 @@ contains if (allocated(rf_Row)) deallocate(rf_Row) if (allocated(atid_Col)) deallocate(atid_Col) if (allocated(atid_Row)) deallocate(atid_Row) + if (allocated(atid)) deallocate(atid) if (allocated(t_Temp)) deallocate(t_Temp) if (allocated(t_Col)) deallocate(t_Col) if (allocated(t_Row)) deallocate(t_Row) @@ -227,6 +254,8 @@ contains if (allocated(A_Row)) deallocate(A_Row) if (allocated(u_l_Col)) deallocate(u_l_Col) if (allocated(u_l_Row)) deallocate(u_l_Row) + if (allocated(q_group_Col)) deallocate(q_group_Col) + if (allocated(q_group_Row)) deallocate(q_group_Row) if (allocated(q_Col)) deallocate(q_Col) if (allocated(q_Row)) deallocate(q_Row) #else