forked from ReactionMechanismGenerator/RMG-Py
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
203 lines (178 loc) · 6.42 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
################################################################################
#
# Makefile for RMG Py
#
################################################################################
DASPK=$(shell python -c 'import pydas.daspk; print pydas.daspk.__file__')
DASSL=$(shell python -c 'import pydas.dassl; print pydas.dassl.__file__')
.PHONY : all minimal main solver check cantherm clean install decython documentation mopac_travis
all: main solver check
minimal:
python setup.py build_ext minimal --build-lib . --build-temp build --pyrex-c-in-temp
main:
@ echo "Checking you have PyDQED..."
@ python -c 'import pydqed; print pydqed.__file__'
python setup.py build_ext main --build-lib . --build-temp build --pyrex-c-in-temp
solver:
ifneq ($(DASPK),)
@ echo "DASPK solver found. Compiling with DASPK and sensitivity analysis capability..."
@ (echo DEF DASPK = 1) > rmgpy/solver/settings.pxi
else ifneq ($(DASSL),)
@ echo "DASSL solver found. Compiling with DASSL. Sensitivity analysis capabilities are off..."
@ (echo DEF DASPK = 0) > rmgpy/solver/settings.pxi
else
@ echo 'No PyDAS solvers found. Please check if you have the latest version of PyDAS.'
@ python -c 'import pydas.dassl'
endif
python setup.py build_ext solver --build-lib . --build-temp build --pyrex-c-in-temp
arkane:
python setup.py build_ext arkane --build-lib . --build-temp build --pyrex-c-in-temp
check:
@ python utilities.py check-dependencies
documentation:
$(MAKE) -C documentation html
@ echo "Start at: documentation/build/html/index.html"
clean:
@ echo "Removing build directory..."
@ python setup.py clean --build-temp build
@ echo "Removing compiled files..."
@ python utilities.py clean
@ echo "Cleanup completed."
clean-solver:
@ echo "Removing solver build directories..."
ifeq ($(OS),Windows_NT)
@ -rd /s /q build\pyrex\rmgpy\solver
@ -rd /s /q build\build\pyrex\rmgpy\solver
else
@ -rm -r build/pyrex/rmgpy/solver/
@ -rm -r build/build/pyrex/rmgpy/solver/
endif
@ echo "Removing compiled files..."
@ python utilities.py clean-solver
@ echo "Cleanup completed."
install:
@ echo "Checking you have PyDQED..."
@ python -c 'import pydqed; print pydqed.__file__'
ifneq ($(DASPK),)
@ echo "DASPK solver found. Compiling with DASPK and sensitivity analysis capability..."
@ (echo DEF DASPK = 1) > rmgpy/solver/settings.pxi
else ifneq ($(DASSL),)
@ echo "DASSL solver found. Compiling with DASSL. Sensitivity analysis capabilities are off..."
@ (echo DEF DASPK = 0) > rmgpy/solver/settings.pxi
else
@ echo 'No PyDAS solvers found. Please check if you have the latest version of PyDAS.'
@ python -c 'import pydas.dassl'
endif
python setup.py install
decython:
# de-cythonize all but the 'minimal'. Helpful for debugging in "pure python" mode.
find . -name *.so ! \( -name _statmech.so -o -name quantity.so -o -regex '.*rmgpy/solver/.*' \) -exec rm -f '{}' \;
find . -name *.pyc -exec rm -f '{}' \;
test-all:
ifneq ($(OS),Windows_NT)
mkdir -p testing/coverage
rm -rf testing/coverage/*
endif
nosetests --nocapture --nologcapture --all-modules --verbose --with-coverage --cover-inclusive --cover-package=rmgpy --cover-erase --cover-html --cover-html-dir=testing/coverage --exe rmgpy arkane
test test-unittests:
ifneq ($(OS),Windows_NT)
mkdir -p testing/coverage
rm -rf testing/coverage/*
endif
nosetests --nocapture --nologcapture --all-modules -A 'not functional' --verbose --with-coverage --cover-inclusive --cover-package=rmgpy --cover-erase --cover-html --cover-html-dir=testing/coverage --exe rmgpy arkane
test-functional:
ifneq ($(OS),Windows_NT)
mkdir -p testing/coverage
rm -rf testing/coverage/*
endif
nosetests --nocapture --nologcapture --all-modules -A 'functional' --verbose --exe rmgpy arkane
test-database:
nosetests -v -d testing/databaseTest.py
eg0: all
mkdir -p testing/eg0
rm -rf testing/eg0/*
cp examples/rmg/superminimal/input.py testing/eg0/input.py
@ echo "Running eg0: superminimal (H2 oxidation) example"
python rmg.py testing/eg0/input.py
eg1: all
mkdir -p testing/eg1
rm -rf testing/eg1/*
cp examples/rmg/minimal/input.py testing/eg1/input.py
coverage erase
@ echo "Running eg1: minimal (ethane pyrolysis) example with coverage tracking AND profiling"
coverage run rmg.py -p testing/eg1/input.py
coverage report
coverage html
eg2: all
mkdir -p testing/eg2
rm -rf testing/eg2/*
cp examples/rmg/1,3-hexadiene/input.py testing/eg2/input.py
coverage erase
@ echo "Running eg2: 1,3-hexadiene example with coverage tracking AND profiling"
coverage run rmg.py -p testing/eg2/input.py
coverage report
coverage html
eg3: all
mkdir -p testing/eg3
rm -rf testing/eg3/*
cp examples/rmg/liquid_phase/input.py testing/eg3/input.py
coverage erase
@ echo "Running eg3: liquid_phase example with coverage tracking AND profiling"
coverage run rmg.py -p testing/eg3/input.py
coverage report
coverage html
eg5: all
mkdir -p testing/eg5
rm -rf testing/eg5/*
cp examples/rmg/heptane-eg5/input.py testing/eg5/input.py
@ echo "Running eg5: heptane example"
python rmg.py testing/eg5/input.py
eg6: all
mkdir -p testing/eg6
rm -rf testing/eg6/*
cp examples/rmg/ethane-oxidation/input.py testing/eg6/input.py
@ echo "Running eg6: ethane-oxidation example"
python rmg.py testing/eg6/input.py
eg7: all
mkdir -p testing/eg7
rm -rf testing/eg7/*
cp examples/rmg/gri_mech_rxn_lib/input.py testing/eg7/input.py
@ echo "Running eg7: gri_mech_rxn_lib example"
python rmg.py testing/eg7/input.py
scoop: all
mkdir -p testing/scoop
rm -rf testing/scoop/*
cp examples/rmg/minimal/input.py testing/scoop/input.py
coverage erase
@ echo "Running minimal example with SCOOP"
python -m scoop -n 2 rmg.py -v testing/scoop/input.py
#########
# Section for setting up MOPAC calculations on the Travis-CI.org server
ifeq ($(TRAVIS),true)
ifneq ($(TRAVIS_SECURE_ENV_VARS),true)
SKIP_MOPAC=true
endif
endif
mopac_travis:
ifeq ($(TRAVIS),true)
ifneq ($(TRAVIS_SECURE_ENV_VARS),true)
@echo "Don't have MOPAC licence key on this Travis build so can't test QM"
else
@echo "Installing MOPAC key"
@yes Yes | mopac $(MOPACKEY)
endif
else
@#echo "Not in Travis build, no need to run this target"
endif
# End of MOPAC / TRAVIS stuff
#######
eg4: all mopac_travis
ifeq ($(SKIP_MOPAC),true)
@echo "Skipping eg4 (without failing) because can't run MOPAC"
else
mkdir -p testing/eg4
rm -rf testing/eg4/*
cp examples/thermoEstimator/input.py testing/eg4/input.py
@ echo "Running thermo data estimator example. This tests QM."
python scripts/thermoEstimator.py testing/eg4/input.py
endif