Coding - BNNLab/BN_Group_Wiki GitHub Wiki

1. Python

Installation and setup

We recommend using Anaconda as a platform for python as it provides easy module installation and environment management as well as several python IDEs. Anaconda is available for Windows, Linux and MacOS at https://www.anaconda.com/.

Several IDEs are available to write your python code in:

Jupyter Notebook: Useful for writing and testing code in chunks as well as sharing between users. Best used for data analysis and processing. It's available through Anaconda installation, which should be on all university computers in the group. Otherwise, it can be install with the command:

pip install notebook

Visual Studio Code: More useful for running complex code and managing conda environments. Its drawback are that it is a little slow and has a reasonably steep learning curve. It's available through AppsAnywhere on university computers.

Sublime Text: Version 4 is fast, light and extremely flexible. It can do most things Visual Studio Code does, but faster. There's a large user community online so googling will solve most problems. It's available through AppsAnywhere on university computers.

Using Anaconda

From the terminal:

To create a new environment:

conda create --name <name>

If you require python 2.7 use:

conda create --name <name> python=2.7

To activate an environment use:

conda activate <name>

To install a package:

conda install <package_name>

Packages can also be install from the anaconda cloud using:

conda install -c <account> <package> for example conda install -c openbabel openbabel

More in-depth documentation can be seen here:

Useful modules

  • matplotlib: creating graphs

  • plotly: for creating interactive plots

  • rdkit: toolkit for cheminformatics

  • openbabel: search, convert and analyse chemical data from molecular modelling

  • pandas: management of large structured data files

  • numpy: complex maths and handling arrays and matricies

  • scikit-learn: core machine learning package

  • scipy: core package for scientific analysis

  • pyscf: molecular modelling and DFT calculation in Python

  • gpu4pyscf: running pyscf with GPUs, which speeds up optimisation jobs by 10-100 times

How to use matplotlib

https://matplotlib.org/3.1.1/api/

Guide using Jupyter Notebook:

Click here.

2. Topics

⚠️ **GitHub.com Fallback** ⚠️