Skip to content
Snippets Groups Projects
Commit 71ca352a authored by Kurt A. O'Hearn's avatar Kurt A. O'Hearn
Browse files

Tests: refactor QMMM Fortran tester for Amber integration.

parent d93d2ca9
No related branches found
No related tags found
No related merge requests found
# Fortran object, module files
*.o
*.mod
# Generatd executable
driver
...@@ -95,7 +95,7 @@ end module driver_utils ...@@ -95,7 +95,7 @@ end module driver_utils
program driver program driver
use, intrinsic :: iso_c_binding use, intrinsic :: iso_c_binding
use driver_utils use driver_utils
use puremd use reaxff_puremd
implicit none implicit none
...@@ -109,11 +109,13 @@ program driver ...@@ -109,11 +109,13 @@ program driver
#define stderr 0 #define stderr 0
#endif #endif
integer, parameter :: max_sim_steps = 3
character(len=1024), dimension(:), allocatable :: args character(len=1024), dimension(:), allocatable :: args
character(len=1024) :: filename character(len=1024) :: filename
integer :: num_args, ix, num_atoms integer :: num_args, ix, num_atoms
integer (c_int) :: num_qm_atoms, num_mm_atoms integer (c_int) :: num_qm_atoms, num_mm_atoms
real (c_double) :: sim_box_info(6), e_tot real (c_double) :: sim_box_info(6), e_total
real (c_double), dimension(:), allocatable :: qm_pos, qm_q, qm_f, mm_pos_q, mm_f real (c_double), dimension(:), allocatable :: qm_pos, qm_q, qm_f, mm_pos_q, mm_f
character(len=5), dimension(:), allocatable :: qm_types, mm_types character(len=5), dimension(:), allocatable :: qm_types, mm_types
integer (c_int), dimension(:), allocatable :: qm_types_map, mm_types_map integer (c_int), dimension(:), allocatable :: qm_types_map, mm_types_map
...@@ -180,9 +182,13 @@ program driver ...@@ -180,9 +182,13 @@ program driver
endif endif
end do end do
call get_qc_forces( 100, 0, sim_box_info, num_qm_atoms, qm_pos, & do ix = 1, max_sim_steps
qm_types_map, qm_q, num_mm_atoms, mm_pos_q, mm_types_map, & call get_reaxff_puremd_forces( max_sim_steps, ix, sim_box_info, &
e_tot, qm_f, mm_f ) num_qm_atoms, qm_pos, qm_types_map, qm_q, num_mm_atoms, &
mm_pos_q, mm_types_map, e_total, qm_f, mm_f )
write (stdout, fmt=75) 'Sim. Step:', ix, 'Total energy:', e_total
end do
deallocate(args) deallocate(args)
deallocate(qm_types) deallocate(qm_types)
...@@ -194,4 +200,6 @@ program driver ...@@ -194,4 +200,6 @@ program driver
deallocate(mm_types_map) deallocate(mm_types_map)
deallocate(mm_pos_q) deallocate(mm_pos_q)
deallocate(mm_f) deallocate(mm_f)
75 format (A10, 1X, I3, 1X, A13, 1X, ES24.15)
end program driver end program driver
! module for interfacing with PuReMD code (ReaxFF+EEM in QM/MM mode) ! module for interfacing with PuReMD code (ReaxFF+EEM in QM/MM mode)
module puremd module reaxff_puremd
implicit none implicit none
interface interface
...@@ -112,7 +112,7 @@ module puremd ...@@ -112,7 +112,7 @@ module puremd
end interface end interface
contains contains
subroutine get_qc_forces( itermax, nstep, sim_box_info, num_qm_atoms, & subroutine get_reaxff_puremd_forces( itermax, nstep, sim_box_info, num_qm_atoms, &
qm_pos, qm_types, qm_q, num_mm_atoms, mm_pos_q, & qm_pos, qm_types, qm_q, num_mm_atoms, mm_pos_q, &
mm_types, e_total, qm_f, mm_f ) mm_types, e_total, qm_f, mm_f )
use, intrinsic :: iso_c_binding use, intrinsic :: iso_c_binding
...@@ -305,9 +305,10 @@ contains ...@@ -305,9 +305,10 @@ contains
c_loc(e_total), c_null_ptr, c_null_ptr, c_null_ptr ) c_loc(e_total), c_null_ptr, c_null_ptr, c_null_ptr )
if ( ret /= 0_c_int ) stop "ERROR: get_system_info" if ( ret /= 0_c_int ) stop "ERROR: get_system_info"
end if end if
if (nstep > itermax) then
if (nstep >= itermax) then
ret = cleanup( handle ) ret = cleanup( handle )
if ( ret /= 0_c_int ) stop "ERROR: cleanup" if ( ret /= 0_c_int ) stop "ERROR: cleanup"
end if end if
end subroutine get_qc_forces end subroutine get_reaxff_puremd_forces
end module puremd end module reaxff_puremd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment