Skip to content

Commit

Permalink
Made f2py work on MacOS X (now uses gnu95/gfortran)
Browse files Browse the repository at this point in the history
Edited the makefile.
Also turned tabs into spaces to remove gfortran warnings.

Closes #11
  • Loading branch information
rwest committed Nov 17, 2009
1 parent b0787f5 commit 85c7d52
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 83 deletions.
12 changes: 8 additions & 4 deletions source/rmg/spectralfit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#
################################################################################

F90=g95
F90=gfortran
F2PY_FCOMPILER=gnu95
# Alternatively:
# F90=g95
# F2PY_FCOMPILER=g95

LDFLAGS=-lblas -llapack

Expand All @@ -13,8 +17,8 @@ LDFLAGS=-lblas -llapack
all: spectralfit.so

spectralfit.so: spectralfit.f90 calc_freq_code.o dqed.o
f2py --fcompiler=$(F90) calc_freq_code.o dqed.o -c spectralfit.f90 -m spectralfit $(LDFLAGS)
cp spectralfit.so ../
f2py --fcompiler=$(F2PY_FCOMPILER) calc_freq_code.o dqed.o -c spectralfit.f90 -m spectralfit $(LDFLAGS)
mv spectralfit.so ../

calc_freq_code.o: calc_freq_code.f90
$(F90) -c calc_freq_code.f90 -o calc_freq_code.o
Expand All @@ -23,5 +27,5 @@ dqed.o: dqed.f90
$(F90) -c dqed.f90 -o dqed.o

clean:
rm -f *.o *.mod spectralfit.so ../spectralfit.so
rm -f *.o *.mod ../spectralfit.so

158 changes: 79 additions & 79 deletions source/rmg/spectralfit/spectralfit.f90
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! RMG - Reaction Mechanism Generator
! RMG - Reaction Mechanism Generator
!
! Copyright (c) 2002-2009 Prof. William H. Green (whgreen@mit.edu) and the
! RMG Team (rmg_dev@mit.edu)
! Copyright (c) 2002-2009 Prof. William H. Green (whgreen@mit.edu) and the
! RMG Team (rmg_dev@mit.edu)
!
! Permission is hereby granted, free of charge, to any person obtaining a
! copy of this software and associated documentation files (the 'Software'),
! to deal in the Software without restriction, including without limitation
! the rights to use, copy, modify, merge, publish, distribute, sublicense,
! and/or sell copies of the Software, and to permit persons to whom the
! Software is furnished to do so, subject to the following conditions:
! Permission is hereby granted, free of charge, to any person obtaining a
! copy of this software and associated documentation files (the 'Software'),
! to deal in the Software without restriction, including without limitation
! the rights to use, copy, modify, merge, publish, distribute, sublicense,
! and/or sell copies of the Software, and to permit persons to whom the
! Software is furnished to do so, subject to the following conditions:
!
! The above copyright notice and this permission notice shall be included in
! all copies or substantial portions of the Software.
! The above copyright notice and this permission notice shall be included in
! all copies or substantial portions of the Software.
!
! THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
! DEALINGS IN THE SOFTWARE.
! THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
! DEALINGS IN THE SOFTWARE.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Expand All @@ -32,79 +32,79 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine fitSpectralData(Cv, Tlist, Ntemp, Nvib, Nhind, vib, hind)
! Estimate the spectroscopic degrees of freedom by fitting parameters to
! heat capacity data.
!
! ========== ====== ========================================================
! Parameter Intent Description
! ========== ====== ========================================================
! `Cv` in A list of heat capacities Cv/R at various temperatures
! for the unknown degrees of freedom (i.e. the known
! degrees of freedom should have already been removed)
! `Tlist` in The temperatures corresponding to the heat capacities
! `Ntemp` in The number of temperatures and heat capacities provided
! `Nvib` in The number of 1D quantum harmonic oscillators to fit
! `Nhind` in The number of 1D Pitzer hindered rotors to fit
! `vib` out A vector of fitted 1D quantum harmonic oscillator
! frequencies in cm^-1
! `hind` out A matrix of fitted 1D Pitzer hindered rotor frequency-
! barrier pairs, both in cm^-1
! ========== ====== ========================================================
! Estimate the spectroscopic degrees of freedom by fitting parameters to
! heat capacity data.
!
! ========== ====== ========================================================
! Parameter Intent Description
! ========== ====== ========================================================
! `Cv` in A list of heat capacities Cv/R at various temperatures
! for the unknown degrees of freedom (i.e. the known
! degrees of freedom should have already been removed)
! `Tlist` in The temperatures corresponding to the heat capacities
! `Ntemp` in The number of temperatures and heat capacities provided
! `Nvib` in The number of 1D quantum harmonic oscillators to fit
! `Nhind` in The number of 1D Pitzer hindered rotors to fit
! `vib` out A vector of fitted 1D quantum harmonic oscillator
! frequencies in cm^-1
! `hind` out A matrix of fitted 1D Pitzer hindered rotor frequency-
! barrier pairs, both in cm^-1
! ========== ====== ========================================================

integer, intent(in) :: Ntemp
integer, intent(in) :: Nvib
integer, intent(in) :: Nhind
real(8), dimension(1:Ntemp), intent(in) :: Cv
real(8), dimension(1:Ntemp), intent(in) :: Tlist
real(8), dimension(1:Nvib), intent(out) :: vib
real(8), dimension(1:Nhind,1:2), intent(out) :: hind
if (Ntemp /= 7) then
write (*,'(a)'), 'The number of temperatures must be exactly 7.'
stop
end if
integer, intent(in) :: Ntemp
integer, intent(in) :: Nvib
integer, intent(in) :: Nhind
real(8), dimension(1:Ntemp), intent(in) :: Cv
real(8), dimension(1:Ntemp), intent(in) :: Tlist
real(8), dimension(1:Nvib), intent(out) :: vib
real(8), dimension(1:Nhind,1:2), intent(out) :: hind
if (Ntemp /= 7) then
write (*,'(a)'), 'The number of temperatures must be exactly 7.'
stop
end if

! Fit the harmonic oscillator and hindered rotor modes to the heat capacity
! The function fitSpectralDataToHeatCapacity is in calc_freq_code.f90
call fitSpectralDataToHeatCapacity(Cv, Tlist, Ntemp, Nvib, Nhind, vib, hind)
! Fit the harmonic oscillator and hindered rotor modes to the heat capacity
! The function fitSpectralDataToHeatCapacity is in calc_freq_code.f90
call fitSpectralDataToHeatCapacity(Cv, Tlist, Ntemp, Nvib, Nhind, vib, hind)

end subroutine

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine fitSpectralDataNoRotors(Cv, Tlist, Ntemp, Nvib, vib)
! Estimate the spectroscopic degrees of freedom by fitting parameters to
! heat capacity data.
!
! ========== ====== ========================================================
! Parameter Intent Description
! ========== ====== ========================================================
! `Cv` in A list of heat capacities Cv/R at various temperatures
! for the unknown degrees of freedom (i.e. the known
! degrees of freedom should have already been removed)
! `Tlist` in The temperatures corresponding to the heat capacities
! `Ntemp` in The number of temperatures and heat capacities provided
! `Nvib` in The number of 1D quantum harmonic oscillators to fit
! `vib` out A vector of fitted 1D quantum harmonic oscillator
! frequencies in cm^-1
! ========== ====== ========================================================
! Estimate the spectroscopic degrees of freedom by fitting parameters to
! heat capacity data.
!
! ========== ====== ========================================================
! Parameter Intent Description
! ========== ====== ========================================================
! `Cv` in A list of heat capacities Cv/R at various temperatures
! for the unknown degrees of freedom (i.e. the known
! degrees of freedom should have already been removed)
! `Tlist` in The temperatures corresponding to the heat capacities
! `Ntemp` in The number of temperatures and heat capacities provided
! `Nvib` in The number of 1D quantum harmonic oscillators to fit
! `vib` out A vector of fitted 1D quantum harmonic oscillator
! frequencies in cm^-1
! ========== ====== ========================================================

integer, intent(in) :: Ntemp
integer, intent(in) :: Nvib
real(8), dimension(1:Ntemp), intent(in) :: Cv
real(8), dimension(1:Ntemp), intent(in) :: Tlist
real(8), dimension(1:Nvib), intent(out) :: vib
integer, intent(in) :: Ntemp
integer, intent(in) :: Nvib
real(8), dimension(1:Ntemp), intent(in) :: Cv
real(8), dimension(1:Ntemp), intent(in) :: Tlist
real(8), dimension(1:Nvib), intent(out) :: vib

real(8), dimension(1:0,1:2) :: hind
real(8), dimension(1:0,1:2) :: hind

if (Ntemp /= 7) then
write (*,'(a)'), 'The number of temperatures must be exactly 7.'
stop
end if
if (Ntemp /= 7) then
write (*,'(a)'), 'The number of temperatures must be exactly 7.'
stop
end if

! Fit the harmonic oscillator and hindered rotor modes to the heat capacity
! The function fitSpectralDataToHeatCapacity is in calc_freq_code.f90
call fitSpectralDataToHeatCapacity(Cv, Tlist, Ntemp, Nvib, 0, vib, hind)
! Fit the harmonic oscillator and hindered rotor modes to the heat capacity
! The function fitSpectralDataToHeatCapacity is in calc_freq_code.f90
call fitSpectralDataToHeatCapacity(Cv, Tlist, Ntemp, Nvib, 0, vib, hind)

end subroutine

Expand Down

0 comments on commit 85c7d52

Please sign in to comment.