An open-source library for reduced-density matrix-based analysis and computation
Working with Psi4 plugins

A brief note on Psi4 plugins

Psi4 plugins are (shared) module libraries that are not intended to be linked to another target entity. However, modules are created mainly because they can dynamically be imported at runtime by the consuming programs. In our sample input file , we show how to import both v2rdm_casscf and mcpdft modules. This input file assumes that you have chosen the second way below (recommended) for connecting OpenRDM with your plugin. At lines 51 and 53 of this input file, we call two functions that are provided by these modules:

1 en,wfn=energy('v2rdm-casscf',return_wfn=True)
3 energy('mcpdft',ref_wfn=wfn)

The energy('v2rdm-casscf') call generates a wfn object that is needed by the second energy('mcpdft') call. Be sure to add the corresponding return_wfn and ref_wfn arguments to these function calls, respectively as shown.

How does OpenRDM connect with Psi4 plugins?

There are at least two ways that you can adopt to let OpenRDM talk to your Psi4 plugin:

  • Using python commands in your input files
  • Using CMake commands in the CMakeList.txt file within plugin's source directory

Before adopting one of these routes, make sure that both Psi4 and OpenRDM are installed on your system in the aforementioned order as the latter becomes dependent on the former in the present case.

When installing OpenRDM, turn on the CMake option WITH_PSI4=ON (see configure file in OpenRDM's main source directory for more details). Activating this option requires that the CMake psi4_DIR variable in the configure script to be set to the directory that contains the psi4Config.cmake file so that CMake's find_packge() function within OpenRDM is able to find the psi4::core IMPORTED target and links it to OpenRDM.

Using python

Assuming that you have installed OpenRDM in /home/OpenRDM directory, include the following command in the begining of your Psi4 input file and then import the MCPDFT module:

1 sys.path.insert(0, '/home/OpenRDM/build/stage')
2 import mcpdft

In the present example, the module lives in the /home/OpenRDM/build/stage/lib directory.

Check the input file in our v2RDM-CASSCF plugin fork for more details.

Using CMake

If the infrastructure of your software is managed by the CMake build system generator, we recommend that your first take a glance at How to Use section. After finding out about what you need to add to the CMakeLists.txt file residing in the main source directory of your project, CMake's internal find_package() takes care of finding and incorporating all necessary information about the OpenRDM by interrogating the openrdm::openrdm IMPORTED target.