<commit_before>.. _installation:

Installing RMG
==============

.. index:: DASSL, DASPK, DAEPACK, requirements, license

.. _licenserequirements:

License Requirements
--------------------

RMG is intended to be an open source program, available to the general public
free of charge. The primary RMG code is distributed under the terms of the 
`MIT/X11 License <http://www.opensource.org/licenses/mit-license.php>`_. Although many of RMG's dependencies are also available under
compatible open source licenses, there remain a few dependencies with more
restrictive licences. **It is the user's
responsibility to ensure these licenses have been obtained.**

.. _installrequirements:

Installation Prerequisites
--------------------------

For a minimal installation, you will need:

* **The Java SE Runtime Environment (JRE), version 6.** This is available from http://java.sun.com/javase/downloads/index.jsp.
* **The Differential Algebraic System Solver (DASSL).** This is available in the public domain from http://www.cs.ucsb.edu/~cse/software.html.
* **A Fortran 90 compiler.** We recommend the free g95 compiler, available from http://www.g95.org/.
* **A Fortran 77 compiler.** The g95 compiler can successfully build the Fortran 77 source code as well.
* **The Basic Linear Algebra Subprograms (BLAS).** This is present in most Linux distributions, and is also available from http://www.netlib.org/blas/. Although only the BLAS source code is required, we recommend installing the full package if possible.
* **The Linear Algebra PACKage (LAPACK).** This is present in most Linux distributions, and is also available from http://www.netlib.org/lapack/. Although only the LAPACK source code is required, we recommend installing the full package if possible.

Although not required, we also recommend that you obtain:

* **GNU make.** This controls the generation of Fortran executables, and is present in most Linux distributions. More information can be found at http://www.gnu.org/software/make/. 
   
To perform sensitivity analysis on the models generated, you will also need:

* **The Large Scale Differential Algebraic Equation Solver with Sensitivity Analysis (DASPK), version 3.1.** DASPK 3.1 is *subject to copyright restrictions*, but available for research purposes from http://www.cs.ucsb.edu/~cse/software.html.
* **The Differential Algebraic Equation PACKage (DAEPACK) library file.** This can be obtained with the JACOBIAN software, which can be obtained at no cost for registered acadamic users from http://www.numericatech.com/academia.htm.

To manipulate the RMG source code you will need: 

* **The Java SE Development Kit (JDK), version 6.** This is available from http://java.sun.com/javase/downloads/index.jsp.

.. _linuxinstallation:

Linux Installation
------------------

To install RMG on a Linux computer:  

1. Create the directory in which you want to install RMG. For the purposes of this document, we will set the directory to ``/usr/local/rmg``. ::

	$ mkdir /usr/local/rmg

2. Set the RMG environment variable as the directory created in the first step. In a bash shell you would type, for our example, ::
	
	$ export RMG=/usr/local/rmg

   In a C shell you would type, for our example, ::
	
	$ setenv RMG /usr/local/rmg
		
   To avoid typing this line each time, append it to your ``~/.bashrc`` (bash shell) or ``~/.cshrc`` (C shell) file.

3. **Get the source code.** Download the file ``RMG.tar.gz`` for the 3.0 release, ungzip and untar it, and move its contents to the ``$RMG`` directory. ::

	$ tar -xvzf RMG.tar.gz
	$ mv rmg/* $RMG

4. **Compile GATPFit.** Change to the directory ``$RMG/fortran_software/fortran/GATPFit/src`` and execute the makefile. Copy the resulting executable, ``GATPFit.exe``, to ``$RMG/software/GATPFit/GATPFit.exe`` if this is not already done. ::

	$ cd $RMG/fortran_software/fortran/GATPFit/src
	$ make
	$ cp GATPFit.exe $RMG/software/GATPFit/GATPFit.exe

5. **Compile FAME.** Change to the directory ``$RMG/fortran_software/fortran/fame/src`` and execute the makefile. Copy the resulting executable, ``fame.exe``, to ``$RMG/software/fame/fame.exe`` if this is not already done. ::

	$ cd $RMG/fortran_software/fortran/fame/src
	$ make
	$ cp ../fame.exe $RMG/software/fame/fame.exe

6. **Compile Frankie.** Change to the directory ``$RMG/fortran_software/fortran/frankie/src`` and execute the makefile. Copy the resulting executable, frankie.exe``, to ``$RMG/software/frankie/frankie.exe`` if this is not already done. ::

	$ cd $RMG/fortran_software/fortran/frankie/src
	$ make
	$ cp ../frankie.exe $RMG/software/frankie/frankie.exe

7. **Compile the DASSL ODE solver.** Download and unpack DASSL, then move all the DASSL source files -- specifically :file:`ddassl.f`, :file:`daux.f` 
   and :file:`dlinpk.f` -- to the directory ``$RMG/software/ODESolver/dassl``. Change to that directory and execute the makefile. Copy the resulting executable, ``dasslAUTO.exe``, to ``$RMG/software/ODESolver/dasslAUTO.exe`` if this is not already done. ::

	$ tar -xvzf dassl.tar.gz
	$ mv *.f $RMG/fortran_software/fortran/ODESolver/dassl
	$ cd $RMG/fortran_software/fortran/ODESolver/dassl
	$ make
	$ cp dasslAUTO.exe $RMG/software/ODESolver/dasslAUTO.exe

Your installation of RMG is nearly complete.

The next few steps are required only if you want RMG to be able to perform sensitivity analysis on the models generated. Currently RMG uses DASPK3.1 (see Section :ref:`installrequirements`) to perform sensitivity analysis. Analytical Jacobian and partial derivatives with respect to rates of reactions and Gibbs free energy of molecules are generated using the automated differentiator of DAEPACK. 

8. Obtain the DAEPACK library file. Make a symbolic link of the library file in a directory in your library file search path, e.g. ``/usr/lib``. 

9. Download daspk31.tgz and untar it using the command ``$ tar -zxvf daspk31.tgz``. Copy all the source files (:file:`*.f` files) from the untarred directories :file:`ad_solver`,
   :file:`preconds` and :file:`solver` into the directory ``$RMG/fortran_software/fortran/ODESolver/daspk``. Change to that directory and execute the makefile. Copy the resulting executable, ``daspkAUTO.exe``, to ``$RMG/software/ODESolver/daspkAUTO.exe`` if this is not already done. ::

	$ tar -xvzf daspk31.tgz
	$ mv ad_solver/*.f $RMG/fortran_software/fortran/ODESolver/daspk
	$ mv preconds/*.f $RMG/fortran_software/fortran/ODESolver/daspk
	$ mv solver/*.f $RMG/fortran_software/fortran/ODESolver/daspk
	$ cd $RMG/fortran_software/fortran/ODESolver/dassl
	$ make
	$ cp daspkAUTO.exe $RMG/software/ODESolver/daspkAUTO.exe

You are now ready to run RMG with sensitivity analysis support.


.. _windowsinstallation:

Windows Installation
--------------------

#. Extract/unzip RMG.tar and move the contents of the RMG 2.00 (directory formed when you unzip RMG.zip) to the desired directory (e.g. c:\RMG)

#. Add an environment variable for RMG

   * Go to Start-->Control Panel-->System (may need to switch to Classic Control Panel view). Click on the Advanced tab, then click on Environment Variables

   * In the lower half of the Environment Variables window (System variables), click New.

   * In the New System Variable window, in the Variable name field, type RMG. In the Variable value field, type the directory in which RMG was installed (e.g. c:\RMG).

   * Click OK twice to confirm the change.

#. Install g95 (Fortran compiler for Windows) by downloading and running g95-MinGW.exe from http://ftp.g95.org/#Win (http://ftp.g95.org/g95-MinGW.exe) to install g95. Note: After compiling of GATPFit and DASSL is complete (see next two steps), this program may be uninstalled.

#. Compile GATPFit using the Command Prompt (Start-->All Programs-->Accessories -->Command Prompt), change directory to GATPFit directory based on RMG installation directory (e.g. cd \rmg\software\GATPFit\GATPFit). Compile the Fortran files by typing ``g95 -o ../GATPFit *.f`` on the command prompt.

#. Download and compile DASSL by downloading DASSL from
   http://www.engineering.ucsb.edu/~cse/software.html and extract the
   three Fortran files :file:`ddassl.f`, :file:`daux.f` and :file:`dlinpk.f` to the dassl
   directory (e.g. ``C:\RMG\software\ODESolver\dassl``). To compile the
   Fortran files use the command prompt and change to dassl directory and
   then type ``g95 -o ../dassl *.f`` on the command prompt.


ChemGreen Installation
----------------------
<commit_msg>[MRH] Updated documentation.  Created sections to install the InChI executable in Linux/Windows.<commit_after>.. _installation:

Installing RMG
==============

.. index:: DASSL, DASPK, DAEPACK, requirements, license

.. _licenserequirements:

License Requirements
--------------------

RMG is intended to be an open source program, available to the general public
free of charge. The primary RMG code is distributed under the terms of the 
`MIT/X11 License <http://www.opensource.org/licenses/mit-license.php>`_. Although many of RMG's dependencies are also available under
compatible open source licenses, there remain a few dependencies with more
restrictive licences. **It is the user's
responsibility to ensure these licenses have been obtained.**

.. _installrequirements:

Installation Prerequisites
--------------------------

For a minimal installation, you will need:

* **The Java SE Runtime Environment (JRE), version 6.** This is available from http://java.sun.com/javase/downloads/index.jsp.
* **The Differential Algebraic System Solver (DASSL).** This is available in the public domain from http://www.cs.ucsb.edu/~cse/software.html.
* **A Fortran 90 compiler.** We recommend the free g95 compiler, available from http://www.g95.org/.
* **A Fortran 77 compiler.** The g95 compiler can successfully build the Fortran 77 source code as well.
* **The Basic Linear Algebra Subprograms (BLAS).** This is present in most Linux distributions, and is also available from http://www.netlib.org/blas/. Although only the BLAS source code is required, we recommend installing the full package if possible.
* **The Linear Algebra PACKage (LAPACK).** This is present in most Linux distributions, and is also available from http://www.netlib.org/lapack/. Although only the LAPACK source code is required, we recommend installing the full package if possible.

Although not required, we also recommend that you obtain:

* **GNU make.** This controls the generation of Fortran executables, and is present in most Linux distributions. More information can be found at http://www.gnu.org/software/make/. 
   
To perform sensitivity analysis on the models generated, you will also need:

* **The Large Scale Differential Algebraic Equation Solver with Sensitivity Analysis (DASPK), version 3.1.** DASPK 3.1 is *subject to copyright restrictions*, but available for research purposes from http://www.cs.ucsb.edu/~cse/software.html.
* **The Differential Algebraic Equation PACKage (DAEPACK) library file.** This can be obtained with the JACOBIAN software, which can be obtained at no cost for registered acadamic users from http://www.numericatech.com/academia.htm.

To manipulate the RMG source code you will need: 

* **The Java SE Development Kit (JDK), version 6.** This is available from http://java.sun.com/javase/downloads/index.jsp.

To generate InChIs and to convert from InChIs/.mol files to adjacency lists you will need:

* **The IUPAC International Chemical Identifier InChI version 1 (software version 1.01).**  This is available from http://www.iupac.org/inchi/download/index.html

.. _linuxinstallation:

Linux Installation
------------------

To install RMG on a Linux computer:  

1. Create the directory in which you want to install RMG. For the purposes of this document, we will set the directory to ``/usr/local/rmg``. ::

	$ mkdir /usr/local/rmg

2. Set the RMG environment variable as the directory created in the first step. In a bash shell you would type, for our example, ::
	
	$ export RMG=/usr/local/rmg

   In a C shell you would type, for our example, ::
	
	$ setenv RMG /usr/local/rmg
		
   To avoid typing this line each time, append it to your ``~/.bashrc`` (bash shell) or ``~/.cshrc`` (C shell) file.

3. **Get the source code.** Download the file ``RMG.tar.gz`` for the 3.0 release, ungzip and untar it, and move its contents to the ``$RMG`` directory. ::

	$ tar -xvzf RMG.tar.gz
	$ mv rmg/* $RMG

4. **Compile GATPFit.** Change to the directory ``$RMG/fortran_software/fortran/GATPFit/src`` and execute the makefile. Copy the resulting executable, ``GATPFit.exe``, to ``$RMG/software/GATPFit/GATPFit.exe`` if this is not already done. ::

	$ cd $RMG/fortran_software/fortran/GATPFit/src
	$ make
	$ cp GATPFit.exe $RMG/software/GATPFit/GATPFit.exe

5. **Compile FAME.** Change to the directory ``$RMG/fortran_software/fortran/fame/src`` and execute the makefile. Copy the resulting executable, ``fame.exe``, to ``$RMG/software/fame/fame.exe`` if this is not already done. ::

	$ cd $RMG/fortran_software/fortran/fame/src
	$ make
	$ cp ../fame.exe $RMG/software/fame/fame.exe

6. **Compile Frankie.** Change to the directory ``$RMG/fortran_software/fortran/frankie/src`` and execute the makefile. Copy the resulting executable, frankie.exe``, to ``$RMG/software/frankie/frankie.exe`` if this is not already done. ::

	$ cd $RMG/fortran_software/fortran/frankie/src
	$ make
	$ cp ../frankie.exe $RMG/software/frankie/frankie.exe

7. **Compile the DASSL ODE solver.** Download and unpack DASSL, then move all the DASSL source files -- specifically :file:`ddassl.f`, :file:`daux.f` 
   and :file:`dlinpk.f` -- to the directory ``$RMG/software/ODESolver/dassl``. Change to that directory and execute the makefile. Copy the resulting executable, ``dasslAUTO.exe``, to ``$RMG/software/ODESolver/dasslAUTO.exe`` if this is not already done. ::

	$ tar -xvzf dassl.tar.gz
	$ mv *.f $RMG/fortran_software/fortran/ODESolver/dassl
	$ cd $RMG/fortran_software/fortran/ODESolver/dassl
	$ make
	$ cp dasslAUTO.exe $RMG/software/ODESolver/dasslAUTO.exe

Your installation of RMG is nearly complete.

The next few steps are required only if you want RMG to be able to perform sensitivity analysis on the models generated. Currently RMG uses DASPK3.1 (see Section :ref:`installrequirements`) to perform sensitivity analysis. Analytical Jacobian and partial derivatives with respect to rates of reactions and Gibbs free energy of molecules are generated using the automated differentiator of DAEPACK. 

8. Obtain the DAEPACK library file. Make a symbolic link of the library file in a directory in your library file search path, e.g. ``/usr/lib``. 

9. Download daspk31.tgz and untar it using the command ``$ tar -zxvf daspk31.tgz``. Copy all the source files (:file:`*.f` files) from the untarred directories :file:`ad_solver`,
   :file:`preconds` and :file:`solver` into the directory ``$RMG/fortran_software/fortran/ODESolver/daspk``. Change to that directory and execute the makefile. Copy the resulting executable, ``daspkAUTO.exe``, to ``$RMG/software/ODESolver/daspkAUTO.exe`` if this is not already done. ::

	$ tar -xvzf daspk31.tgz
	$ mv ad_solver/*.f $RMG/fortran_software/fortran/ODESolver/daspk
	$ mv preconds/*.f $RMG/fortran_software/fortran/ODESolver/daspk
	$ mv solver/*.f $RMG/fortran_software/fortran/ODESolver/daspk
	$ cd $RMG/fortran_software/fortran/ODESolver/dassl
	$ make
	$ cp daspkAUTO.exe $RMG/software/ODESolver/daspkAUTO.exe

You are now ready to run RMG with sensitivity analysis support.

The next few steps are required only if you want RMG to be able to generate InChIs for the species present in the reaction mechanism.

10. Download the InChI version 1 (software version 1.01) source code and Application Program Interface (API).

11.	Change to the InChI-1-API/cInChI/gcc_makefile directory and execute the makefile.  Copy the resulting executable cInChI-1.exe to the $RMG/software/InChI folder.

	$ cd InChI-1-API/cInChI/gcc_makefile
	$ make
	$ cp cInChI-1 $RMG/software/InChI
	
You are now ready to generate InChIs in RMG.


.. _windowsinstallation:

Windows Installation
--------------------

#. Extract/unzip RMG.tar and move the contents of the RMG 2.00 (directory formed when you unzip RMG.zip) to the desired directory (e.g. c:\RMG)

#. Add an environment variable for RMG

   * Go to Start-->Control Panel-->System (may need to switch to Classic Control Panel view). Click on the Advanced tab, then click on Environment Variables

   * In the lower half of the Environment Variables window (System variables), click New.

   * In the New System Variable window, in the Variable name field, type RMG. In the Variable value field, type the directory in which RMG was installed (e.g. c:\RMG).

   * Click OK twice to confirm the change.

#. Install g95 (Fortran compiler for Windows) by downloading and running g95-MinGW.exe from http://ftp.g95.org/#Win (http://ftp.g95.org/g95-MinGW.exe) to install g95. Note: After compiling of GATPFit and DASSL is complete (see next two steps), this program may be uninstalled.

#. Compile GATPFit using the Command Prompt (Start-->All Programs-->Accessories -->Command Prompt), change directory to GATPFit directory based on RMG installation directory (e.g. cd \rmg\software\GATPFit\GATPFit). Compile the Fortran files by typing ``g95 -o ../GATPFit *.f`` on the command prompt.

#. Download and compile DASSL by downloading DASSL from
   http://www.engineering.ucsb.edu/~cse/software.html and extract the
   three Fortran files :file:`ddassl.f`, :file:`daux.f` and :file:`dlinpk.f` to the dassl
   directory (e.g. ``C:\RMG\software\ODESolver\dassl``). To compile the
   Fortran files use the command prompt and change to dassl directory and
   then type ``g95 -o ../dassl *.f`` on the command prompt.

The next few steps are required only if you want RMG to be able to generate InChIs for the species present in the reaction mechanism.
   
#. Download the InChI version 1 (software version 1.01) source code and Application Program Interface (API):
	http://www.iupac.org/inchi/download/index.html
	Unzip the file.  Navigate to the InChI-1-API\cInChI\vc6_project\Release folder.
	Copy the executable file cInChI-1.exe and paste it in the %rmg%\software\InChI folder.
	
You are now ready to generate InChIs in RMG.


ChemGreen Installation
----------------------

{'fraction_non_alphanumeric': 0.11049210770659239, 'fraction_numerical': 0.007591894696597302, 'mean_word_length': 3.9326508620689653, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 20, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3503390', 'n_tokens_mistral': 5937, 'n_tokens_neox': 5477, 'n_words': 2209}