2 |
|
!! Corresponds to the force field defined in lj_FF.cpp |
3 |
|
!! @author Charles F. Vardeman II |
4 |
|
!! @author Matthew Meineke |
5 |
< |
!! @version $Id: lj_FF.F90,v 1.13 2003-01-30 15:20:21 chuckv Exp $, $Date: 2003-01-30 15:20:21 $, $Name: not supported by cvs2svn $, $Revision: 1.13 $ |
5 |
> |
!! @version $Id: lj_FF.F90,v 1.18 2003-02-04 20:16:08 chuckv Exp $, $Date: 2003-02-04 20:16:08 $, $Name: not supported by cvs2svn $, $Revision: 1.18 $ |
6 |
|
|
7 |
|
|
8 |
|
|
124 |
|
|
125 |
|
integer :: thisStat |
126 |
|
integer :: i |
127 |
+ |
|
128 |
+ |
integer :: myNode |
129 |
|
#ifdef IS_MPI |
130 |
|
integer, allocatable, dimension(:) :: identRow |
131 |
|
integer, allocatable, dimension(:) :: identCol |
133 |
|
integer :: ncol |
134 |
|
#endif |
135 |
|
status = 0 |
136 |
+ |
|
137 |
+ |
|
138 |
+ |
|
139 |
+ |
|
140 |
|
!! if were're not in MPI, we just update ljatypePtrList |
141 |
|
#ifndef IS_MPI |
142 |
|
call create_IdentPtrlst(ident,ljListHead,identPtrList,thisStat) |
160 |
|
|
161 |
|
! if were're in MPI, we also have to worry about row and col lists |
162 |
|
#else |
163 |
+ |
|
164 |
|
! We can only set up forces if mpiSimulation has been setup. |
165 |
|
if (.not. isMPISimSet()) then |
166 |
+ |
write(default_error,*) "MPI is not set" |
167 |
|
status = -1 |
168 |
|
return |
169 |
|
endif |
170 |
< |
nrow = getNrow() |
171 |
< |
ncol = getNcol() |
170 |
> |
nrow = getNrow(plan_row) |
171 |
> |
ncol = getNcol(plan_col) |
172 |
> |
mynode = getMyNode() |
173 |
|
!! Allocate temperary arrays to hold gather information |
174 |
|
allocate(identRow(nrow),stat=alloc_stat) |
175 |
|
if (alloc_stat /= 0 ) then |
182 |
|
status = -1 |
183 |
|
return |
184 |
|
endif |
185 |
+ |
|
186 |
|
!! Gather idents into row and column idents |
187 |
+ |
|
188 |
|
call gather(ident,identRow,plan_row) |
189 |
|
call gather(ident,identCol,plan_col) |
190 |
< |
|
190 |
> |
|
191 |
> |
|
192 |
|
!! Create row and col pointer lists |
193 |
< |
call create_IdentPtrlst(identRow,ljListTail,identPtrListRow,thisStat) |
193 |
> |
|
194 |
> |
call create_IdentPtrlst(identRow,ljListHead,identPtrListRow,thisStat) |
195 |
|
if (thisStat /= 0 ) then |
196 |
|
status = -1 |
197 |
|
return |
198 |
|
endif |
199 |
< |
|
200 |
< |
call create_IdentPtrlst(identCol,ljListTail,identPtrListColumn,thisStat) |
199 |
> |
|
200 |
> |
call create_IdentPtrlst(identCol,ljListHead,identPtrListColumn,thisStat) |
201 |
|
if (thisStat /= 0 ) then |
202 |
|
status = -1 |
203 |
|
return |
204 |
|
endif |
205 |
|
|
206 |
|
!! free temporary ident arrays |
207 |
< |
deallocate(identCol) |
208 |
< |
deallocate(identRow) |
207 |
> |
if (allocated(identCol)) then |
208 |
> |
deallocate(identCol) |
209 |
> |
end if |
210 |
> |
if (allocated(identCol)) then |
211 |
> |
deallocate(identRow) |
212 |
> |
endif |
213 |
|
|
197 |
– |
|
214 |
|
!! Allocate neighbor lists for mpi simulations. |
215 |
|
if (.not. allocated(point)) then |
216 |
|
allocate(point(nrow),stat=alloc_stat) |
249 |
|
endif |
250 |
|
isljFFinit = .true. |
251 |
|
|
252 |
+ |
|
253 |
|
end subroutine init_ljFF |
254 |
|
|
255 |
|
|
360 |
|
type(lj_atype), pointer :: ljAtype_j |
361 |
|
|
362 |
|
#ifdef IS_MPI |
363 |
< |
real( kind = DP ), dimension(3,getNcol()) :: efr |
363 |
> |
real( kind = DP ), dimension(3,getNcol(plan_col)) :: efr |
364 |
|
real( kind = DP ) :: pot_local |
365 |
|
#else |
366 |
|
real( kind = DP ), dimension(3,getNlocal()) :: efr |
368 |
|
|
369 |
|
!! Local arrays needed for MPI |
370 |
|
#ifdef IS_MPI |
371 |
< |
real(kind = dp), dimension(3:getNrow()) :: qRow |
372 |
< |
real(kind = dp), dimension(3:getNcol()) :: qCol |
371 |
> |
real(kind = dp), dimension(3,getNrow(plan_row)) :: qRow |
372 |
> |
real(kind = dp), dimension(3,getNcol(plan_col)) :: qCol |
373 |
|
|
374 |
< |
real(kind = dp), dimension(3:getNrow()) :: fRow |
375 |
< |
real(kind = dp), dimension(3:getNcol()) :: fCol |
376 |
< |
real(kind = dp), dimension(3:getNlocal()) :: fMPITemp |
374 |
> |
real(kind = dp), dimension(3,getNrow(plan_row)) :: fRow |
375 |
> |
real(kind = dp), dimension(3,getNcol(plan_col)) :: fCol |
376 |
> |
real(kind = dp), dimension(3,getNlocal()) :: fMPITemp |
377 |
|
|
378 |
< |
real(kind = dp), dimension(getNrow()) :: eRow |
379 |
< |
real(kind = dp), dimension(getNcol()) :: eCol |
378 |
> |
real(kind = dp), dimension(getNrow(plan_row)) :: eRow |
379 |
> |
real(kind = dp), dimension(getNcol(plan_col)) :: eCol |
380 |
|
|
381 |
|
real(kind = dp), dimension(getNlocal()) :: eTemp |
382 |
|
#endif |
501 |
|
#ifdef IS_MPI |
502 |
|
! Assign identity pointers and tags |
503 |
|
ljAtype_j => identPtrListColumn(j)%this |
504 |
< |
tag_j = tagCol(j) |
504 |
> |
tag_j = tagColumn(j) |
505 |
|
if (newtons_thrd) then |
506 |
|
if (tag_i <= tag_j) then |
507 |
|
if (mod(tag_i + tag_j,2) == 0) cycle inner |
606 |
|
j = list(jnab) |
607 |
|
#ifdef IS_MPI |
608 |
|
ljAtype_j = identPtrListColumn(j)%this |
609 |
< |
rxij = wrap(rxi - q_col(1,j), 1) |
610 |
< |
ryij = wrap(ryi - q_col(2,j), 2) |
611 |
< |
rzij = wrap(rzi - q_col(3,j), 3) |
609 |
> |
rxij = wrap(rxi - qCol(1,j), 1) |
610 |
> |
ryij = wrap(ryi - qCol(2,j), 2) |
611 |
> |
rzij = wrap(rzi - qCol(3,j), 3) |
612 |
|
#else |
613 |
|
ljAtype_j = identPtrList(j)%this |
614 |
|
rxij = wrap(rxi - q(1,j), 1) |
656 |
|
|
657 |
|
#ifdef IS_MPI |
658 |
|
!!distribute forces |
659 |
+ |
|
660 |
|
call scatter(fRow,f,plan_row3d) |
661 |
|
|
662 |
|
call scatter(fCol,fMPITemp,plan_col3d) |
668 |
|
|
669 |
|
|
670 |
|
if (do_pot) then |
671 |
+ |
|
672 |
|
! scatter/gather pot_row into the members of my column |
673 |
|
call scatter(eRow,eTemp,plan_row) |
674 |
|
|
684 |
|
pe_local = pe_local + eTemp(i) |
685 |
|
enddo |
686 |
|
endif |
687 |
+ |
|
688 |
+ |
pe = pe_local |
689 |
|
endif |
669 |
– |
potE = pe_local |
690 |
|
#endif |
691 |
|
|
692 |
|
potE = pe |
693 |
|
|
674 |
– |
|
675 |
– |
|
676 |
– |
|
694 |
|
end subroutine do_lj_ff |
695 |
|
|
696 |
|
!! Calculates the potential between two lj particles based on two lj_atype pointers, optionally returns second |