Installation¶
The following Python packages, necessary to run Quantas, will be installed together with the software, if not present on your system:
Cython 0.29+
click 7.0+
NumPy (base N-dimensional array package)
SciPy (library for scientific computing)
HDF5 (library for HDF5)
YAML (library for data serialization)
Matplotlib (used for plotting results)
Hint
On Windows, you could benefit from the Unofficial Windows Binaries (link) made available Christoph Gohlke, in particular:
After downloading the package wheels, you can install them using pip.
Python virtual environment¶
Since Quantas depends on several third-party python packages, we strongly recommend using a virtual environment to prevent any interference with you current working environment. The following instructions are focused on the virtualenv tool, but you can freely use any other environment manager of your choice.
Create the virtual environment¶
The creation of a virtual environment using virtualenv is slightly different on Windows and Unix machines.
- Linux and Mac OS
On a shell (or terminal), issue the following commands:
$ pip3 install --user --upgrade virtualenv $ python3 -m venv ~/.virtualenvs/quantas
Using the above commands, you installed/upgraded virtualenv and created home directory of the virtual environment. If you look in the home folder under
.virtualenv, you can find a directory namedquantas.To activate the virtual environment, just issue:
$ source ~/.virtualenvs/quantas/bin/activate
After activation, your prompt should appear as:
(quantas) $
indicating that you are working on a virtual environment. Now, the python executable of the virtualenv is the first in PATH, and that python programs have access only to packages installed inside the virtualenv.
To leave or deactivate the
quantasvirtual environment, run:(quantas) $ deactivate
- Windows
On a command prompt, issue the following command to install/upgrade the virtualenv package:
> pip install --user --upgrade virtualenv
Then, in a folder of your choice, run the venv command as:
> python -m venv quantas
or:
> virtualenv quantas
to create the home folder of the virtual environment. To activate it, issue:
> quantas\Scripts\activate.bat
Differently from Linux and Mac OS, no clear indication on the successful activation of the environment is provided. However, you can run the following:
> python >>> import sys >>> sys.path
and check if in the output the path to the virtual environment directory is the first one provided.
To leave or deactivate the
quantasvirtual environment, run:> deactivate
Installation from source¶
At the moment, it is only possible to install Quantas from its
source code. Common alternatives such
as pip will be available in the next future.
- Linux and Mac OS
On a shell (or terminal), unpack the compressed file and enter in the decompressed directory:
$ tar -xf quantas-0.9.0.tar.gz $ cd quantas-0.9.0
Then, install the Quantas package:
$ python3 setup.py install
- Windows
Use a software as 7zip or WinRar to decompress the file. On a command prompt, enter the directory:
> cd quantas-0.9.0Then, install the Quantas package:
> python setup.py install
Note
On Linux, you may need root privileges to install the package in the /usr/local
directory (default). If you prefer a local (user) installation, you could use the
--prefix directive to specify a different location.
In this case, the launching scripts will be installed in the ~/.local/bin directory of
the user.
Environment variables¶
If you installed Quantas in a system-wide fashion, please ensure that the following variables are set.
- PATH¶
Colon-separated paths where programs can be found.
- PYTHONPATH¶
Colon-separated paths where Python modules can be found.
Under Linux, you can set these permanently in your ~/.bashrc file:
$ export PYTHONPATH=<path-to-Quantas-package>:$PYTHONPATH
$ export PATH=<path-to-Quantas-command-line-tools>:$PATH
or your ~/.cshrc file:
$ setenv PYTHONPATH <path-to-Quantas-package>:${PYTHONPATH}
$ setenv PATH <path-to-Quantas-command-line-tools>:${PATH}
Note
If running on Mac OSX: be aware that terminal sessions will
source ~/.bash_profile by default and not
~/.bashrc. Either put any export commands into
~/.bash_profile or source ~/.bashrc in all Bash
sessions by adding
if [ -f ${HOME}/.bashrc ]; then
source ${HOME}/.bashrc
fi
to your ~/.bash_profile.
Note
Under Windows, the environmental variables should have been set during/after the installation of the Python 3.x package.
Test Quantas installation¶
Quantas is shipped with some scripts used to test the basic functionality of the code, using the pytest command. After Quantas has been installed, you can use the following command in the program root directory:
(quantas) $ pytest
If everything is fine, you should see something like the following output:
================================================= test session starts =================================================
platform win32 -- Python 3.7.4, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: E:\quantas, inifile: pytest.ini, testpaths: tests
collected 10 items
tests\test_eosfit_reader.py . [ 10%]
tests\test_ha_inpgen.py . [ 20%]
tests\test_ha_reader.py .. [ 40%]
tests\test_ha_run.py . [ 50%]
tests\test_soec_inpgen.py .. [ 70%]
tests\test_soec_reader.py .. [ 90%]
tests\test_soec_run.py . [100%]
================================================= 10 passed in 2.55s ==================================================
In addition, you can use some input examples to
further test Quantas.
Unpack them in any folder you like and run the tests like:
$ quantas ha examples\mgo_b3lyp_qha.yaml
$ quantas qha examples\mgo_b3lyp_qha.yaml
$ quantas eos examples\PV_topaz.dat
$ quantas soec examples\hydroxylapatite.dat
If something goes wrong, please send us an output log of the failing test.