From 4b8803a18506636a11a8b97f685f67b234e7b90b Mon Sep 17 00:00:00 2001 From: Michael-P-Allen Date: Sun, 11 Aug 2024 14:27:24 +0100 Subject: [PATCH] Couple of minor cosmetic edits --- README.md | 6 +++--- SConstruct | 2 +- md_chain_lj_module.f90 | 2 +- md_lj_mts.f90 | 16 +++++++--------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3b34559..1ac9267 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ When using or citing the software, you should not imply endorsement by the autho ## Language The programs contain some explanatory comments, -and are written, in the main, in Fortran 2003/2008. +and are written, in the main, in Fortran 2003/2008/2018. This has some advantages: a built-in syntax for array operations, a straightforward approach to modular programming, and a basic simplicity. It is also a compiled language, which means that it is quite efficient, @@ -59,7 +59,7 @@ A few examples consist of individual routines or modules, rather than working programs, so there is no need to build them. -The build process for the Fortran examples has been tested using SCons v4.6.0 +The build process for the Fortran examples has been tested using SCons v4.8.0 (and some earlier versions back to v2.5.1 with minor changes to the `SConstruct` file). If you don't like using SCons, or can't get it to work, @@ -79,7 +79,7 @@ it is advisable to __compile each example in its own build directory__ or to delete all intermediate files before each individual compilation. We have used gfortran v13.2.0 (and earlier versions back to v6.3) for testing, -but have attempted to stick to code which conforms to the Fortran 2008 standard. +but have attempted to stick to code which conforms to the Fortran 2018 standard. Note that, by default, we do not select any optimization options in compilation. If you are using a different compiler, then the compiler and linker options in the `SConstruct` file will most likely need changing. diff --git a/SConstruct b/SConstruct index 2abc39b..2265284 100644 --- a/SConstruct +++ b/SConstruct @@ -26,7 +26,7 @@ import os, sys # we cannot offer more specific advice on the build process. # NB by default we do not invoke any optimization -MY_FLAGS='-fdefault-real-8 -fall-intrinsics -std=f2008 -Wall' +MY_FLAGS='-fdefault-real-8 -fall-intrinsics -std=f2018 -Wall' LAPACK_LIBPATH='/opt/local/lib/lapack' LAPACK_LIBS='lapack' FFTW_LIBPATH='/opt/local/lib' diff --git a/md_chain_lj_module.f90 b/md_chain_lj_module.f90 index 59bc5ec..068cb51 100644 --- a/md_chain_lj_module.f90 +++ b/md_chain_lj_module.f90 @@ -334,7 +334,7 @@ SUBROUTINE rattle_b ( dt, bond, wc ) ! Second part of velocity Verlet with const LOGICAL :: done REAL :: dot, g INTEGER :: i, j, iter - REAL, PARAMETER :: tol = 1.0e-9, tol2 = 2.0 * tol, dot_tol = 1.0e-9 + REAL, PARAMETER :: tol = 1.0e-9 INTEGER, PARAMETER :: iter_max = 500 iter = 0 diff --git a/md_lj_mts.f90 b/md_lj_mts.f90 index 6a33b30..a18c84a 100644 --- a/md_lj_mts.f90 +++ b/md_lj_mts.f90 @@ -116,17 +116,15 @@ PROGRAM md_lj_mts WRITE ( unit=error_unit, fmt='(a,*(i15))' ) 'n_mts values must be positive', n_mts STOP 'Error in md_lj_mts' END IF - DO k = 1, k_max + dt(1) = dt1 ! n_mts(1) equals 1 + vol_shell(1) = (4.0/3.0)*pi * r_cut(1)**3 + DO k = 2, k_max dt(k) = PRODUCT(n_mts(1:k))*dt1 ! Define time steps cumulatively - IF ( k == 1 ) THEN - vol_shell(k) = (4.0/3.0)*pi * r_cut(k)**3 - ELSE - IF ( r_cut(k)-r_cut(k-1) < lambda ) THEN - WRITE ( unit=error_unit, fmt='(a,3f15.6)' ) 'r_cut interval error', r_cut(k-1), r_cut(k), lambda - STOP 'Error in md_lj_mts' - END IF - vol_shell(k) = (4.0/3.0)*pi * ( r_cut(k)**3 - r_cut(k-1)**3 ) + IF ( r_cut(k)-r_cut(k-1) < lambda ) THEN + WRITE ( unit=error_unit, fmt='(a,3f15.6)' ) 'r_cut interval error', r_cut(k-1), r_cut(k), lambda + STOP 'Error in md_lj_mts' END IF + vol_shell(k) = (4.0/3.0)*pi * ( r_cut(k)**3 - r_cut(k-1)**3 ) END DO WRITE ( unit=output_unit, fmt='(a,t40,*(f15.6))' ) 'Time step for each shell', dt(:) WRITE ( unit=output_unit, fmt='(a,t40,*(f15.6))' ) 'Volume of each shell', vol_shell(:)