3 |
|
module simulation |
4 |
|
use definitions |
5 |
|
use neighborLists |
6 |
< |
use atype_typedefs |
6 |
> |
use atype_module |
7 |
|
#ifdef IS_MPI |
8 |
|
use mpiSimulation |
9 |
|
#endif |
19 |
|
logical, save :: simulation_setup_complete = .false. |
20 |
|
|
21 |
|
integer :: natoms |
22 |
+ |
integer, public, save :: nExcludes_Global = 0 |
23 |
+ |
integer, public, save :: nExcludes_Local = 0 |
24 |
|
real(kind=dp), save :: rcut2 = 0.0_DP |
25 |
|
real(kind=dp), save :: rcut6 = 0.0_DP |
26 |
|
real(kind=dp), save :: rlist2 = 0.0_DP |
27 |
+ |
real(kind=dp), public, dimension(3), save :: box |
28 |
|
|
29 |
|
#ifdef IS_MPI |
30 |
|
real( kind = dp ), allocatable, dimension(:,:), public :: q_Row |
43 |
|
real( kind = dp ), allocatable, dimension(:,:), public :: t_Row |
44 |
|
real( kind = dp ), allocatable, dimension(:,:), public :: t_Col |
45 |
|
real( kind = dp ), allocatable, dimension(:,:), public :: t_Temp |
46 |
+ |
real( kind = dp ), allocatable, dimension(:,:), public :: rf_Row |
47 |
+ |
real( kind = dp ), allocatable, dimension(:,:), public :: rf_Col |
48 |
+ |
real( kind = dp ), allocatable, dimension(:,:), public :: rf_Temp |
49 |
+ |
|
50 |
|
integer, allocatable, dimension(:), public :: atid_Row |
51 |
|
integer, allocatable, dimension(:), public :: atid_Col |
52 |
|
#else |
53 |
|
integer, allocatable, dimension(:), public :: atid |
54 |
|
#endif |
55 |
+ |
real( kind = dp ), allocatable, dimension(:,:), public :: rf |
56 |
+ |
real(kind = dp), dimension(9), public :: tau_Temp = 0.0_dp |
57 |
+ |
real(kind = dp), public :: virial_Temp = 0.0_dp |
58 |
|
|
59 |
|
public :: SimulationSetup |
60 |
|
public :: getBox |
62 |
|
public :: getRlist |
63 |
|
public :: getRrf |
64 |
|
public :: getRt |
65 |
+ |
public :: getDielect |
66 |
|
public :: getNlocal |
67 |
|
public :: SimUsesPBC |
68 |
|
public :: SimUsesLJ |
112 |
|
rcut2 = thisSim%rcut * thisSim%rcut |
113 |
|
rcut6 = rcut2 * rcut2 * rcut2 |
114 |
|
rlist2 = thisSim%rlist * thisSim%rlist |
115 |
+ |
box = thisSim%box |
116 |
|
|
117 |
|
#ifdef IS_MPI |
118 |
|
! We can only set up forces if mpiSimulation has been setup. |
199 |
|
subroutine change_box_size(new_box_size) |
200 |
|
real(kind=dp), dimension(3) :: new_box_size |
201 |
|
thisSim%box = new_box_size |
202 |
+ |
box = thisSim%box |
203 |
|
end subroutine change_box_size |
204 |
|
|
205 |
|
function getBox_3d() result(thisBox) |
258 |
|
real( kind = dp ) :: rt |
259 |
|
rt = thisSim%rt |
260 |
|
end function getRt |
261 |
+ |
|
262 |
+ |
function getDielect() result(dielect) |
263 |
+ |
real( kind = dp ) :: dielect |
264 |
+ |
dielect = thisSim%dielect |
265 |
+ |
end function getDielect |
266 |
|
|
267 |
|
pure function getNlocal() result(nlocal) |
268 |
|
integer :: nlocal |
304 |
|
doesit = thisSim%SIM_uses_EAM |
305 |
|
end function SimUsesEAM |
306 |
|
|
307 |
+ |
function SimUsesDirectionalAtoms() result(doesit) |
308 |
+ |
logical :: doesit |
309 |
+ |
doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_sticky .or. & |
310 |
+ |
thisSim%SIM_uses_GB .or. thisSim%SIM_uses_RF |
311 |
+ |
end function SimUsesDirectionalAtoms |
312 |
+ |
|
313 |
|
function SimRequiresPrepairCalc() result(doesit) |
314 |
|
logical :: doesit |
315 |
|
doesit = thisSim%SIM_uses_EAM |
437 |
|
endif |
438 |
|
|
439 |
|
allocate(atid_Col(ncol),stat=alloc_stat) |
440 |
+ |
if (alloc_stat /= 0 ) then |
441 |
+ |
thisStat = 0 |
442 |
+ |
return |
443 |
+ |
endif |
444 |
+ |
|
445 |
+ |
allocate(rf_Row(ndim,nrow),stat=alloc_stat) |
446 |
+ |
if (alloc_stat /= 0 ) then |
447 |
+ |
thisStat = 0 |
448 |
+ |
return |
449 |
+ |
endif |
450 |
+ |
|
451 |
+ |
allocate(rf_Col(ndim,ncol),stat=alloc_stat) |
452 |
|
if (alloc_stat /= 0 ) then |
453 |
|
thisStat = 0 |
454 |
|
return |
455 |
|
endif |
456 |
|
|
457 |
+ |
allocate(rf_Temp(ndim,nlocal),stat=alloc_stat) |
458 |
+ |
if (alloc_stat /= 0 ) then |
459 |
+ |
thisStat = 0 |
460 |
+ |
return |
461 |
+ |
endif |
462 |
+ |
|
463 |
+ |
|
464 |
|
#else |
465 |
|
|
466 |
|
allocate(atid(nlocal),stat=alloc_stat) |
470 |
|
end if |
471 |
|
|
472 |
|
#endif |
473 |
+ |
|
474 |
+ |
allocate(rf(ndim,nlocal),stat=alloc_stat) |
475 |
+ |
if (alloc_stat /= 0 ) then |
476 |
+ |
thisStat = 0 |
477 |
+ |
return |
478 |
+ |
endif |
479 |
|
|
480 |
|
end subroutine setupGlobals |
481 |
|
|
482 |
|
subroutine freeGlobals() |
483 |
|
|
484 |
|
!We free in the opposite order in which we allocate in. |
436 |
– |
#ifdef IS_MPI |
485 |
|
|
486 |
+ |
if (allocated(rf)) deallocate(rf) |
487 |
+ |
#ifdef IS_MPI |
488 |
+ |
if (allocated(rf_Temp)) deallocate(rf_Temp) |
489 |
+ |
if (allocated(rf_Col)) deallocate(rf_Col) |
490 |
+ |
if (allocated(rf_Row)) deallocate(rf_Row) |
491 |
|
if (allocated(atid_Col)) deallocate(atid_Col) |
492 |
|
if (allocated(atid_Row)) deallocate(atid_Row) |
493 |
|
if (allocated(t_Temp)) deallocate(t_Temp) |
504 |
|
if (allocated(u_l_Col)) deallocate(u_l_Col) |
505 |
|
if (allocated(u_l_Row)) deallocate(u_l_Row) |
506 |
|
if (allocated(q_Col)) deallocate(q_Col) |
507 |
< |
if (allocated(q_Row)) deallocate(q_Row) |
508 |
< |
|
509 |
< |
#else |
457 |
< |
|
458 |
< |
if (allocated(atid)) deallocate(atid) |
459 |
< |
|
507 |
> |
if (allocated(q_Row)) deallocate(q_Row) |
508 |
> |
#else |
509 |
> |
if (allocated(atid)) deallocate(atid) |
510 |
|
#endif |
511 |
|
|
512 |
|
end subroutine freeGlobals |