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

Comparing trunk/OOPSE-4/src/UseTheForce/DarkSide/eam.F90 (file contents):
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2291 by chuckv, Wed Sep 14 20:31:38 2005 UTC

# Line 44 | Line 44 | module eam
44    use force_globals
45    use status
46    use atype_module
47 <  use Vector_class
47 >  use vector_class
48   #ifdef IS_MPI
49    use mpiSimulation
50   #endif
# Line 117 | Line 117 | module eam
117       integer           :: currentAddition = 0
118  
119       type (EAMtype), pointer  :: EAMParams(:) => null()
120 +     integer, pointer         :: atidToEAMType(:) => null()
121    end type EAMTypeList
122  
123  
# Line 133 | Line 134 | module eam
134    public :: calc_eam_preforce_Frho
135    public :: clean_EAM
136    public :: destroyEAMTypes
137 +  public :: getEAMCut
138  
139   contains
140  
141  
142    subroutine newEAMtype(lattice_constant,eam_nrho,eam_drho,eam_nr,&
143         eam_dr,rcut,eam_Z_r,eam_rho_r,eam_F_rho,&
144 <       eam_ident,status)
144 >       c_ident,status)
145      real (kind = dp )                      :: lattice_constant
146      integer                                :: eam_nrho
147      real (kind = dp )                      :: eam_drho
# Line 149 | Line 151 | contains
151      real (kind = dp ), dimension(eam_nr)   :: eam_Z_r
152      real (kind = dp ), dimension(eam_nr)   :: eam_rho_r
153      real (kind = dp ), dimension(eam_nrho) :: eam_F_rho
154 <    integer                                :: eam_ident
154 >    integer                                :: c_ident
155      integer                                :: status
156  
157 <    integer                                :: nAtypes
157 >    integer                                :: nAtypes,nEAMTypes,myATID
158      integer                                :: maxVals
159      integer                                :: alloc_stat
160      integer                                :: current
# Line 167 | Line 169 | contains
169  
170      ! check to see if this is the first time into
171      if (.not.associated(EAMList%EAMParams)) then
172 <       call getMatchingElementList(atypes, "is_EAM", .true., nAtypes, MatchList)
173 <       EAMList%n_eam_types = nAtypes
174 <       allocate(EAMList%EAMParams(nAtypes))
172 >       call getMatchingElementList(atypes, "is_EAM", .true., nEAMtypes, MatchList)
173 >       EAMList%n_eam_types = nEAMtypes
174 >       allocate(EAMList%EAMParams(nEAMTypes))
175 >       nAtypes = getSize(atypes)
176 >       allocate(EAMList%atidToEAMType(nAtypes))
177      end if
178  
179      EAMList%currentAddition = EAMList%currentAddition + 1
180      current = EAMList%currentAddition
181  
182 +    myATID =  getFirstMatchingElement(atypes, "c_ident", c_ident)
183 +    EAMList%atidToEAMType(myATID) = current
184  
185      call allocate_EAMType(eam_nrho,eam_nr,EAMList%EAMParams(current),stat=alloc_stat)
186      if (alloc_stat /= 0) then
# Line 182 | Line 188 | contains
188         return
189      end if
190  
191 <    ! this is a possible bug, we assume a correspondence between the vector atypes and
192 <    ! EAMAtypes
187 <
188 <    EAMList%EAMParams(current)%eam_atype    = eam_ident
191 >  
192 >    EAMList%EAMParams(current)%eam_atype    = c_ident
193      EAMList%EAMParams(current)%eam_lattice  = lattice_constant
194      EAMList%EAMParams(current)%eam_nrho     = eam_nrho
195      EAMList%EAMParams(current)%eam_drho     = eam_drho
# Line 215 | Line 219 | contains
219      eamList%currentAddition = 0
220  
221    end subroutine destroyEAMtypes
222 +
223 +  function getEAMCut(atomID) result(cutValue)
224 +    integer, intent(in) :: atomID
225 +    integer :: eamID
226 +    real(kind=dp) :: cutValue
227 +    
228 +    eamID = EAMList%atidToEAMType(atomID)
229 +    cutValue = EAMList%EAMParams(eamID)%eam_rcut
230 +  end function getEAMCut
231  
232    subroutine init_EAM_FF(status)
233      integer :: status
# Line 546 | Line 559 | contains
559      ! we don't use the derivatives, dummy variables
560      real( kind = dp) :: drho,d2rho
561      integer :: eam_err
562 +    
563 +    integer :: atid1,atid2 ! Global atid    
564 +    integer :: myid_atom1 ! EAM atid
565 +    integer :: myid_atom2
566  
550    integer :: myid_atom1
551    integer :: myid_atom2
567  
568      ! check to see if we need to be cleaned at the start of a force loop
569  
# Line 556 | Line 571 | contains
571  
572  
573   #ifdef IS_MPI
574 <    myid_atom1 = atid_Row(atom1)
575 <    myid_atom2 = atid_Col(atom2)
574 >    Atid1 = Atid_row(Atom1)
575 >    Atid2 = Atid_col(Atom2)
576   #else
577 <    myid_atom1 = atid(atom1)
578 <    myid_atom2 = atid(atom2)
577 >    Atid1 = Atid(Atom1)
578 >    Atid2 = Atid(Atom2)
579   #endif
580  
581 +    Myid_atom1 = Eamlist%atidtoeamtype(Atid1)
582 +    Myid_atom2 = Eamlist%atidtoeamtype(Atid2)
583 +
584      if (r.lt.EAMList%EAMParams(myid_atom1)%eam_rcut) then
585  
586  
# Line 580 | Line 598 | contains
598   #else
599         rho(atom2) = rho(atom2) + rho_i_at_j
600   #endif
601 <       !       write(*,*) atom1,atom2,r,rho_i_at_j
601 >             ! write(*,*) atom1,atom2,r,rho_i_at_j
602      endif
603  
604      if (r.lt.EAMList%EAMParams(myid_atom2)%eam_rcut) then
# Line 618 | Line 636 | contains
636      integer :: atom
637      real(kind=dp) :: U,U1,U2
638      integer :: atype1
639 <    integer :: me
639 >    integer :: me,atid1
640      integer :: n_rho_points
641  
642  
# Line 643 | Line 661 | contains
661  
662      !! Calculate F(rho) and derivative
663      do atom = 1, nlocal
664 <       me = atid(atom)
664 >       atid1 = atid(atom)
665 >       me = eamList%atidToEAMtype(atid1)
666         n_rho_points = EAMList%EAMParams(me)%eam_nrho
667         !  Check to see that the density is not greater than the larges rho we have calculated
668         if (rho(atom) < EAMList%EAMParams(me)%eam_rhovals(n_rho_points)) then
# Line 737 | Line 756 | contains
756      integer :: id1,id2
757      integer  :: mytype_atom1
758      integer  :: mytype_atom2
759 <
759 >    integer  :: atid1,atid2
760      !Local Variables
761  
762      ! write(*,*) "Frho: ", Frho(atom1)
# Line 749 | Line 768 | contains
768      if (rij .lt. EAM_rcut) then
769  
770   #ifdef IS_MPI
771 <       mytype_atom1 = atid_row(atom1)
772 <       mytype_atom2 = atid_col(atom2)
771 >       atid1 = atid_row(atom1)
772 >       atid2 = atid_col(atom2)
773   #else
774 <       mytype_atom1 = atid(atom1)
775 <       mytype_atom2 = atid(atom2)
774 >       atid1 = atid(atom1)
775 >       atid2 = atid(atom2)
776   #endif
777 +
778 +       mytype_atom1 = EAMList%atidToEAMType(atid1)
779 +       mytype_atom2 = EAMList%atidTOEAMType(atid2)
780 +
781 +
782         ! get cutoff for atom 1
783         rci = EAMList%EAMParams(mytype_atom1)%eam_rcut
784         ! get type specific cutoff for atom 2

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines