--- trunk/mdtools/md_code/simulation_module.F90 2003/02/04 20:16:08 264 +++ trunk/mdtools/md_code/simulation_module.F90 2003/02/24 21:25:15 281 @@ -7,28 +7,9 @@ module simulation implicit none PRIVATE +#define __FORTRAN90 +#include "../headers/fsimulation.h" - - type, public :: simtype - PRIVATE -! SEQUENCE -!! Number of particles on this processor - integer :: nLRparticles -!! Periodic Box - real ( kind = dp ), dimension(3) :: box -!! List Cutoff - real ( kind = dp ) :: rlist = 0.0_dp -!! Radial cutoff - real ( kind = dp ) :: rcut = 0.0_dp -!! List cutoff squared - real ( kind = dp ) :: rlistsq = 0.0_dp -!! Radial Cutoff squared - real ( kind = dp ) :: rcutsq = 0.0_dp -!! Radial Cutoff^6 - real ( kind = dp ) :: rcut6 = 0.0_dp - - end type simtype - type (simtype), public :: thisSim !! Tag for MPI calculations integer, allocatable, dimension(:) :: tag @@ -39,8 +20,7 @@ module simulation #endif !! WARNING: use_pbc hardcoded, fixme - logical :: use_pbc = .true. - logical :: setSim = .false. + logical :: setSim = .false. !! array for saving previous positions for neighbor lists. real( kind = dp ), allocatable,dimension(:,:),save :: q0 @@ -54,6 +34,11 @@ module simulation public :: getRlist public :: getNlocal public :: setSimulation + public :: isEnsemble + public :: isPBC + public :: getStringLen + public :: returnMixingRules + ! public :: setRcut interface wrap @@ -77,11 +62,14 @@ contains contains - subroutine setSimulation(nLRParticles,box,rlist,rcut) + subroutine setSimulation(nLRParticles,box,rlist,rcut,ensemble,mixingRule,use_pbc) integer, intent(in) :: nLRParticles real(kind = dp ), intent(in), dimension(3) :: box real(kind = dp ), intent(in) :: rlist real(kind = dp ), intent(in) :: rcut + character( len = stringLen), intent(in) :: ensemble + character( len = stringLen), intent(in) :: mixingRule + logical, intent(in) :: use_pbc integer :: alloc_stat if( setsim ) return ! simulation is already initialized setSim = .true. @@ -94,6 +82,10 @@ contains thisSim%rcutsq = rcut * rcut thisSim%rcut6 = thisSim%rcutsq * thisSim%rcutsq * thisSim%rcutsq + thisSim%ensemble = ensemble + thisSim%mixingRule = mixingRule + thisSim%use_pbc = use_pbc + if (.not. allocated(q0)) then allocate(q0(3,nLRParticles),stat=alloc_stat) endif @@ -205,7 +197,7 @@ contains real( kind = dp ), dimension(3) :: this_wrap - if (use_pbc) then + if (this_sim%use_pbc) then ! this_wrap = r - box(dim)*dsign(1.0E0_DP,r)*int(abs(r/box(dim)) + 0.5E0_DP) this_wrap = r - thisSim%box*nint(r/thisSim%box) else @@ -264,5 +256,32 @@ contains end function getNlocal + function isEnsemble(this_ensemble) result(is_this_ensemble) + character(len = *) :: this_ensemble + logical :: is_this_enemble + is_this_ensemble = .false. + if (this_ensemble == thisSim%ensemble) is_this_ensemble = .true. + end function isEnsemble + function returnEnsemble() result(thisEnsemble) + character (len = len(thisSim%ensemble)) :: thisEnsemble + thisEnsemble = thisSim%ensemble + end function returnEnsemble + + function returnMixingRules() result(thisMixingRule) + character (len = len(thisSim%ensemble)) :: thisMixingRule + thisMixingRule = thisSim%MixingRule + end function returnMixingRules + + function isPBC() result(PBCset) + logical :: PBCset + PBCset = .false. + if (thisSim%use_pbc) PBCset = .true. + end function isPBC + + pure function getStringLen() result (thislen) + integer :: thislen + thislen = string_len + end function setStringLen + end module simulation