Chapter 5: Real-World Applications and Careers - The Path to GNN Expert

From Catalyst Design, Materials Discovery, and Industrial Applications to Research and Engineering Careers

๐Ÿ“– Reading Time: 20-25 min ๐Ÿ“Š Difficulty: Advanced ๐Ÿ’ป Code Examples: 0 ๐Ÿ“ Exercises: 0

Chapter 5: Real-World Applications and Careers - The Path to GNN Expert

This chapter surveys best practices for large-scale challenges such as OC20. You will learn concrete usage patterns in materials discovery and drug discovery.

๐Ÿ’ก Supplement: For both training and inference, data I/O tends to be the bottleneck. Preprocessing caches and well-designed logging pay off.

Learning Objectives

By reading this chapter, you will be able to: - Understand the latest trends in catalyst design (OC20 Challenge) - Learn practical methods for crystal structure prediction - Build materials screening workflows - Understand the career paths of GNN experts - Grasp the required skill set and learning roadmap

Reading Time: 15-20 min Code Examples: 6 Exercises: 3


5.1 Catalyst Design: Open Catalyst 2020 (OC20) Challenge

5.1.1 Overview and Importance of OC20

The Open Catalyst Project (OCP) is a large-scale catalyst exploration project led by Meta AI (formerly Facebook AI) and Carnegie Mellon University.

Background: - ๐ŸŒ Climate change mitigation: Renewable energy storage (CO2 reduction, hydrogen production) - ๐Ÿ”ฌ Importance of catalysts: Accelerating chemical reactions (used in over 90% of industrial processes) - ๐Ÿ’ก AI acceleration: 1 million times faster than DFT calculations

OC20 dataset: - Scale: Over 1.3 million catalyst-adsorbate combinations - Compute time: Equivalent to 70 million CPU-core hours of DFT calculations - Objective: Prediction of adsorption energies and forces

5.1.2 Loading the OC20 Dataset

import torch
from torch_geometric.datasets import OC20
from torch_geometric.loader import DataLoader

# Download the OC20 dataset (first time only, several GB)
# Note: The full dataset is very large, so we use a sample
dataset_oc20 = OC20(root='./data/OC20', split='train', size='small')

print("===== OC20 Dataset =====")
print(f"Number of samples: {len(dataset_oc20)}")
print(f"Node feature dimension: {dataset_oc20.num_node_features}")

# Check the first sample
data = dataset_oc20[0]
print(f"\nFirst sample:")
print(f"  Number of atoms: {data.num_nodes}")
print(f"  Atomic numbers: {data.atomic_numbers[:10]}")  # First 10 atoms
print(f"  Coordinates: {data.pos.shape}")
print(f"  Energy: {data.y:.4f} eV")
print(f"  Forces: {data.force.shape}")

5.1.3 GemNet-OC: A Model Dedicated to OC20

GemNet-OC is the GNN architecture that achieved the best performance on OC20.

Features: - ๐Ÿ“ Geometric embeddings: Accounts for interatomic distances, angles, and dihedral angles - ๐Ÿ”„ E(3) equivariance: Equivariant to rotations and translations - โšก Efficient computation: Faster than SchNet and DimeNet

from torch_geometric.nn.models import GemNetOC

# Instantiate the GemNet-OC model
model_gemnet = GemNetOC(
    num_targets=1,          # Energy prediction
    num_spherical=7,        # Order of spherical harmonics
    num_radial=128,         # Number of radial basis functions
    num_blocks=4,           # Number of blocks
    emb_size_atom=256,      # Atom embedding dimension
    emb_size_edge=512,      # Edge embedding dimension
    emb_size_trip_in=64,    # Triplet embedding (input)
    emb_size_trip_out=64,   # Triplet embedding (output)
    emb_size_quad_in=32,    # Quadruplet embedding (input)
    emb_size_quad_out=32,   # Quadruplet embedding (output)
    emb_size_aint_in=64,
    emb_size_aint_out=64,
    emb_size_rbf=16,
    emb_size_cbf=16,
    emb_size_sbf=32,
    num_before_skip=2,
    num_after_skip=2,
    num_concat=1,
    num_atom=3,
    cutoff=12.0,            # Cutoff distance (ร…)
    max_neighbors=30,
    rbf={'name': 'gaussian'},
    envelope={'name': 'polynomial', 'exponent': 5},
    cbf={'name': 'spherical_harmonics'},
    sbf={'name': 'legendre_outer'},
    extensive=True,
    output_init='HeOrthogonal',
    activation='silu',
)

print("===== GemNet-OC =====")
print(f"Number of parameters: {sum(p.numel() for p in model_gemnet.parameters()):,}")

# Forward pass with sample data
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model_gemnet = model_gemnet.to(device)
data = data.to(device)

model_gemnet.eval()
with torch.no_grad():
    energy_pred = model_gemnet(data.z, data.pos, data.batch)
    print(f"\nPredicted energy: {energy_pred.item():.4f} eV")
    print(f"Measured energy: {data.y.item():.4f} eV")
    print(f"Error: {abs(energy_pred.item() - data.y.item()):.4f} eV")

5.1.4 Catalyst Screening Workflow

import matplotlib.pyplot as plt
import numpy as np

def screen_catalysts(model, catalyst_list, adsorbate='*CO'):
    """
    Catalyst screening

    Parameters:
    -----------
    model : torch.nn.Module
        Trained GNN model
    catalyst_list : list
        List of candidate catalysts
    adsorbate : str
        Adsorbate (*CO, *OH, *H, etc.)

    Returns:
    --------
    results : dict
        Adsorption energy for each catalyst
    """
    results = {}

    for catalyst in catalyst_list:
        # Generate the catalyst-adsorbate structure
        # (In practice, atomic arrangements are created with ASE, etc.)
        # ...

        # Predict the adsorption energy
        with torch.no_grad():
            energy = model(...)  # Actual inference
            results[catalyst] = energy.item()

    return results

# Usage example (mock data)
catalyst_candidates = ['Pt', 'Pd', 'Cu', 'Ag', 'Au', 'Ni', 'Rh', 'Ir']
adsorption_energies = {
    'Pt': -0.85, 'Pd': -0.92, 'Cu': -0.45,
    'Ag': -0.22, 'Au': -0.18, 'Ni': -1.12,
    'Rh': -0.78, 'Ir': -0.88
}

# Visualization
fig, ax = plt.subplots(figsize=(10, 6))
colors = ['red' if e < -0.8 else 'gray' for e in adsorption_energies.values()]
ax.barh(list(adsorption_energies.keys()), list(adsorption_energies.values()), color=colors)
ax.axvline(x=-0.8, color='blue', linestyle='--', linewidth=2, label='Optimal range')
ax.set_xlabel('Adsorption energy (eV)', fontsize=12)
ax.set_ylabel('Catalyst', fontsize=12)
ax.set_title('Catalyst screening by CO adsorption energy', fontsize=14)
ax.legend()
ax.grid(True, alpha=0.3, axis='x')
plt.tight_layout()
plt.show()

print("===== Catalyst screening results =====")
print("Optimal catalysts (adsorption energy < -0.8 eV):")
for catalyst, energy in adsorption_energies.items():
    if energy < -0.8:
        print(f"  {catalyst}: {energy:.2f} eV")

5.2 Crystal Structure Prediction: CGCNN, Matformer, MODNet

5.2.1 Crystal Graph Convolutional Networks (CGCNN)

CGCNN is a pioneering GNN that predicts material properties from crystal structures.

Application examples: - ๐Ÿ”‹ Battery materials: Ionic conductivity, voltage - ๐Ÿ”ฅ Thermoelectric materials: Seebeck coefficient - ๐Ÿ’Ž Superhard materials: Young's modulus, bulk modulus

from torch_geometric.nn import CGConv, global_mean_pool
import torch
import torch.nn.functional as F

class CGCNN(torch.nn.Module):
    """
    Crystal Graph Convolutional Neural Network

    Features:
    - Accounts for edge features (interatomic distances)
    - Supports periodic boundary conditions
    """
    def __init__(self, num_node_features=92, num_classes=1, hidden_channels=64):
        super().__init__()

        # Atom embedding (atomic number -> vector)
        self.embedding = torch.nn.Embedding(num_node_features, hidden_channels)

        # Crystal Graph Convolution layers
        self.conv1 = CGConv(hidden_channels, dim=1)  # dim=1: edge feature is distance only
        self.conv2 = CGConv(hidden_channels, dim=1)
        self.conv3 = CGConv(hidden_channels, dim=1)

        # Fully connected layers
        self.lin1 = torch.nn.Linear(hidden_channels, hidden_channels // 2)
        self.lin2 = torch.nn.Linear(hidden_channels // 2, num_classes)

    def forward(self, z, edge_index, edge_attr, batch):
        """
        Parameters:
        -----------
        z : torch.Tensor (num_atoms,)
            Atomic numbers
        edge_index : torch.Tensor (2, num_edges)
            Edge indices
        edge_attr : torch.Tensor (num_edges, 1)
            Edge features (interatomic distances)
        batch : torch.Tensor (num_atoms,)
            Batch indices
        """
        # Atom embedding
        x = self.embedding(z)

        # Crystal Graph Convolution
        x = F.softplus(self.conv1(x, edge_index, edge_attr))
        x = F.softplus(self.conv2(x, edge_index, edge_attr))
        x = F.softplus(self.conv3(x, edge_index, edge_attr))

        # Global pooling
        x = global_mean_pool(x, batch)

        # Fully connected layers
        x = F.softplus(self.lin1(x))
        x = self.lin2(x)

        return x

# Instantiate the model
model_cgcnn = CGCNN(num_node_features=118, num_classes=1)  # 118 elements

print("===== CGCNN =====")
print(model_cgcnn)
print(f"\nNumber of parameters: {sum(p.numel() for p in model_cgcnn.parameters()):,}")

5.2.2 Training on Materials Project Data

from pymatgen.ext.matproj import MPRester
from pymatgen.core import Structure
import pandas as pd

# Retrieve crystal data from the Materials Project API
# Note: An API key is required (register at https://materialsproject.org)

# Sample data (in practice, retrieved via the API)
crystal_data = pd.DataFrame({
    'formula': ['Li2O', 'LiFePO4', 'LiCoO2', 'Li4Ti5O12', 'LiMn2O4'],
    'band_gap': [7.5, 1.2, 2.3, 1.8, 0.9],
    'formation_energy': [-2.9, -2.1, -1.8, -2.4, -1.6]
})

print("===== Materials Project data =====")
print(crystal_data)

# Function to convert a crystal structure into a graph (defined in Chapter 3)
def structure_to_cgcnn_input(structure):
    """
    Convert a pymatgen Structure into CGCNN input
    """
    # Atomic numbers
    z = torch.tensor([site.specie.Z for site in structure], dtype=torch.long)

    # Edge indices and edge features (distances)
    edge_indices = []
    edge_attrs = []

    for i, site_i in enumerate(structure):
        for j, site_j in enumerate(structure):
            if i != j:
                distance = structure.get_distance(i, j)
                if distance < 8.0:  # Cutoff
                    edge_indices.append([i, j])
                    edge_attrs.append([distance])

    edge_index = torch.tensor(edge_indices, dtype=torch.long).t().contiguous()
    edge_attr = torch.tensor(edge_attrs, dtype=torch.float)

    return z, edge_index, edge_attr

# Training loop (simplified)
# In practice, retrieve Structure objects from the Materials Project and train

5.2.3 Performance Comparison of Crystal Property Prediction

import matplotlib.pyplot as plt

# Literature values (Materials Project benchmark)
models_performance = {
    'Random Forest': {'Formation Energy MAE': 0.22, 'Band Gap MAE': 0.58},
    'CGCNN': {'Formation Energy MAE': 0.039, 'Band Gap MAE': 0.388},
    'Matformer': {'Formation Energy MAE': 0.032, 'Band Gap MAE': 0.320},
    'MODNet': {'Formation Energy MAE': 0.028, 'Band Gap MAE': 0.305},
}

fig, axes = plt.subplots(1, 2, figsize=(14, 5))

# Formation energy prediction
models = list(models_performance.keys())
formation_mae = [models_performance[m]['Formation Energy MAE'] for m in models]
axes[0].bar(models, formation_mae, color=['gray', 'steelblue', 'forestgreen', 'coral'])
axes[0].set_ylabel('MAE (eV/atom)', fontsize=12)
axes[0].set_title('Formation energy prediction accuracy', fontsize=13)
axes[0].tick_params(axis='x', rotation=15)
axes[0].grid(True, alpha=0.3, axis='y')

# Band gap prediction
band_gap_mae = [models_performance[m]['Band Gap MAE'] for m in models]
axes[1].bar(models, band_gap_mae, color=['gray', 'steelblue', 'forestgreen', 'coral'])
axes[1].set_ylabel('MAE (eV)', fontsize=12)
axes[1].set_title('Band gap prediction accuracy', fontsize=13)
axes[1].tick_params(axis='x', rotation=15)
axes[1].grid(True, alpha=0.3, axis='y')

plt.tight_layout()
plt.show()

print("===== Crystal property prediction benchmark =====")
print(pd.DataFrame(models_performance).T)

5.3 Materials Screening: High-Throughput Exploration Workflow

5.3.1 GNN-Accelerated Materials Exploration Pipeline

flowchart TD A[Generate candidate materials\n1000-10000] --> B[GNN high-speed screening\n1 sec/material] B --> C[Select top 100 candidates] C --> D[Precise DFT calculation\n1 hour/material] D --> E[Select top 10 candidates] E --> F[Experimental synthesis & evaluation\n1 week/material] F --> G[Final 3-5 candidates] style A fill:#e3f2fd style B fill:#fff3e0 style C fill:#f3e5f5 style D fill:#e8f5e9 style E fill:#fff9c4 style F fill:#ffccbc style G fill:#c8e6c9

Acceleration effect: - Conventional method: 10000 materials ร— 1 hour (DFT) = 10000 hours (about 1.1 years) - GNN acceleration: 10000 materials ร— 1 sec (GNN) + 100 materials ร— 1 hour (DFT) = 3 hours - Speedup: 3300x!

5.3.2 Implementation of Materials Screening

import torch
from torch_geometric.data import Data, DataLoader
import numpy as np
import pandas as pd

def high_throughput_screening(model, candidate_structures, target_property='band_gap', threshold=2.0):
    """
    High-throughput materials screening

    Parameters:
    -----------
    model : torch.nn.Module
        Trained GNN model
    candidate_structures : list
        List of candidate crystal structures
    target_property : str
        Target property
    threshold : float
        Threshold (select values at or above this)

    Returns:
    --------
    promising_candidates : list
        List of promising candidates
    """
    model.eval()
    results = []

    with torch.no_grad():
        for i, structure in enumerate(candidate_structures):
            # Convert the structure into a graph
            z, edge_index, edge_attr = structure_to_cgcnn_input(structure)
            batch = torch.zeros(len(z), dtype=torch.long)

            # Predict the property
            prediction = model(z, edge_index, edge_attr, batch)

            results.append({
                'index': i,
                'formula': structure.composition.reduced_formula,
                'predicted_value': prediction.item()
            })

    # Convert to a DataFrame
    df_results = pd.DataFrame(results)

    # Filter by threshold
    promising = df_results[df_results['predicted_value'] >= threshold]

    print(f"===== Screening results =====")
    print(f"Number of candidate materials: {len(candidate_structures)}")
    print(f"Threshold: {threshold} eV")
    print(f"Promising candidates: {len(promising)}")

    return promising.sort_values('predicted_value', ascending=False)

# Run with mock data
# (In practice, generate a large number of crystal structures with pymatgen)
num_candidates = 1000
predicted_values = np.random.normal(1.5, 0.8, num_candidates)

# Histogram
fig, ax = plt.subplots(figsize=(10, 6))
ax.hist(predicted_values, bins=50, alpha=0.7, edgecolor='black')
ax.axvline(x=2.0, color='r', linestyle='--', linewidth=2, label='Threshold (2.0 eV)')
ax.set_xlabel('Predicted band gap (eV)', fontsize=12)
ax.set_ylabel('Number of materials', fontsize=12)
ax.set_title('GNN screening results for 1000 materials', fontsize=14)
ax.legend()
ax.grid(True, alpha=0.3, axis='y')

# Statistics
promising_count = np.sum(predicted_values >= 2.0)
ax.text(0.05, 0.95, f'Above threshold: {promising_count} ({promising_count/num_candidates*100:.1f}%)',
        transform=ax.transAxes, fontsize=12, verticalalignment='top',
        bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.5))

plt.tight_layout()
plt.show()

print(f"\nTop 10 candidates:")
top_10_indices = np.argsort(predicted_values)[-10:][::-1]
for rank, idx in enumerate(top_10_indices, 1):
    print(f"  {rank}. Material #{idx}: {predicted_values[idx]:.3f} eV")

5.3.3 Integration with Experiments (Closed Loop)

def closed_loop_optimization(model, initial_candidates, num_iterations=10, batch_size=5):
    """
    Closed-loop optimization
    GNN prediction -> DFT calculation -> experiment -> model update -> next candidate proposal

    Parameters:
    -----------
    model : torch.nn.Module
        Initial model
    initial_candidates : list
        Initial candidates
    num_iterations : int
        Number of optimization iterations
    batch_size : int
        Number of candidates evaluated per iteration

    Returns:
    --------
    best_material : dict
        Best material
    """
    all_evaluated = []
    current_best = None

    for iteration in range(num_iterations):
        print(f"\n===== Iteration {iteration + 1}/{num_iterations} =====")

        # Step 1: Rank candidates with the GNN
        predictions = []
        for candidate in initial_candidates:
            # ... GNN prediction ...
            score = np.random.rand()  # Mock
            predictions.append((candidate, score))

        predictions.sort(key=lambda x: x[1], reverse=True)

        # Step 2: Run DFT on the top batch_size candidates
        batch = predictions[:batch_size]
        dft_results = []

        for candidate, gnn_score in batch:
            # DFT calculation (in practice, run VASP, etc.)
            dft_value = gnn_score + np.random.normal(0, 0.1)  # Mock
            dft_results.append({
                'candidate': candidate,
                'gnn_pred': gnn_score,
                'dft_value': dft_value
            })

            all_evaluated.append(dft_results[-1])

        # Step 3: Update the best candidate
        best_in_batch = max(dft_results, key=lambda x: x['dft_value'])
        if current_best is None or best_in_batch['dft_value'] > current_best['dft_value']:
            current_best = best_in_batch
            print(f"New best candidate: DFT value = {current_best['dft_value']:.4f}")

        # Step 4: Retrain the model (adding the new DFT data)
        # ... model.train() ...

    print(f"\n===== Final results =====")
    print(f"Number of materials evaluated: {len(all_evaluated)}")
    print(f"Best material: DFT value = {current_best['dft_value']:.4f}")

    return current_best

# Usage example (proof of concept)
# best = closed_loop_optimization(model_cgcnn, candidate_list)

5.4 Industrial Application Case Studies

5.4.1 Battery Materials Exploration

Case study: Electrolyte materials for all-solid-state batteries

Challenges: - High ionic conductivity (> 10โปยณ S/cm) - Chemical stability - Interfacial stability with lithium metal

Use of GNNs: 1. Candidate generation: Generate 10,000 variants from known crystal structures 2. GNN screening: Predict ionic conductivity (3 hours) 3. DFT validation: Precise calculation of the top 100 candidates (100 hours) 4. Experimental synthesis: Actually synthesize and evaluate the top 5 candidates (5 weeks)

Outcome: - Conventional method (random search): 5 candidates found in 3 years - GNN acceleration: 10 candidates found in 3 months (12x speedup)

5.4.2 Optimization of Catalytic Processes

Case study: CO2 reduction catalysts

Challenges: - Improving CO2 โ†’ CO selectivity - Reducing overpotential - Long-term catalyst stability

Use of GNNs: 1. Adsorption energy prediction: Predict CO, H2, and COOH adsorption states with a GNN 2. Building a volcano plot: Identify the theoretically optimal catalyst composition 3. Alloy exploration: Screen 1,000 binary and ternary alloys

Outcome: - Achieved 90% CO selectivity with a CuAg alloy (1.5x higher than conventional) - Reduced overpotential by 0.3 V

5.4.3 Molecular Design in the Pharmaceutical Industry

Case study: Drug discovery (pharmacokinetics prediction)

Challenges: - Prediction of ADMET properties (absorption, distribution, metabolism, excretion, toxicity) - Assessment of synthesizability - Patent circumvention

Use of GNNs: 1. Molecular property prediction: Rapid prediction of solubility, membrane permeability, and toxicity with a GNN 2. Generative models: Generate novel molecules with VAE/GAN + GNN 3. Optimization: Combine Bayesian optimization with GNNs

Outcome: - Lead compound optimization period shortened from 2 years to 6 months - Synthesis success rate improved from 70% to 85%


5.5 Career Paths for GNN Experts

5.5.1 Career Options

flowchart TD A[Master GNN fundamentals] --> B{Career choice} B --> C[Academia\nResearcher] B --> D[Industry\nR&D Engineer] B --> E[Startup\nFounder / Joiner] C --> C1[Assistant / Associate Professor\nUniversities & research institutes] C --> C2[Postdoc\nOverseas labs] C --> C3[National institutes\nNIMS, AIST] D --> D1[Materials manufacturer\nNew materials development] D --> D2[Pharmaceutical company\nDrug discovery AI] D --> D3[Tech company\nMeta, Google, DeepMind] E --> E1[Materials AI\nStartup] E --> E2[CTO/Tech Lead] E --> E3[Consultant] style A fill:#e3f2fd style C fill:#c8e6c9 style D fill:#fff9c4 style E fill:#ffccbc

5.5.2 Required Skill Set

Technical skills: 1. Programming - Python: PyTorch, PyTorch Geometric, NumPy, Pandas - C++: When speedups are needed - Julia: Scientific computing (optional)

  1. Machine learning / deep learning - GNN: Message passing, graph pooling, equivariant GNNs - Optimization: Adam, learning rate scheduling - Regularization: Dropout, BatchNormalization

  2. Materials science / chemistry - DFT calculations: VASP, Quantum ESPRESSO - Crystallography: Space groups, symmetry - Quantum chemistry: Orbitals, electronic structure

  3. Tools / libraries - pymatgen: Handling crystal structures - ASE: Atomic simulations - RDKit: Handling molecules - Materials Project API

Soft skills: - ๐Ÿ“ Paper writing: Experience submitting to top journals - ๐Ÿ—ฃ๏ธ Presentation: Conference talks, internal reports - ๐Ÿค Collaboration: Working with experimental researchers and computational scientists - ๐Ÿ“Š Project management: Setting milestones, tracking progress

5.5.3 Learning Roadmap

Phase 1: Building the foundation (3-6 months)

Week 1-4: Python & machine learning basics
- Python basics (NumPy, Pandas, Matplotlib)
- scikit-learn: Linear regression, random forest
- Participate in Kaggle competitions (beginner)

Week 5-12: Deep learning basics
- Complete the PyTorch tutorials
- CNN: Image classification
- RNN: Time series prediction
- Coursera: Deep Learning Specialization

Week 13-20: GNN basics
- Complete this "GNN Introduction Series"
- PyTorch Geometric official tutorials
- Molecular property prediction on the QM9 dataset

Week 21-24: Materials science basics
- Materials Project tutorials
- Introduction to pymatgen
- Basics of DFT calculations (online course)

Phase 2: Strengthening practical skills (6-12 months)

Month 7-9: Research projects
- Participate in the OC20 Challenge
- Kaggle: Molecular Property Prediction competition
- Build a prediction model with your own dataset

Month 10-12: Reproducing paper implementations
- Read and implement the SchNet paper
- Read and implement the CGCNN paper
- Read and implement the GemNet paper (advanced)

Month 13-15: Original research
- Propose a new GNN architecture
- Improve existing methods (ablation experiments)
- Submit a preprint to arXiv

Phase 3: Establishing expertise (12-24 months)

Month 16-18: Submit to top conferences
- NeurIPS, ICML, ICLR
- Materials-specific: npj Computational Materials

Month 19-21: Community contributions
- Publish open-source projects on GitHub
- Contribute to PyTorch Geometric
- Organize study groups and hackathons

Month 22-24: Career building
- Build a portfolio (GitHub, blog)
- Conference presentations (poster -> oral talk)
- Job hunting or entering a PhD program

5.5.4 Recommended Resources

Online courses: 1. Coursera: Machine Learning Specialization (Andrew Ng) 2. Fast.ai: Practical Deep Learning for Coders 3. Stanford CS224W: Machine Learning with Graphs 4. MIT 3.320: Atomistic Computer Modeling of Materials

Books: 1. Deep Learning (Ian Goodfellow) - DL fundamentals 2. Graph Representation Learning (William L. Hamilton) - GNN theory 3. Electronic Structure (Richard M. Martin) - DFT fundamentals 4. Materials Informatics (Krishna Rajan) - MI overview

Conferences: - AI: NeurIPS, ICML, ICLR - Materials: MRS Fall/Spring Meeting, APS March Meeting - Computational: CECAM, ACS

Communities: - PyTorch Geometric: GitHub Discussions - Materials Project: Forum - Open Catalyst Project: Discord


5.6 Chapter Summary

What We Learned

  1. Catalyst design (OC20) - Overview of the Open Catalyst Project - High-accuracy prediction with GemNet-OC - 1 million times faster adsorption energy calculations

  2. Crystal structure prediction - CGCNN: High-accuracy prediction of crystal properties - Matformer, MODNet: SOTA performance - Integration with Materials Project

  3. Materials screening - High-throughput exploration pipeline - Closed-loop optimization - Integration with DFT calculations

  4. Industrial applications - Battery materials exploration (all-solid-state batteries) - Catalytic process optimization (CO2 reduction) - Drug discovery (ADMET prediction)

  5. Career paths - Academia vs. industry vs. startups - Required skill set - 24-month learning roadmap

Key Points

Series Completed

Congratulations! You have completed the GNN Introduction Series!

What you mastered in this series: - Chapter 1: Historical background and importance of GNNs - Chapter 2: GNN theory centered on MPNN - Chapter 3: Implementation with PyTorch Geometric - Chapter 4: State-of-the-art techniques (equivariant GNNs, GNNExplainer) - Chapter 5: Real-world applications and career building

Next steps: 1. Practical projects: Participate in the OC20 Challenge 2. Paper reproduction: Implement the SchNet and GemNet papers 3. Original research: Propose a new architecture 4. Community contributions: Publish code on GitHub 5. Career building: Build a portfolio and go job hunting

โ† Back to Series Contents


Exercises

Exercise 1 (Difficulty: easy)

List three ways in which GNN-based materials exploration is superior to conventional DFT calculations.

Hint Think in terms of speed, scalability, and exploration scope.
Sample Answer **Three ways GNNs are superior**: **1. Dramatic improvement in computation speed** - **DFT**: 1 hour per material (depends on the number of CPU cores) - **GNN**: 1 second per material (using a GPU) - **Speedup**: 3600x **Concrete example**: - Exploring 10,000 materials - DFT: 10,000 hours (about 1.1 years) - GNN: 3 hours (+ 100 hours of DFT validation for the top 100 candidates = 103 hours total) **2. Large-scale exploration is possible** - DFT is computationally expensive and, realistically, is limited to hundreds to thousands of materials - GNNs can screen millions of materials in a short time - **Expansion of the search space**: 10ยณ โ†’ 10โถ (1000x) **Concrete example**: - OC20 project: Evaluated over 1.3 million catalyst-adsorbate combinations - A scale impossible with conventional methods **3. Iterative optimization is practical** - The speed of GNNs makes closed-loop optimization possible - The cycle of prediction โ†’ experiment โ†’ model update โ†’ next candidate proposal is accelerated - **Shortened development period**: Several years โ†’ several months **Concrete example**: - Battery materials exploration: Conventionally 3 years โ†’ 3 months with GNNs (12x speedup) **Additional benefits**: - **Environmental impact**: Reduced computational resources (lower power consumption) - **Cost**: No DFT calculation license fees - **Expertise**: Requires less specialized knowledge than DFT calculations (can be trained given data) **Caveats**: - GNN prediction accuracy is lower than DFT (an approximate method) - Final candidates need to be validated with DFT or experiments - Depends on the quality of the training data (garbage in, garbage out)

Exercise 2 (Difficulty: medium)

Explain the complete workflow for participating in the Open Catalyst 2020 (OC20) Challenge, step by step, from data download to submission of prediction results.

Hint Refer to the official OC20 GitHub (https://github.com/Open-Catalyst-Project/ocp).
Sample Answer **Complete workflow for participating in the OC20 Challenge**: **Phase 1: Environment setup (estimated time: 1-2 hours)**
# Step 1: Create a Python environment
conda create -n ocp python=3.9
conda activate ocp

# Step 2: Install PyTorch & PyTorch Geometric
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
conda install pyg -c pyg

# Step 3: Install the OCP library
git clone https://github.com/Open-Catalyst-Project/ocp.git
cd ocp
pip install -e .

# Step 4: Dependency libraries
pip install lmdb ase wandb submitit
**Phase 2: Data download (estimated time: several hours to 1 day)**
# Step 5: Download the dataset
# Note: The full version is several hundred GB; start with the Small version

# S2EF (Structure to Energy and Forces) task
python scripts/download_data.py --task s2ef --split train --get-edges --num-workers 8
python scripts/download_data.py --task s2ef --split val_id --get-edges --num-workers 8
python scripts/download_data.py --task s2ef --split test --get-edges --num-workers 8

# IS2RE (Initial Structure to Relaxed Energy) task
python scripts/download_data.py --task is2re --split train --get-edges --num-workers 8
**Phase 3: Training the baseline model (estimated time: several days to 1 week)**
# Step 6: Prepare the config file
# Use configs/s2ef/2M/schnet/schnet.yml

# Step 7: Start training
python main.py \
    --mode train \
    --config-yml configs/s2ef/2M/schnet/schnet.yml \
    --identifier schnet-2M \
    --run-dir ./runs/ \
    --timestamp-id

# Step 8: Monitor training with TensorBoard
tensorboard --logdir ./runs/
**Phase 4: Improving the model (estimated time: 1-2 weeks)**
# Step 9: Define a custom model
# ocp/models/custom_model.py

from torch_geometric.nn import SchNet
import torch.nn as nn

class ImprovedSchNet(SchNet):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # Add your own improvements
        self.extra_layer = nn.Linear(128, 128)

    def forward(self, data):
        # Custom forward pass
        energy = super().forward(data)
        energy = self.extra_layer(energy)
        return energy

# Step 10: Register in the config file
# configs/s2ef/2M/custom/custom_model.yml
**Phase 5: Prediction and submission (estimated time: several hours)**
# Step 11: Predict on the test data
python main.py \
    --mode predict \
    --config-yml configs/s2ef/2M/schnet/schnet.yml \
    --checkpoint ./checkpoints/best_checkpoint.pt \
    --identifier predict-schnet

# Step 12: Verify the prediction results
python scripts/verify_predictions.py \
    --predictions ./results/s2ef_predictions.npz \
    --task s2ef

# Step 13: Submit to the leaderboard
# Go to https://eval.ai/web/challenges/challenge-page/712/
# Upload predictions.npz
**Phase 6: Result analysis and improvement (iterate)**
# Step 14: Error analysis
import numpy as np
import matplotlib.pyplot as plt

predictions = np.load('./results/s2ef_predictions.npz')
energy_pred = predictions['energy']
energy_true = predictions['energy_true']

# Compute MAE
mae = np.mean(np.abs(energy_pred - energy_true))
print(f"Energy MAE: {mae:.4f} eV")

# Residual plot
plt.scatter(energy_true, energy_pred - energy_true, alpha=0.5)
plt.xlabel('True Energy (eV)')
plt.ylabel('Residual (eV)')
plt.title('Error Analysis')
plt.show()

# Step 15: Consider improvements
# - Hyperparameter tuning
# - Data augmentation
# - Ensemble learning
**Evaluation metrics**: - **S2EF (Energy)**: Mean Absolute Error (MAE) - **S2EF (Forces)**: MAE, Energy within Threshold (EwT) - **IS2RE**: MAE **Leaderboard targets**: - **Baseline (SchNet)**: Energy MAE ~0.5 eV - **Intermediate (GemNet-OC)**: Energy MAE ~0.3 eV - **Advanced (custom)**: Energy MAE < 0.2 eV **Caveats**: - GPU required (NVIDIA Tesla V100 or higher recommended) - Storage: At least 500GB (2TB for the full version) - Training time: Several days to 1 week on 8xV100 **Reference resources**: - OC20 official site: https://opencatalystproject.org/ - GitHub: https://github.com/Open-Catalyst-Project/ocp - Paper: Chanussot et al., "Open Catalyst 2020 (OC20) Dataset"

Exercise 3 (Difficulty: hard)

Propose five projects to include in your portfolio when job hunting as a GNN expert, and explain concretely what each project should demonstrate.

Hint Think in terms of five perspectives: fundamentals, implementation skill, originality, collaboration, and practical applicability.
Sample Answer **A GNN Expert's Portfolio: Five Essential Projects** --- **Project 1: QM9 Molecular Property Prediction (proof of fundamentals)** **Objective**: Demonstrate a fundamental understanding of GNNs and implementation skill **Content**: - HOMO-LUMO gap prediction on the QM9 dataset - Implement three types of GNNs (GCN, GAT, SchNet) - Performance comparison (targeting MAE < 0.5 eV) **What to include on GitHub**:
qm9-prediction/
โ”œโ”€โ”€ README.md (detailed objectives, results, and discussion)
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ 01_data_exploration.ipynb (data analysis)
โ”‚   โ”œโ”€โ”€ 02_model_comparison.ipynb (model comparison)
โ”‚   โ””โ”€โ”€ 03_hyperparameter_tuning.ipynb
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ models/ (implementations of GCN, GAT, SchNet)
โ”‚   โ”œโ”€โ”€ train.py
โ”‚   โ””โ”€โ”€ evaluate.py
โ”œโ”€โ”€ configs/ (config files)
โ”œโ”€โ”€ results/ (learning curves, performance tables)
โ””โ”€โ”€ tests/ (unit tests)
**Points to demonstrate**: - โœ… Accurate understanding of PyTorch Geometric - โœ… Reproducibility (config files, fixed seeds) - โœ… Visualization ability (learning curves, visualizing attention weights) - โœ… Documentation ability (README, comments) **Expected outcome**: - A comparison table of MAE, training time, and parameter count for each model - Achieving MAE < 0.4 eV with the best model --- **Project 2: Reproducing a Paper Implementation (proof of implementation skill)** **Objective**: Implementation skill to accurately reproduce top-conference papers **Recommended papers**: - SchNet (NeurIPS 2017) - DimeNet (ICLR 2020) - GemNet (ICLR 2021) **Content**: - Fully implement the paper's algorithm - Reproduce the paper's experimental results (within ยฑ5% error) - Ablation experiments (verify the effect of each component) **What to include on GitHub**:
schnet-reproduction/
โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ Summary of the paper
โ”‚   โ”œโ”€โ”€ Comparison table of reproduction results
โ”‚   โ””โ”€โ”€ Analysis of discrepancies
โ”œโ”€โ”€ paper/ (original paper PDF)
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ schnet.py (implementation faithful to the paper)
โ”‚   โ”œโ”€โ”€ continuous_filter.py
โ”‚   โ””โ”€โ”€ interaction_block.py
โ”œโ”€โ”€ experiments/
โ”‚   โ”œโ”€โ”€ qm9/ (QM9 experiments)
โ”‚   โ””โ”€โ”€ md17/ (MD17 experiments)
โ””โ”€โ”€ ablation_studies/ (ablation experiments)
**Points to demonstrate**: - โœ… Paper comprehension (accurate implementation of the equations) - โœ… Reproducibility (comparison with the original paper's results) - โœ… Critical thinking (proposing improvements) **Expected outcome**: | Method | Paper value | Reproduced value | Difference | |-----|--------|-------|-----| | SchNet (QM9 U0) | 14 meV | 15 meV | +1 meV | | SchNet (QM9 HOMO) | 41 meV | 43 meV | +2 meV | --- **Project 3: Original Research (proof of originality)** **Objective**: The originality to turn a new idea into a concrete result **Example: SchNet integrated with an attention mechanism (SchNet-Attention)** **Content**: - Add an attention mechanism to an existing method (SchNet) - Demonstrate performance improvement on QM9 - Submit a preprint to arXiv **What to include on GitHub**:
schnet-attention/
โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ Motivation (why you did this research)
โ”‚   โ”œโ”€โ”€ Method (explanation of the method)
โ”‚   โ”œโ”€โ”€ Results
โ”‚   โ””โ”€โ”€ Conclusion
โ”œโ”€โ”€ paper/
โ”‚   โ”œโ”€โ”€ preprint.pdf (arXiv submission version)
โ”‚   โ””โ”€โ”€ figures/ (figures for the paper)
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ schnet_attention.py (the new model)
โ”‚   โ””โ”€โ”€ attention_layer.py
โ”œโ”€โ”€ experiments/
โ”‚   โ”œโ”€โ”€ baseline_comparison.py
โ”‚   โ””โ”€โ”€ ablation_studies.py
โ””โ”€โ”€ notebooks/
    โ””โ”€โ”€ visualization.ipynb (visualizing attention weights)
**Points to demonstrate**: - โœ… Problem-framing ability (research motivation) - โœ… Hypothesis testing (ablation experiments) - โœ… Academic communication (paper writing) **Expected outcome**: - 5-10% performance improvement over the baseline (SchNet) - Submission to arXiv (a preprint before peer review is fine) - Demonstrate interpretability by visualizing attention weights --- **Project 4: Real Data Application (proof of practical applicability)** **Objective**: The practical ability to apply to real-world materials science problems **Example: Crystal property prediction with Materials Project data** **Content**: - Retrieve 10,000 crystal records from the Materials Project API - Predict band gap, formation energy, and elastic modulus - Build a web app (Streamlit or Flask) **What to include on GitHub**:
materials-property-predictor/
โ”œโ”€โ”€ README.md (with a demo link for the web app)
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ fetch_data.py (Materials Project API)
โ”‚   โ””โ”€โ”€ preprocess.py
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ models/ (CGCNN implementation)
โ”‚   โ”œโ”€โ”€ train.py
โ”‚   โ””โ”€โ”€ api.py (prediction API)
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ streamlit_app.py (web interface)
โ”‚   โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ deployment/
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ””โ”€โ”€ docker-compose.yml
โ””โ”€โ”€ docs/
    โ””โ”€โ”€ user_guide.md (usage)
**Points to demonstrate**: - โœ… Data collection ability (using APIs) - โœ… End-to-end development (model โ†’ API โ†’ UI) - โœ… Productionization skills (Docker, deployment) **Expected outcome**: - An actually working web app (hosted on Heroku/Streamlit Cloud) - Users can upload a crystal structure (CIF format) and get predictions --- **Project 5: OSS Contribution (proof of collaboration)** **Objective**: Contribution to the community and collaboration ability **Recommended projects**: - PyTorch Geometric - Open Catalyst Project - Materials Project **Content**: - Bug fixes - Implementation of new features (new GNN layers, datasets) - Documentation improvements - Creating tutorials **Activity to show on GitHub**:
Display on your personal profile:
- โœ… Pull Requests: 5-10 (Accept rate > 50%)
- โœ… Issue reports: 10 or more
- โœ… Code Reviews: Review comments on others' PRs
- โœ… Discussion participation: Answering technical questions
**Points to demonstrate**: - โœ… Code review ability (ability to read others' code) - โœ… Communication ability (interactions in English) - โœ… Team development experience **Expected outcome**: - One or more merged PRs to PyTorch Geometric - A "Contributor" badge on your GitHub profile --- **Overall Portfolio Structure** **GitHub profile README.md**:
# Yusuke Hashimoto - GNN Researcher

## About Me
Materials science researcher specializing in Graph Neural Networks
for molecular and crystal property prediction.

## Skills
- **GNN**: Message Passing, Attention, Equivariant GNNs
- **Tools**: PyTorch, PyTorch Geometric, RDKit, ASE, pymatgen
- **ML**: Deep Learning, Bayesian Optimization, Transfer Learning

## Featured Projects

### ๐Ÿงช [QM9 Molecular Property Prediction](link)
Implemented GCN, GAT, SchNet. Achieved MAE < 0.4 eV.

### ๐Ÿ“„ [SchNet Reproduction](link)
Reproduced NeurIPS 2017 paper with 95% accuracy.

### ๐Ÿ”ฌ [SchNet-Attention (arXiv)](link)
Novel architecture combining SchNet + Attention. +8% improvement.

### ๐ŸŒ [Crystal Property Web App](demo-link)
Predict band gap from crystal structure. 10k+ predictions served.

### ๐Ÿค [PyTorch Geometric Contributor](link)
5 merged PRs. Added new dataset and GNN layer.

## Publications
- [arXiv link] SchNet-Attention: ...

## Contact
- Email: xxx@example.com
- LinkedIn: [link]
- Google Scholar: [link]
**Summary**: These five projects prove all the skills required of a GNN expert: 1. Fundamentals (QM9 prediction) 2. Implementation skill (paper reproduction) 3. Originality (original research) 4. Practical applicability (web app) 5. Collaboration (OSS contribution) When job hunting, compile these projects into a one-page portfolio site and host it on GitHub Pages or Notion.

References

  1. Chanussot, L., et al. (2021). "Open Catalyst 2020 (OC20) Dataset and Community Challenges." ACS Catalysis, 11(10), 6059-6072. DOI: 10.1021/acscatal.0c04525 The official OC20 dataset paper. Over 1.3 million catalyst-adsorbate data points.

  2. Xie, T., & Grossman, J. C. (2018). "Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties." Physical Review Letters, 120(14), 145301. DOI: 10.1103/PhysRevLett.120.145301 The CGCNN paper. Pioneering research on crystal property prediction.

  3. Choudhary, K., & DeCost, B. (2021). "Atomistic Line Graph Neural Network for improved materials property predictions." npj Computational Materials, 7, 185. DOI: 10.1038/s41524-021-00650-1 The ALIGNN paper. High-accuracy prediction on the Materials Project.

  4. Schmidt, J., et al. (2019). "Recent advances and applications of machine learning in solid-state materials science." npj Computational Materials, 5, 83. DOI: 10.1038/s41524-019-0221-0 A review paper on materials informatics, including industrial applications.

  5. Open Catalyst Project. (2024). "Documentation and Tutorials." URL: https://open-catalyst-project.github.io/ The official OC20 documentation. Provides tutorials and baseline implementations.

  6. Materials Project. (2024). "Materials Project Documentation." URL: https://docs.materialsproject.org/ The official Materials Project documentation. Details on API usage and data structures.


Created: 2025-10-17 Version: 1.0 Template: chapter-template-v2.0 Author: GNN Introduction Series Project


๐ŸŽ“ Congratulations on completing the GNN Introduction Series!

You have now taken the first step toward becoming a GNN expert who will pioneer the future of materials science.

Next actions: 1. Participate in the OC20 Challenge: https://opencatalystproject.org/ 2. Read papers: Search for "Graph Neural Networks Materials" on arXiv 3. Join the community: PyTorch Geometric Discussions 4. Build a portfolio: Publish five projects on GitHub 5. Build your career: Toward research positions, R&D engineering, or startups

Contact: - GitHub: https://github.com/[your-username] - Email: yusuke.hashimoto.b8@tohoku.ac.jp

Good luck with your GNN journey! ๐Ÿš€

Disclaimer