diff --git a/test/simplemd/simplemd.f90 b/test/simplemd/simplemd.f90
index 515975c12ff8b2ba8e16465975249866a9eaecbe..f9623674e512beb30611e9d081f42c3f4a09e65e 100644
--- a/test/simplemd/simplemd.f90
+++ b/test/simplemd/simplemd.f90
@@ -55,8 +55,6 @@ logical :: has_parfile  ! a flag for the parameter file
 logical :: plumed
 integer :: plumedavailable
 
-integer, external :: iargc
-
 CALL plumed_installed(plumedavailable)
 
 plumed=.false.
@@ -66,7 +64,7 @@ IF(plumed) THEN
   CALL plumed_g_create()
 END IF
 
-argcount = iargc()
+argcount = command_argument_count()
 
 has_parfile=.false.
 do i=1,argcount