Skip to content

GANs-SCFT (Gaming self-consistent field theory: Generative block polymer phase discovery)

Notifications You must be signed in to change notification settings

kdorfmanUMN/GANs_SCFT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GANs-SCFT (Gaming self-consistent field theory: Generative block polymer phase discovery)

Table of Contents

Overview

This repository is part of the submitted work Gaming self-consistent field theory: Generative block polymer phase discovery, which describes a method to train Deep Convolutional Generative Adversarial Networks (DCGANs) to generate initial guess fields for Self-Consistent Field Theory (SCFT) simulations for phase discovery.

Key Highlights:

  • Data Source: 3D density fields of five established block polymer phases from SCFT trajectories.
  • Data Augmentation: Tiling, random translation, and rotation.
  • Purpose of DCGANs: Fields generated from DCGANs seeded new SCFT simulations, enabling the discovery of novel phases.

workflow
Fig. 1: Overview of the polymer field theory generation process.

Citing This Work

For referencing or leveraging parts of this work, please refer to:

Pengyu Chen, Kevin D. Dorfman, Gaming self-consistent field theory: Generative block polymer phase discovery, 120 (45) e2308698120 (2023)

Relevant Work

Getting Started

Prerequisites

pip install -r requirements.txt

Data Downloads

Acquire both raw and processed density fields here. The data.pt file, located in the data folder, contains 18,273 3D density field datasets. These datasets can be treated as grayscale 3D images. The data is stored as a PyTorch tensor with dimensions (18,273 x 1 x 32 x 32 x 32) and can be directly loaded for training.

Usage

Data Preparation

  • Data Generation:

The raw density data are extracted from SCFT trajectories that converge to five known network phases: single gyroid, single diamond, single primitive, double gyroid, and double primitive. The initial guesses and example SCFT simulation are provided in Data Repository for U of M (DRUM).

  • Data Augmentation:

    • Description:
      Each .rf file, representing a density field obtained from the SCFT calculation, undergoes a series of data augmentation techniques: tiling, random translation, and rotation. Fields with unphysical density values, specifically where phi_A > 1 or phi_A < 0, are excluded.

    • Command Line Execution:
      Navigate to the preprocessing directory and execute the data processing script:

        cd ./preprocessing
        python data_processor.py --in_filename /path/to/input.rf --out_filename /path/to/output.pt --grid 32 32 32

      --in_filename: Path to the input density field file (.rf).
      --out_filename: Path to the output 3D image. Must end with .pt or .pth
      --grid: (Optional) A tuple specifying the output dimensions. The default is (32, 32, 32).

    • Python Method Execution:
      Instead of command-line execution, you can utilize it directly within a Python script:

        processor = DataProcessor()
        processor.process_files(<input_filename>, <output_filename>)

Training

  • Training the DCGANs with Preprocessed Data:

    Run the training script using the following commands:

      cd ./train
      python GAN_train.py --dataroot /path/to/data.pt --out_dir_images /path/to/output/image/dir --out_dir_model /path/to/output/model/dir

    --dataroot: path to processed training data (.pt)
    --out_dir_images: directory to save generated images as tensors (.pt) of size (64 x 1 x 32 x 32 x 32) during the training process.
    --out_dir_model: directory to save model parameters (.pt) during the training process.
    Optional arguments, such as batch size, can be found in the scripts.

  • Visualizing the Training Progression:
    The output images from a set of fixed noise can be visualized to track the training progression using isosurface_visualizer. An example is provided in ./train/visualize_progress.py.

      visualizer = IsosurfaceVisualizer(isosurface_value=0.5)
      visualizer.visualize_directory(<input_directory>, <output_directory>>)

    <input_directory>: directory to the generated images, which are saved as tensors (.pt) of size (64 x 1 x 32 x 32 x 32).
    <output_directory>: directory to save isosurface plots (.png).

Animated GIF
Fig. 2: Progression of generated density fields during the training process.

Field Generation using the Trained Generator

Generate density fields by feeding random latent vectors to the generator.

  cd ./postprocessing
  python generate_guess.py --weight_path ../model/Gweights_45.pt --out_dir /path/to/output/dir --num_images 5000

--weight_path: path to the model parameters for the pretrained generator.
--out_dir: directory to save generated guesses.
--num_images: number of density initial guesses to generate.

SCFT backends

Generated density fields are used as initial guesses for SCFT simulations at a fixed state point. All the PSCF inputs and outputs are provided in DRUM.

Results

  • Convergence: 545 out of 5000 SCFT calculations converged
  • Candidate network phases: 349
  • De novo generation of all known network phases
  • Discovery of novel network phases

histogram
Fig. 3: Free energy histogram of generated candidate network phases and representive network phases.

Contributing

For contributing or submitting pull requests, please contact the author:

Acknowledgments

The authors would like to thank Qingyuan Jiang, Benjamin Magruder, Dr. Guo Kang Cheong, Prof. Chris Bartel, and Prof. Frank Bates for their valuable inputs.

This work was supported primarily by the National Science Foundation through the University of Minnesota MRSEC under Award Number DMR-2011401. Computational resources were provided in part by the Minnesota Supercomputing Institute.

About

GANs-SCFT (Gaming self-consistent field theory: Generative block polymer phase discovery)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages