diff --git a/test/library/qmmm_amber/fortran_stub/.gitignore b/test/library/qmmm_amber/fortran_stub/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7e90176f4b13133362a66c966721487ea9951a00 --- /dev/null +++ b/test/library/qmmm_amber/fortran_stub/.gitignore @@ -0,0 +1,5 @@ +# Fortran object, module files +*.o +*.mod +# Generatd executable +driver diff --git a/test/library/qmmm_amber/fortran_stub/driver.F03 b/test/library/qmmm_amber/fortran_stub/driver.F03 index d89af2bee9e728226d0e3a0b4dbf9a5c826fbe48..a61d3774080add1d4f8f821e0d051760b1f85924 100644 --- a/test/library/qmmm_amber/fortran_stub/driver.F03 +++ b/test/library/qmmm_amber/fortran_stub/driver.F03 @@ -95,7 +95,7 @@ end module driver_utils program driver use, intrinsic :: iso_c_binding use driver_utils - use puremd + use reaxff_puremd implicit none @@ -109,11 +109,13 @@ program driver #define stderr 0 #endif + integer, parameter :: max_sim_steps = 3 + character(len=1024), dimension(:), allocatable :: args character(len=1024) :: filename integer :: num_args, ix, num_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 character(len=5), dimension(:), allocatable :: qm_types, mm_types integer (c_int), dimension(:), allocatable :: qm_types_map, mm_types_map @@ -180,9 +182,13 @@ program driver endif end do - call get_qc_forces( 100, 0, sim_box_info, num_qm_atoms, qm_pos, & - qm_types_map, qm_q, num_mm_atoms, mm_pos_q, mm_types_map, & - e_tot, qm_f, mm_f ) + do ix = 1, max_sim_steps + call get_reaxff_puremd_forces( max_sim_steps, ix, sim_box_info, & + 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(qm_types) @@ -194,4 +200,6 @@ program driver deallocate(mm_types_map) deallocate(mm_pos_q) deallocate(mm_f) + + 75 format (A10, 1X, I3, 1X, A13, 1X, ES24.15) end program driver diff --git a/test/library/qmmm_amber/fortran_stub/puremd.F03 b/test/library/qmmm_amber/fortran_stub/reaxff_puremd.F03 similarity index 98% rename from test/library/qmmm_amber/fortran_stub/puremd.F03 rename to test/library/qmmm_amber/fortran_stub/reaxff_puremd.F03 index b8266ea31b6356f8270d5a48c317eeb1f2201c75..dfa29adbbc8703f10be25e199678fa51c8f543bb 100644 --- a/test/library/qmmm_amber/fortran_stub/puremd.F03 +++ b/test/library/qmmm_amber/fortran_stub/reaxff_puremd.F03 @@ -1,5 +1,5 @@ ! module for interfacing with PuReMD code (ReaxFF+EEM in QM/MM mode) -module puremd +module reaxff_puremd implicit none interface @@ -112,7 +112,7 @@ module puremd end interface 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, & mm_types, e_total, qm_f, mm_f ) use, intrinsic :: iso_c_binding @@ -305,9 +305,10 @@ contains c_loc(e_total), c_null_ptr, c_null_ptr, c_null_ptr ) if ( ret /= 0_c_int ) stop "ERROR: get_system_info" end if - if (nstep > itermax) then + + if (nstep >= itermax) then ret = cleanup( handle ) if ( ret /= 0_c_int ) stop "ERROR: cleanup" end if - end subroutine get_qc_forces -end module puremd + end subroutine get_reaxff_puremd_forces +end module reaxff_puremd