Libra: An open-source "Methodology Discovery" Library



Topical Tutorials




Video Tutorials


Author: Alexey V. Akimov A walkthrough tutorial on the lattice Monte Carlo, also covered here.
Author: Alexey V. Akimov Ehrenfest dynamics in various representations.
Author: Alexey V. Akimov Lattice Hamiltonian MD and Normal Modes.
Author: Alexey V. Akimov MM/EHT based NA-MD calculations of a small Qauntum Dot
Author: Alexey V. Akimov A tutorial showing how to construct customized force fields within Libra package.
Author: Alexey V. Akimov A tutorial showing how to analyze the charachteristic modes of a quasi-random time-series using the ACF and FT capabilities of Libra. This is the way you can use Libra to compute IR spectra or so
Author: Alexey V. Akimov A small tutorial on generating time-correlated random numbers and computing the ACFs for such time series using the Libra's functionality.
Author: Alexey V. Akimov A videorecording of the online stream showing how our Libra code can be used to create a molecular system.
Author: Brendan A. Smith A tutorial showing how to perform exact wavefunction propagation on a grid using Libra.
Author: Alexey V. Akimov A tutorial showing how to use Libra to read XML files in Python.
Author: Alexey V. Akimov A tutorial showing how perform some linear algebra and other mathematical operations using Libra.


Tutorials for Specific Sub-Libraries



Additional Notes on Running the Tutorials

Setup proper environment variables in all test scripts. If the Libra binaries are in your PYTHON_PATH and LD_LIBRARY_PATH (as they should be if you followed the installation instructions), no additional steps needed. Otherwise, one can add the location of the binaries (and Python modules) to the PYTHON_PATH directly in the script that one wants to execute (this sets up the PYTHON_PATH only locally, just for this job). As an example, the example below shows how to add the locations of the libmmath and libmeigen to the Python path:


cwd = os.getcwd()
sys.path.insert(1,cwd+"/../../_build/src/mmath")
sys.path.insert(1,cwd+"/../../_build/src/mmath/meigen")

Here, the "cwd" contains the path of the directory in which the current script has been called. For the purposes of these tutorials, the present directory is one of the sub-folders of the "/tests" directory residing in the root of Libra distributive. Thus, the "_build" directory is two levels higher ("/../../"). In the "_build" folder there is a "src" folder created during the configuring and compilation. This "src" directory contains the sub-folders, similar to those present in the original "src" directory that contains only the source code. Each of the sub-directories will (after a successful built) contain the corresponding libraries. These libraries are essentially the Python modules, which can be loaded into Python scripts via the "import" command. So, in our present file system, we use the instructions in the snippet above to make the modules available. Of course, one is free to use absolute paths rather than the relative as in the example above.

Choose a proper prefix for the module names. Since we can run Libra in a Linux-like mode, even if we are on Windows (via WSL), we are more likely to use the "lib" prefix of the imported Libra libraries, for instance:


from libmmath import *
from libmeigen import *
from liblinalg import *

On the Cygwin, the library prefixes should start with "cyg", for instance:


from cygmmath import *
from cygmeigen import *
from cyglinalg import *

In any case, many of the presently developed tutorials and examples will automatically determine the OS that is being used and will choose the appropriate prefix. This is done via the following snippet:


import sys
if sys.platform=="cygwin":
    from cyglibra_core import *
elif sys.platform=="linux" or sys.platform=="linux2":
    from liblibra_core import *
from libra_py import *