Patch for compilation on Windows

FX fxco... at
Fri Apr 9 14:01:52 UTC 2010

Hi all,

I had to compile cp2k for Windows, for a tutorial we organized in
Paris. I used gfortran/mingw to get a portable, standalone executable,
and needed to make only one modification to the codebase:

Index: machine_gfortran.F
RCS file: /cvsroot/cp2k/cp2k/src/machine_gfortran.F,v
retrieving revision 1.18
diff -p -u -r1.18 machine_gfortran.F
--- machine_gfortran.F	3 Jan 2010 23:41:36 -0000	1.18
+++ machine_gfortran.F	9 Apr 2010 12:31:35 -0000
@@ -187,6 +187,7 @@ END FUNCTION m_cputime

     INTEGER                                  :: stat

+    call unlink(TARGET)
     IF (stat .NE. 0) THEN
       WRITE(6,*) "Trying to move "//TRIM(source)//" to "//

(Windows doesn't allow to rename() over an existing file, so unlink()
has to be called first.) I hope this can make it somehow into the CVS.

FX Coudert

More information about the CP2K-user mailing list