diff --git a/attic/group/2dgroups/CMakeLists.txt b/attic/group/2dgroups/CMakeLists.txt index 7069ee7..ada1a0f 100644 --- a/attic/group/2dgroups/CMakeLists.txt +++ b/attic/group/2dgroups/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(new_2dgroups ${BUILD_MACOSX_BUNDLE} WIN32 - new_2dgroups.f + new_2dgroups.f90 ) target_link_libraries(new_2dgroups LINK_PUBLIC common io scf rpa) diff --git a/attic/group/2dgroups/new_2dgroups.f b/attic/group/2dgroups/new_2dgroups.f90 similarity index 100% rename from attic/group/2dgroups/new_2dgroups.f rename to attic/group/2dgroups/new_2dgroups.f90 diff --git a/attic/group/Makefile b/attic/group/Makefile index ee84684..5a434ff 100644 --- a/attic/group/Makefile +++ b/attic/group/Makefile @@ -13,10 +13,10 @@ NOPT=-Mfree=f90 clean: rm -f *.o *.mod -new_group: new_group.f \ +new_group: new_group.f90 \ ../../unit_cell_mod.o ../../group_mod.o \ ../../io_mod.o ../../const_mod.o - $(F90) $(FAST) -o $(BIN)/new_group new_group.f \ + $(F90) $(FAST) -o $(BIN)/new_group new_group.f90 \ ../../unit_cell_mod.o ../../group_mod.o \ ../../io_mod.o ../../const_mod.o diff --git a/attic/group/make_group.f b/attic/group/make_group.f90 similarity index 100% rename from attic/group/make_group.f rename to attic/group/make_group.f90 diff --git a/attic/group/new_group.f b/attic/group/new_group.f90 similarity index 100% rename from attic/group/new_group.f rename to attic/group/new_group.f90 diff --git a/attic/group/test.f b/attic/group/test.f90 similarity index 100% rename from attic/group/test.f rename to attic/group/test.f90 diff --git a/attic/rpa/test.f b/attic/rpa/test.f90 similarity index 100% rename from attic/rpa/test.f rename to attic/rpa/test.f90 diff --git a/attic/utility/CMakeLists.txt b/attic/utility/CMakeLists.txt index efcd12a..67979be 100644 --- a/attic/utility/CMakeLists.txt +++ b/attic/utility/CMakeLists.txt @@ -2,19 +2,19 @@ add_executable(nto2 - nto2.f + nto2.f90 ) target_link_libraries(nto2 LINK_PUBLIC common ) add_executable(nto3 - nto3.f + nto3.f90 ) target_link_libraries(nto3 LINK_PUBLIC common ) add_executable(switch - switch.f + switch.f90 ) target_link_libraries(switch LINK_PUBLIC common ) diff --git a/attic/utility/Makefile b/attic/utility/Makefile index 7ba52a5..679c126 100644 --- a/attic/utility/Makefile +++ b/attic/utility/Makefile @@ -12,18 +12,18 @@ NOPT=-Mfree=f90 clean: rm -f *.o *.mod -switch: switch.f \ +switch: switch.f90 \ ../build/const_mod.o - $(F90) $(FAST) -o $(BIN)/switch switch.f \ + $(F90) $(FAST) -o $(BIN)/switch switch.f90 \ ../build/const_mod.o -nto2: nto2.f \ +nto2: nto2.f90 \ ../build/const_mod.o - $(F90) $(FAST) -o $(BIN)/nto2 nto2.f \ + $(F90) $(FAST) -o $(BIN)/nto2 nto2.f90 \ ../build/const_mod.o -nto3: nto3.f \ +nto3: nto3.f90 \ ../build/const_mod.o - $(F90) $(FAST) -o $(BIN)/nto3 nto3.f \ + $(F90) $(FAST) -o $(BIN)/nto3 nto3.f90 \ ../build/const_mod.o diff --git a/attic/utility/nto2.f b/attic/utility/nto2.f90 similarity index 100% rename from attic/utility/nto2.f rename to attic/utility/nto2.f90 diff --git a/attic/utility/nto3.f b/attic/utility/nto3.f90 similarity index 100% rename from attic/utility/nto3.f rename to attic/utility/nto3.f90 diff --git a/attic/utility/switch.f b/attic/utility/switch.f90 similarity index 100% rename from attic/utility/switch.f rename to attic/utility/switch.f90 diff --git a/doc/Makefile b/doc/Makefile index dc6a35d..9b2881b 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -18,13 +18,13 @@ user-man: user-man/*.rst .PHONY: devel-man devel-man: - cp $(BLD)/pscf.f $(SRC)/pscf.f - cp $(BLD)/scf_mod.f $(SRC)/scf_mod.f - cp $(BLD)/iterate_mod.f $(SRC)/iterate_mod.f + cp $(BLD)/pscf.f90 $(SRC)/pscf.f90 + cp $(BLD)/scf_mod.f90 $(SRC)/scf_mod.f90 + cp $(BLD)/iterate_mod.f90 $(SRC)/iterate_mod.f90 $(PYTHON) $(GDOC) - rm $(SRC)/pscf.f - rm $(SRC)/scf_mod.f - rm $(SRC)/iterate_mod.f + rm $(SRC)/pscf.f90 + rm $(SRC)/scf_mod.f90 + rm $(SRC)/iterate_mod.f90 .PHONY: clean diff --git a/doc/user-man/compile-make.rst b/doc/user-man/compile-make.rst index c92b063..ed6bfa2 100644 --- a/doc/user-man/compile-make.rst +++ b/doc/user-man/compile-make.rst @@ -35,7 +35,7 @@ To compile the code in this way, proceed as follows: * The pscf/git/make directory will contain files named config.mk_r and Makefile. Make a copy of the file config.mk_r, by entering:: - cd config.mk_r config.mk + cp config.mk_r config.mk * Examine and edit the new config.mk file to reflect your environment, and to specify an installation directory. See below for further @@ -118,6 +118,10 @@ This will install: * python modules in $(INSTALL)/lib/python2.7/site-packages/pscf/ + * matlab scripts in $(INSTALL)/lib/matlab + + * text files in $(INSTALL)/share + where $(INSTALL) denotes the value of the makefile variable defined in the config.mk file. diff --git a/make/.gitignore b/make/.gitignore index 7c6209d..6108c5c 100644 --- a/make/.gitignore +++ b/make/.gitignore @@ -1,4 +1,5 @@ *.f +*.f90 *.o *.mod pscf diff --git a/make/INSTALL b/make/INSTALL index 5aeb96b..167075d 100644 --- a/make/INSTALL +++ b/make/INSTALL @@ -31,7 +31,7 @@ FFTW fast fourier transform library. 2. Change directory (cd) to the pscf/make directory (i.e., this directory) and copy the file config.mk_r to config.mk, by entering -> cp Makefile_r Makefile +> cp config.mk_r config.mk Explanation: The file config.mk_r is a default version of a configuration file that is stored in the git repository. Users can diff --git a/make/Makefile b/make/Makefile index 9e7b88c..2117d9a 100644 --- a/make/Makefile +++ b/make/Makefile @@ -23,7 +23,7 @@ all: make pscf clean: - rm -f *.o *.mod *.f pscf + rm -f *.o *.mod *.f90 pscf pscf: pscf.o\ const_mod.o string_mod.o io_mod.o version_mod.o field_io_mod.o\ @@ -41,15 +41,15 @@ pscf: pscf.o\ response_mod.o response_step_mod.o extrapolate_mod.o \ $(LIBDIRS) $(FFTWLIB) $(LAPACKLIB) -lm -pscf.o: pscf.f const_mod.o io_mod.o version_mod.o\ +pscf.o: pscf.f90 const_mod.o io_mod.o version_mod.o\ unit_cell_mod.o chemistry_mod.o field_io_mod.o\ sweep_mod.o iterate_mod.o scf_mod.o basis_mod.o\ spinodal_mod.o\ response_mod.o $(FFT_FILE).o response_step_mod.o extrapolate_mod.o - $(F90) $(FAST) -c pscf.f + $(F90) $(FAST) -c pscf.f90 -pscf.f: $(SRC)/pscf.fp.f - $(FORPEDO) $(DEVEL) $(SRC)/pscf.fp.f > pscf.f +pscf.f90: $(SRC)/pscf.fp.f90 + $(FORPEDO) $(DEVEL) $(SRC)/pscf.fp.f90 > pscf.f90 # ====== Install ================================================= @@ -66,5 +66,149 @@ install: pscf uninstall: rm -rf $(BIN_DIR)/pscf* - rm -rf $(PYTHON_DIR)/p* + rm -rf $(PYTHON_DIR)/pscf/* + +# ====== Modules ================================================= + +const_mod.o: $(SRC)/const_mod.f90 + $(F90) $(FAST) -c $(SRC)/const_mod.f90 + +# io Directory +string_mod.o: $(SRC)/io/string_mod.f90 + $(F90) $(FAST) -c $(SRC)/io/string_mod.f90 + +io_mod.o: $(SRC)/io/io_mod.f90 const_mod.o string_mod.o + $(F90) $(FAST) -c $(SRC)/io/io_mod.f90 + +version_mod.o: $(SRC)/io/version_mod.f90 + $(F90) $(FAST) -c $(SRC)/io/version_mod.f90 + +field_io_mod.o: $(SRC)/io/field_io_mod.f90 const_mod.o io_mod.o\ + string_mod.o unit_cell_mod.o chemistry_mod.o basis_mod.o\ + $(FFT_FILE).o grid_basis_mod.o + $(F90) $(FAST) -c $(SRC)/io/field_io_mod.f90 + +# grid directory +grid_mod.o: $(SRC)/grid/grid_mod.f90 const_mod.o\ + group_mod.o unit_cell_mod.o + $(F90) $(FAST) -c $(SRC)/grid/grid_mod.f90 + +$(FFT_FILE).o: $(SRC)/grid/$(FFT_FILE).f90 const_mod.o + $(F90) $(FAST) -c $(SRC)/grid/$(FFT_FILE).f90 + +# crystal directory +group_mod.o: $(SRC)/crystal/group_mod.f90 const_mod.o version_mod.o + $(F90) $(FAST) -c $(SRC)/crystal/group_mod.f90 + +unit_cell_mod.o: $(SRC)/crystal/unit_cell_mod.f90 const_mod.o\ + io_mod.o group_mod.o + $(F90) $(FAST) -c $(SRC)/crystal/unit_cell_mod.f90 + +space_groups_mod.o: $(SRC)/crystal/space_groups_mod.f90 const_mod.o\ + group_mod.o + $(F90) $(NOPT) -c $(SRC)/crystal/space_groups_mod.f90 + +basis_mod.o: $(SRC)/crystal/basis_mod.f90\ + const_mod.o string_mod.o io_mod.o\ + group_mod.o space_groups_mod.o unit_cell_mod.o\ + grid_mod.o + $(F90) $(FAST) -c $(SRC)/crystal/basis_mod.f90 + +grid_basis_mod.o: $(SRC)/crystal/grid_basis_mod.f90 const_mod.o\ + grid_mod.o basis_mod.o + $(F90) $(FAST) -c $(SRC)/crystal/grid_basis_mod.f90 + +deform_mod.o: $(SRC)/crystal/deform_mod.f90\ + const_mod.o string_mod.o io_mod.o\ + group_mod.o space_groups_mod.o unit_cell_mod.o\ + grid_mod.o basis_mod.o + $(F90) $(FAST) -c $(SRC)/crystal/deform_mod.f90 + +# scf directory +chemistry_mod.o: $(SRC)/scf/chemistry_mod.f90 const_mod.o io_mod.o + $(F90) $(FAST) -c $(SRC)/scf/chemistry_mod.f90 + +chain_mod.o: $(SRC)/scf/chain_mod.f90 const_mod.o\ + chemistry_mod.o $(FFT_FILE).o + $(F90) $(FAST) -c $(SRC)/scf/chain_mod.f90 + +step_mod.o: $(SRC)/scf/step_mod.f90 const_mod.o\ + $(FFT_FILE).o + $(F90) $(FAST) -c $(SRC)/scf/step_mod.f90 + +scf_mod.f90: $(SRC)/scf/scf_mod.fp.f90 + $(FORPEDO) $(DEVEL) $(SRC)/scf/scf_mod.fp.f90 > scf_mod.f90 + +scf_mod.o: scf_mod.f90 const_mod.o io_mod.o\ + basis_mod.o chemistry_mod.o step_mod.o\ + grid_mod.o chain_mod.o $(FFT_FILE).o grid_basis_mod.o + $(F90) $(FAST) -c scf_mod.f90 + +#rpa directory +rpa_mod.o: $(SRC)/rpa/rpa_mod.f90\ + chemistry_mod.o const_mod.o + $(F90) $(FAST) -c $(SRC)/rpa/rpa_mod.f90 + +spinodal_mod.o: $(SRC)/rpa/spinodal_mod.f90 const_mod.o io_mod.o\ + response_pd_mod.o chemistry_mod.o + $(F90) $(FAST) -c $(SRC)/rpa/spinodal_mod.f90 + +# iterate directory +iterate_mod.f90: $(SRC)/iterate/iterate_mod.fp.f90 + $(FORPEDO) $(DEVEL) $(SRC)/iterate/iterate_mod.fp.f90 > iterate_mod.f90 + +iterate_mod.o: iterate_mod.f90 const_mod.o\ + scf_mod.o basis_mod.o chemistry_mod.o unit_cell_mod.o\ + response_pd_mod.o + $(F90) $(FAST) -c iterate_mod.f90 + +response_pd_mod.o: $(SRC)/iterate/response_pd_mod.f90 const_mod.o io_mod.o\ + chemistry_mod.o basis_mod.o unit_cell_mod.o scf_mod.o\ + grid_mod.o $(FFT_FILE).o + $(F90) $(FAST) -c $(SRC)/iterate/response_pd_mod.f90 + +sweep_mod.o: $(SRC)/iterate/sweep_mod.f90 const_mod.o io_mod.o\ + chemistry_mod.o unit_cell_mod.o basis_mod.o + $(F90) $(FAST) -c $(SRC)/iterate/sweep_mod.f90 + +# response directory +response_step_mod.o: $(SRC)/response/response_step_mod.f90\ + chemistry_mod.o $(FFT_FILE).o + $(F90) $(FAST) -c $(SRC)/response/response_step_mod.f90 + +extrapolate_mod.o: $(SRC)/response/extrapolate_mod.f90\ + const_mod.o + $(F90) $(FAST) -c $(SRC)/response/extrapolate_mod.f90 + +response_mod.o: $(SRC)/response/response_mod.f90\ + chemistry_mod.o const_mod.o chain_mod.o\ + grid_mod.o $(FFT_FILE).o group_mod.o response_step_mod.o\ + extrapolate_mod.o field_io_mod.o spinodal_mod.o + $(F90) $(FAST) -c $(SRC)/response/response_mod.f90 + +# ======================================================== +# tests subdirectory + +rpa_test.o: $(SRC)/tests/rpa/test.f90 rpa_mod.o\ + chemistry_mod.o io_mod.o string_mod.o const_mod.o + $(F90) $(FAST) -o rpa_test.o -c $(SRC)/tests/rpa/test.f90 + +rpa_test: rpa_test.o rpa_mod.o\ + chemistry_mod.o io_mod.o string_mod.o const_mod.o + $(F90) $(LINK) -lm -o $(SRC)/tests/rpa/exc\ + rpa_test.o rpa_mod.o\ + chemistry_mod.o io_mod.o string_mod.o const_mod.o\ + $(LAPACKLIB) + +# ======================================================== +# Code to convert 2D groups to Fortran + +new_2dgroups: $(SRC)/tests/group/2dgroups/new_2dgroups.f90\ + const_mod.o io_mod.o version_mod.o string_mod.o\ + group_mod.o unit_cell_mod.o + $(F90) $(LINK) -o $(SRC)/tests/group/2dgroups/new_2dgroups\ + $(SRC)/tests/group/2dgroups/new_2dgroups.f90\ + const_mod.o io_mod.o string_mod.o version_mod.o\ + group_mod.o unit_cell_mod.o +>>>>>>> master diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 15869b2..4e3c107 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,10 @@ # TODO: move these options to the top file if (USE_FFT3) - set (FFT_FILE fft3_mod.f) + set (FFT_FILE fft3_mod.f90) find_package(FFTW) else (USE_FFT3) - set (FFT_FILE fft2_mod.f) + set (FFT_FILE fft2_mod.f90) find_package(FFTW) endif (USE_FFT3) @@ -22,43 +22,43 @@ set(FORPEDO ${CMAKE_SOURCE_DIR}/tools/python/preprocess-0.6.1/preprocess.py) find_package(LAPACK) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/scf_mod.f - COMMAND ${FORPEDO} ${DEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/scf_mod.fp.f > ${CMAKE_CURRENT_BINARY_DIR}/scf_mod.f - DEPENDS scf_mod.fp.f + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/scf_mod.f90 + COMMAND ${FORPEDO} ${DEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/scf_mod.fp.f90 > ${CMAKE_CURRENT_BINARY_DIR}/scf_mod.f90 + DEPENDS scf_mod.fp.f90 ) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iterate_mod.f - COMMAND ${FORPEDO} ${DEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/iterate_mod.fp.f > ${CMAKE_CURRENT_BINARY_DIR}/iterate_mod.f - DEPENDS iterate_mod.fp.f + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/iterate_mod.f90 + COMMAND ${FORPEDO} ${DEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/iterate_mod.fp.f90 > ${CMAKE_CURRENT_BINARY_DIR}/iterate_mod.f90 + DEPENDS iterate_mod.fp.f90 ) # Create a library called "pscf_lib", which includes module source files. # The extension is already found. Any number of sources could be listed here. add_library(pscf_lib - const_mod.f - io_mod.f - string_mod.f - version_mod.f - field_io_mod.f + const_mod.f90 + io_mod.f90 + string_mod.f90 + version_mod.f90 + field_io_mod.f90 ${FFT_FILE} - grid_mod.f - basis_mod.f - grid_basis_mod.f - group_mod.f - unit_cell_mod.f - space_groups_mod.f - chain_mod.f - chemistry_mod.f - step_mod.f - ${CMAKE_CURRENT_BINARY_DIR}/scf_mod.f - ${CMAKE_CURRENT_BINARY_DIR}/iterate_mod.f - response_pd_mod.f - sweep_mod.f - extrapolate_mod.f - response_mod.f - response_step_mod.f - spinodal_mod.f + grid_mod.f90 + basis_mod.f90 + grid_basis_mod.f90 + group_mod.f90 + unit_cell_mod.f90 + space_groups_mod.f90 + chain_mod.f90 + chemistry_mod.f90 + step_mod.f90 + ${CMAKE_CURRENT_BINARY_DIR}/scf_mod.f90 + ${CMAKE_CURRENT_BINARY_DIR}/iterate_mod.f90 + response_pd_mod.f90 + sweep_mod.f90 + extrapolate_mod.f90 + response_mod.f90 + response_step_mod.f90 + spinodal_mod.f90 ) # Ensure that linker can find any headers or fortram *.mod module files, @@ -74,14 +74,14 @@ target_link_libraries(pscf_lib LINK_PUBLIC ${FFTW_LIBRARIES} ${LAPACK_LIBRARIES} ### PREPROCESS THE MAIN FILE ### add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pscf.f - COMMAND ${FORPEDO} ${DEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/pscf.fp.f > ${CMAKE_CURRENT_BINARY_DIR}/pscf.f - DEPENDS pscf.fp.f + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pscf.f90 + COMMAND ${FORPEDO} ${DEVEL} ${CMAKE_CURRENT_SOURCE_DIR}/pscf.fp.f90 > ${CMAKE_CURRENT_BINARY_DIR}/pscf.f90 + DEPENDS pscf.fp.f90 ) add_executable(pscf ${BUILD_MACOSX_BUNDLE} WIN32 - ${CMAKE_CURRENT_BINARY_DIR}/pscf.f + ${CMAKE_CURRENT_BINARY_DIR}/pscf.f90 ) set(APPS ${CMAKE_CURRENT_BINARY_DIR}/pscf${MACOSX_BUNDLE_EXT}) diff --git a/src/README b/src/README index a8531bd..af1bcdd 100644 --- a/src/README +++ b/src/README @@ -1,29 +1,23 @@ File Name Conventions: - Files named .f are Fortran 90 files - Files named .fp.f are Fortran 90 preprocessor input files. - - Preprocessor input files are simply Fortran 90 files that contain - blocks of code that is conditionally included and compiled only if - particular environment variables are defined. These files are - converted by the build system into corresponding Fortran 90 files - by applying a python preprocessor script that is distributed with the - pscf source code. There are only a few files that are treated in - this manner, but the main program is among them. See the comment - at the end of this file for further discussion of the use of a - preprocessor. + Files named _mod.f90 are Fortran 90 modules + Files named .fp.f90 are preprocessor input files. + The un-preprocessed version of the main program is src/pscf.fp.f90. + A corresponding compilable fortran program is generated by applying + a preprocessor script, which installs the resulting program in the + build directory. See the end of this file for a discussion of the + use of a preprocessor. Main Program: -pscf.fp.f - Main program preprocessor input file. Used to generate the - compilable fortran file pscf.f, which is installed in the - build directory. +pscf.fp.f90 + Main program (preprocessor input file). Used to generate the + compilable fortran file pscf.f90 in the build directory. Utility Modules: - +======= const_mod.f Defines global variable dim (= # dimensions of space) and parameter long (=real kind for double precision). Used by @@ -48,11 +42,11 @@ FFT grid Modules: fft3_mod.f Fortran 90 wrappers for FFTW Fourier transform functions, - for FFTW version 3 (Either this or fft2_mod.f is linked) + for FFTW version 3 (Either this or fft2_mod.f90 is linked) fft2_mod.f Fortran 90 wrappers for FFTW Fourier transform functions, - for FFTW version 2 (Either this or fft3_mod.f is linked) + for FFTW version 2 (Either this or fft3_mod.f90 is linked) grid_mod.f Defines scf data structures on an FFT grid, and routines @@ -111,10 +105,12 @@ chain_mod.f destroy these arrays. step_mod.f - Routines to integrate one time step of modified diffusion - equation, using the Rasmussen-Kaloskas pseudo-spectral - algorithm and extrapolation with respect to contour - length step size. + Contains routines to solve diffusion equation by the + pseudo-spectral method, and to calculate monomer + concentration fields, the free and energy, and stress. + Note: scf/scf_mod.fp.f90 is a preprocessor input file, which + is used to generate file scf_mod.f90 in the build directory. + scf_mod.fp.f Contains routines to solve diffusion equation by the @@ -123,13 +119,20 @@ scf_mod.fp.f Note: scf_mod.fp.f is a preprocessor input file, which is used to generate file scf_mod.f in the build directory. +scf/chain_mod.f90 + Defines a derived type chain_type that contains the + q(r,s) =qf and q^{+}(r,s) =qr functions for a chain, and + information about discretization in r and s. Also defines + arrays of chain_types and subroutines to allocate and + destroy these arrays. + Iteration Modules: iterate_mod.fp.f Iterates scf equations to convergence. Currently contains Newton-Raphson (NR) algorithm for both fixed and variable - unit cells. Note: File iterate_mod.fp.f is a preprocessor - input file, which is used to generate file iterate_mod.f + unit cells. Note: File iterate_mod.fp.f90 is a preprocessor + input file, which is used to generate file iterate_mod.f90 in the build directory. sweep_mod @@ -167,9 +170,9 @@ extrapolate_mod.f The relevant preprocesor input files are: - src/pscf.fp.f - src/iterate/iterate_mod.fp.f - src/scf/scf_mod.fp.f + src/pscf.fp.f90 + src/iterate_mod.fp.f90 + src/scf_mod.fp.f90 These are fortran files that contain preprocessor directives that control conditional compilation of some sections of code. The @@ -179,9 +182,9 @@ extrapolate_mod.f a Fortran file with the same name as the preprocessor input file without the .fp. string. The resulting fortran files are thus named: - build/scf.f - build/iterate_mod.f - build/scf_mod.f + build/scf.f90 + build/iterate_mod.f90 + build/scf_mod.f90 These preprocessed fortran files installed in the build directory from which make is invoked, rather than in the src/ directory. If @@ -202,10 +205,10 @@ extrapolate_mod.f conditional compilation directives and are excluded from release versions of the corresponding fortran files. - If the *.fp.f preprocessor files are modified, and the program + If the *.fp.f90 preprocessor files are modified, and the program is then recompiled using either cmake or the make file in the - pscf/make directory, then the *.f fortran files will be regenerated + pscf/make directory, then the *.f90 fortran files will be regenerated regenerated as part of the build process. When compiled with make - in the src/make directory, the src/make/*.f fortran files are also + in the src/make directory, the src/make/*.f90 fortran files are also removed by the 'make clean' command. diff --git a/src/basis_mod.f b/src/basis_mod.f90 similarity index 100% rename from src/basis_mod.f rename to src/basis_mod.f90 diff --git a/src/chain_mod.f b/src/chain_mod.f90 similarity index 100% rename from src/chain_mod.f rename to src/chain_mod.f90 diff --git a/src/chemistry_mod.f b/src/chemistry_mod.f90 similarity index 100% rename from src/chemistry_mod.f rename to src/chemistry_mod.f90 diff --git a/src/const_mod.f b/src/const_mod.f90 similarity index 100% rename from src/const_mod.f rename to src/const_mod.f90 diff --git a/attic/deform/deform_mod.f b/src/deform_mod.f90 similarity index 100% rename from attic/deform/deform_mod.f rename to src/deform_mod.f90 diff --git a/src/extrapolate_mod.f b/src/extrapolate_mod.f90 similarity index 100% rename from src/extrapolate_mod.f rename to src/extrapolate_mod.f90 diff --git a/src/fft2_mod.f b/src/fft2_mod.f90 similarity index 100% rename from src/fft2_mod.f rename to src/fft2_mod.f90 diff --git a/src/fft3_mod.f b/src/fft3_mod.f90 similarity index 100% rename from src/fft3_mod.f rename to src/fft3_mod.f90 diff --git a/src/field_io_mod.f b/src/field_io_mod.f90 similarity index 100% rename from src/field_io_mod.f rename to src/field_io_mod.f90 diff --git a/src/grid_basis_mod.f b/src/grid_basis_mod.f90 similarity index 100% rename from src/grid_basis_mod.f rename to src/grid_basis_mod.f90 diff --git a/src/grid_mod.f b/src/grid_mod.f90 similarity index 100% rename from src/grid_mod.f rename to src/grid_mod.f90 diff --git a/src/group_mod.f b/src/group_mod.f90 similarity index 100% rename from src/group_mod.f rename to src/group_mod.f90 diff --git a/src/io_mod.f b/src/io_mod.f90 similarity index 100% rename from src/io_mod.f rename to src/io_mod.f90 diff --git a/src/iterate_mod.fp.f b/src/iterate_mod.fp.f90 similarity index 100% rename from src/iterate_mod.fp.f rename to src/iterate_mod.fp.f90 diff --git a/src/pscf.fp.f b/src/pscf.fp.f90 similarity index 100% rename from src/pscf.fp.f rename to src/pscf.fp.f90 diff --git a/src/response_mod.f b/src/response_mod.f90 similarity index 100% rename from src/response_mod.f rename to src/response_mod.f90 diff --git a/src/response_pd_mod.f b/src/response_pd_mod.f90 similarity index 100% rename from src/response_pd_mod.f rename to src/response_pd_mod.f90 diff --git a/src/response_step_mod.f b/src/response_step_mod.f90 similarity index 100% rename from src/response_step_mod.f rename to src/response_step_mod.f90 diff --git a/attic/rpa/rpa_mod.f b/src/rpa_mod.f90 similarity index 100% rename from attic/rpa/rpa_mod.f rename to src/rpa_mod.f90 diff --git a/src/scf_mod.fp.f b/src/scf_mod.fp.f90 similarity index 100% rename from src/scf_mod.fp.f rename to src/scf_mod.fp.f90 diff --git a/src/space_groups_mod.f b/src/space_groups_mod.f90 similarity index 100% rename from src/space_groups_mod.f rename to src/space_groups_mod.f90 diff --git a/src/spinodal_mod.f b/src/spinodal_mod.f90 similarity index 100% rename from src/spinodal_mod.f rename to src/spinodal_mod.f90 diff --git a/src/step_mod.f b/src/step_mod.f90 similarity index 100% rename from src/step_mod.f rename to src/step_mod.f90 diff --git a/src/string_mod.f b/src/string_mod.f90 similarity index 100% rename from src/string_mod.f rename to src/string_mod.f90 diff --git a/src/sweep_mod.f b/src/sweep_mod.f90 similarity index 100% rename from src/sweep_mod.f rename to src/sweep_mod.f90 diff --git a/src/unit_cell_mod.f b/src/unit_cell_mod.f90 similarity index 100% rename from src/unit_cell_mod.f rename to src/unit_cell_mod.f90 diff --git a/src/version_mod.f b/src/version_mod.f90 similarity index 100% rename from src/version_mod.f rename to src/version_mod.f90 diff --git a/tools/python/preprocess-0.6.1/preprocess.py b/tools/python/preprocess-0.6.1/preprocess.py index 2e0be75..f92b43c 100755 --- a/tools/python/preprocess-0.6.1/preprocess.py +++ b/tools/python/preprocess-0.6.1/preprocess.py @@ -133,7 +133,7 @@ def __init__(self, name, level=None, streamOrFileName=sys.stderr): self._level = self.WARN else: self._level = level - if type(streamOrFileName) == types.StringType: + if isinstance(streamOrFileName, str): self.stream = open(streamOrFileName, 'w') self._opennedStream = 1 else: @@ -190,7 +190,7 @@ def _evaluate(expr, defines): #interpolated = _interpolate(s, defines) try: rv = eval(expr, {'defined':lambda v: v in defines}, defines) - except Exception, ex: + except Exception as ex: msg = str(ex) if msg.startswith("name '") and msg.endswith("' is not defined"): # A common error (at least this is presumed:) is to have @@ -276,7 +276,7 @@ def getContentType(filename): basename = os.path.basename(filename) contentType = None # Try to determine from the filename. - if not contentType and filenameMap.has_key(basename): + if not contentType and basename in filenameMap: contentType = filenameMap[basename] log.debug("Content type of '%s' is '%s' (determined from full "\ "filename).", filename, contentType) @@ -286,7 +286,7 @@ def getContentType(filename): if sys.platform.startswith("win"): # Suffix patterns are case-insensitive on Windows. suffix = suffix.lower() - if suffixMap.has_key(suffix): + if suffix in suffixMap: contentType = suffixMap[suffix] log.debug("Content type of '%s' is '%s' (determined from "\ "suffix '%s').", filename, contentType, suffix) @@ -378,9 +378,9 @@ def preprocess(infile, outfile=sys.stdout, defines={}, force=0, keepLines=0, # (Would be helpful if I knew anything about lexing and parsing # simple grammars.) fin = open(infile, 'r') - if type(outfile) in types.StringTypes: + if isinstance(outfile, str): if force and os.path.exists(outfile): - os.chmod(outfile, 0777) + os.chmod(outfile, 0o777) os.remove(outfile) fout = open(outfile, 'w') else: @@ -541,7 +541,7 @@ def main(argv): optlist, args = getopt.getopt(argv[1:], 'hVvo:D:fkI:s', ['help', 'version', 'verbose', 'force', 'keep-lines', 'substitute']) - except getopt.GetoptError, msg: + except getopt.GetoptError as msg: sys.stderr.write("preprocess: error: %s. Your invocation was: %s\n"\ % (msg, argv)) sys.stderr.write("See 'preprocess --help'.\n") @@ -594,7 +594,7 @@ def main(argv): try: preprocess(infile, outfile, defines, force, keepLines, includePath, substitute) - except PreprocessError, ex: + except PreprocessError as ex: if verbose: import traceback traceback.print_exc(file=sys.stderr)