# Comiling CHEMMECH

Hi CMAQ users:
I am trying to compile and run CHEMMECH to modify the chemical mechanism. While it failed. Is there anything I missed?
Best
Huan

fang63@brown-fe01:/scratch/brown/fang63/cmaq/5.2.1/UTIL/chemmech/scripts $./bldit_chemmech.csh intel \rm -f *.o *.mod pgf90 -Mfixed -Mextend -Mbounds -Mchkfpstk -Mchkptr -Mchkstk -traceback -Ktrap=fp -O3 -I . -g -c MECHANISM_PARMS.f make: execvp: pgf90: Permission denied make: *** [MECHANISM_PARMS.o] Error 127 failed to compile …/src/CHEMMECH In addition, I am curious how the output of CHEMMECH be used in CCTM runs. I looked through the script “run_cctm.csh” (EPA’s open source code: https://github.com/USEPA/CMAQ/blob/5.2.1/CCTM/scripts/run_cctm.csh). It seems that only species lists (GC_$MECH.nml, AE_$MECH.nml, NR_$MECH.nml) and photolysis (CSQY_DATA_\$MECH) are included in the script, while the output of CHEMMECH (RXNS_DATA_MODULE.F90 and RXN_FUNC_MODULE.F90) are not included.
Does CCTM actually include the chemical mechanism or only considering photolysis?

As mentioned in comment 739, https://forum.cmascenter.org/session/email-login/dafe747ca68182af24a59287067de42e, the chemical mechanism is a build time option (not runtime option). The mechanism is compiled into the executable.

CHEMMECH is a utility that creates RXNS*F90 files (if you want to update the mechanism) which must be compiled in the executable. The default versions reside in the CMAQ/CCTM/src/MECHS folder.

If you want to change a mechanism, you should:

1. Modify the mech*.def and GC/AE/NR*.nml as appropriate for your update. mech*.def is not actually used in creating the executable, but is an intermediate file from which information is extracted for fortran code.
2. Run CHEMMECH to translate the mech*.def information into the two RXNS*.F90 files
3. If you want to run the ebi solver within CMAQ, propagate the RXNS*.F90 information to hr*.F files (which normally reside in CMAQ/CCTM/src/gas/ebi*) via create_ebi

chemmech and create_ebi reside in the UTIL folder: https://github.com/USEPA/CMAQ/tree/5.3.b2/UTIL