1 |
+ |
!! Fortran interface to C entry plug. |
2 |
+ |
|
3 |
|
module simulation |
4 |
|
use definitions, ONLY :dp |
5 |
|
#ifdef IS_MPI |
13 |
|
#include "../headers/fsimulation.h" |
14 |
|
|
15 |
|
type (simtype), public :: thisSim |
14 |
– |
!! Tag for MPI calculations |
15 |
– |
integer, allocatable, dimension(:) :: tag |
16 |
|
|
17 |
< |
#ifdef IS_MPI |
18 |
< |
integer, allocatable, dimension(:) :: tag_row |
19 |
< |
integer, allocatable, dimension(:) :: tag_column |
20 |
< |
#endif |
17 |
> |
logical :: setSim = .false. |
18 |
|
|
22 |
– |
!! WARNING: use_pbc hardcoded, fixme |
23 |
– |
logical :: setSim = .false. |
19 |
|
|
25 |
– |
!! array for saving previous positions for neighbor lists. |
26 |
– |
real( kind = dp ), allocatable,dimension(:,:),save :: q0 |
27 |
– |
|
28 |
– |
|
20 |
|
public :: wrap |
21 |
|
public :: getBox |
22 |
|
public :: getRcut |
43 |
|
|
44 |
|
|
45 |
|
|
55 |
– |
|
56 |
– |
|
57 |
– |
|
58 |
– |
|
59 |
– |
|
60 |
– |
|
46 |
|
contains |
47 |
|
|
48 |
< |
subroutine setSimulation(nLRParticles,box,rlist,rcut,ensemble,mixingRule,use_pbc) |
49 |
< |
integer, intent(in) :: nLRParticles |
50 |
< |
real(kind = dp ), intent(in), dimension(3) :: box |
66 |
< |
real(kind = dp ), intent(in) :: rlist |
67 |
< |
real(kind = dp ), intent(in) :: rcut |
68 |
< |
character( len = stringLen), intent(in) :: ensemble |
69 |
< |
character( len = stringLen), intent(in) :: mixingRule |
70 |
< |
logical, intent(in) :: use_pbc |
48 |
> |
subroutine setSimulation(setThisSim,error) |
49 |
> |
type (simtype) :: setThisSim |
50 |
> |
integer :: error |
51 |
|
integer :: alloc_stat |
52 |
< |
if( setsim ) return ! simulation is already initialized |
52 |
> |
|
53 |
> |
error = 0 |
54 |
|
setSim = .true. |
55 |
|
|
56 |
< |
thisSim%nLRParticles = nLRParticles |
57 |
< |
thisSim%box = box |
77 |
< |
thisSim%rlist = rlist |
78 |
< |
thisSIm%rlistsq = rlist * rlist |
79 |
< |
thisSim%rcut = rcut |
80 |
< |
thisSim%rcutsq = rcut * rcut |
81 |
< |
thisSim%rcut6 = thisSim%rcutsq * thisSim%rcutsq * thisSim%rcutsq |
82 |
< |
|
83 |
< |
thisSim%ensemble = ensemble |
84 |
< |
thisSim%mixingRule = mixingRule |
85 |
< |
thisSim%use_pbc = use_pbc |
86 |
< |
|
87 |
< |
if (.not. allocated(q0)) then |
88 |
< |
allocate(q0(3,nLRParticles),stat=alloc_stat) |
89 |
< |
endif |
56 |
> |
! copy C struct into fortran type |
57 |
> |
thisSim = setThisSim |
58 |
|
end subroutine setSimulation |
59 |
|
|
60 |
|
function getNparticles() result(nparticles) |