Gaussian™ 16 Installation#
Gaussian™ 16 is a commercial program for computational chemistry. This chemistry driver accesses electronic structure information from Gaussian™ 16 via the Gaussian-supplied open-source interfacing code.
You should follow the installation instructions that come with your Gaussian™ 16 product. Installation instructions can also be found online in Gaussian product installation support.
Following the installation make sure the Gaussian™ 16 executable, g16, can be run from the command line environment where you will be running Python and Qiskit. For example verifying that the g16 executable is reachable via the system environment path, and appropriate exports, such as GAUSS_EXEDIR, have been configured as per Gaussian product installation support.
Gaussian™ 16 Interfacing Code#
gauopen folder the Python part of the above interfacing code,
as needed by Qiskit Nature modules, has been made available. It is licensed under a
Gaussian Open-Source Public License.
Part of this interfacing code --- specifically, the Fortran file qcmatrixio.F --- requires compilation to a Python native extension. However, Qiskit comes with pre-built binaries for most common platforms.
When using the existing Windows pre-built binary, the library libifcoremd.dll is required in order to load it. In case it is missing, there is a simple way to get it for Anaconda (Qiskit recommended platform):
conda install -c anaconda intel-fortran-rt
If there is no pre-built binary matching your platform, then it will be necessary to compile this file as per the instructions below.
Compiling the Fortran Interfacing Code#
If no prebuilt native extension binary, as supplied with Qiskit, works for your platform, then to use the Gaussian™ 16 driver on your machine, the Fortran file qcmatrixio.F must be compiled into object code that can be used by Python. This is accomplished using the Fortran to Python Interface Generator (F2PY), which is part of the NumPy Python library. Specifically, on your command prompt window, change directory to the qiskit_nature/second_q/drivers/gaussiand/gauopen directory inside the Qiskit installation directory, and while in the Python environment created for Qiskit and the nature module, invoke f2py on qcmatrixio.F as explained below.
Apple macOS and Linux#
The full syntax of the f2py command on macOS and Linux is as follows:
f2py -c -m qcmatrixio qcmatrixio.F
This command will generate a file with name prefix qcmatrixio and extension .so, for example qcmatrixio.cpython-36m-x86_64-linux-gnu.so. In order for the command above to work and such file to be generated, you will need a supported Fortran compiler installed. On macOS, you may have to download the GNU Compiler Collection (GCC) and, in particular, the GFortran Compiler source and compile it first, if you do not a suitable Fortran compiler already installed. On Linux you may be able to download and install a supported Fortran compiler via your distribution's installer.
The following steps can be used with the Intel Fortran compiler on the Microsoft Windows platform:
Set up the environment by running the Intel Fortran compiler batch program ifortvars.bat as follows:
ifortvars -arch intel64
Then, in this environment, issue the following command from within the gauopen directory:
f2py -c --fcompiler=intelvem -m qcmatrixio qcmatrixio.F
Upon successful execution, the f2py command above will generate a file with name prefix qcmatrixio and extension .so, for example qcmatrixio.cp36-win_amd64.pyd. However, in order for the f2py command above to work, #ifdef may need to be manually edited if it is not recognized or supported during the processing of the f2py command above. For example, with f2py from Intel Visual Fortran Compiler with Microsoft Visual Studio, the following code snippet originally shows two occurrences of the line Parameter (Len12D=8,Len4D=8), as shown next:
`#ifdef` USE_I8 Parameter (Len12D=8,Len4D=8) `#else` Parameter (Len12D=4,Len4D=4) `#endif`
This may need to be simplified by deleting the first three lines and the last line, leaving just the fourth line, as follows: