Skip to content

Commit

Permalink
Separate run time for the SCP iteration and Cholesky decomposition.
Browse files Browse the repository at this point in the history
  • Loading branch information
iong committed Jun 3, 2012
1 parent dd29d60 commit 7c3de05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions scp.f90
Expand Up @@ -16,7 +16,6 @@ program scp

double precision, allocatable :: r0(:,:)
double precision :: Uref, E0
double precision :: cpustart, cpustop

class(vgw), pointer :: p

Expand Down Expand Up @@ -68,16 +67,16 @@ program scp
E0 = p%Utot0(r0)/Natom
print '(F6.3,2F12.7,2E12.5)', kT, E0, 0d0, 0d0

call cpu_time(cpustart)
do i=1,nint(kTstop/dkT)
kT = dkT*i
E0 = p%F(reshape(r0, (/3*Natom/)) , kT, kT>dkT)
print '(F6.3,2F12.7,2E12.5)', kT, E0, p % qconv, p % gconv
end do
call cpu_time(cpustop)

write(waste, '("rt",I,".dat")') Natom
open(38,file=trim(waste))
write(38, '(I10,F16.7)') Natom, (cpustop - cpustart) / p%niterations
write(38, '(I10,2F16.7,I10)') Natom, p % iter_time / p % niterations, &
p % logdet_time * kT / dkT, p % niterations
call p%cleanup()
deallocate(p)

Expand Down
18 changes: 9 additions & 9 deletions vgw.f90
Expand Up @@ -19,6 +19,7 @@ module vgw_mod

double precision :: U, kT, BL, LJA(10), LJC(10), rt, sigma0, epsilon0
double precision :: q_atol, g_atol, dt_min, dt0, dt_max, qconv, gconv
double precision :: iter_time, logdet_time
double precision, allocatable :: Y(:), UX(:)

!class(integrator), pointer :: prop
Expand Down Expand Up @@ -49,6 +50,8 @@ subroutine init(self, Natom, species)
self%Natom = Natom
self%N3 = 3 * Natom
self%niterations = 0
self % iter_time = 0d0
self % logdet_time = 0d0

allocate (self % UX (3*self % Natom))

Expand Down Expand Up @@ -226,7 +229,7 @@ function vgw_F(self, Q0, kT, noinit)
double precision, intent(in) :: Q0(:), kT
logical, intent(in), optional :: noinit
double precision :: vgw_F
real*8 :: start_time, stop_time, c0
real*8 :: t1, t2, t3, c0
integer :: i
logical :: lnoinit = .FALSE.

Expand All @@ -240,19 +243,16 @@ function vgw_F(self, Q0, kT, noinit)
end if

! solve the VGW equations, measure CPU time
call cpu_time(start_time)
call cpu_time(t1)
call self % converge(1d-3, 1d-5)

call cpu_time(t2)
vgw_F = (self%U - self%kT * self%logdet() )/self%Natom &
- 3 * self%kT * log(self % kT * c0)
vgw_F = self%epsilon0 * vgw_F
call cpu_time(t3)

call cpu_time(stop_time)

self % rt = 0
!if ( self % prop%ncalls > 0) then
! self % rt = (stop_time - start_time) / real(self % prop%ncalls)
!end if
self % iter_time = self % iter_time + t2 - t1
self % logdet_time = self % logdet_time + t3 - t2
end function vgw_F


Expand Down

0 comments on commit 7c3de05

Please sign in to comment.