ASE

Overview

The  Atomic Simulation Environment (ASE)  is a Python library for running DFT calculations through a common interface regardless of the DFT package used. ASE is at the heart of our group and is great for both conventional and high-throughput calculations.
The easiest way to learn how to use ASE is to go through the  Getting Started  guide and the various  ASE modules . You may also wish to refer to the " Open Science with ASE: Core Tutorials " guide.

Installation

For the most up-to-date features and bugfixes, you should install ASE as follows:  pip install --upgrade https://gitlab.com/ase/ase/-/archive/master/ase-master.zip 

Basic Usage

The ASE homepage has many useful tutorials for how to use the program. A few minimal examples are shown below.

The main object in ASE is the  Atoms  object, which is a representation of a given material that you plan to manipulate or run a DFT calculation on. Given a CIF representation of a material (e.g.  MOF5.cif ), you can read in the file as an  Atoms  object as follows:
from ase.io import read

atoms = read('MOF5.cif')


MOF5.cif
5KB, Uploaded 11 months ago

It is also possible to write out the  Atoms  object into a new file:
from ase.io import write

atoms = read('MOF5.cif')
write('POSCAR', atoms)

To view a given  Atoms  object via the GUI, you can use the following:
from ase.visualize import view

atoms = read('MOF5.cif')
view(atoms) # use view(atoms, viewer='x3d') for Jupyter Notebooks
Alternatively, you can use  ase gui MOF5.cif  to view the CIF directly from the command line.

Neighbor Searching

In combination with  networkx , it is very easy to rapidly generate structure graphs and perform analyses on the graph.
import networkx as nx
from ase.neighborlist import build_neighbor_list

# Generate graph using simple bonding heuristics
nl = build_neighbor_list(atoms, self_interaction=False, bothways=True)
graph = nx.from_numpy_array(nl.get_connectivity_matrix())

# Get indices of all atoms in 2nd coordination sphere of atom 0
index = 0
cutoff = 2

node_distances = nx.single_source_shortest_path_length(graph, index, cutoff=cuoff)
kth_neighbors = [node for node, distance in node_distances.items() if distance == k]