Coder Social home page Coder Social logo

mataltmag's Introduction

MatAltMag

The pytorch implement of papar AI-accelerated Discovery of Altermagnetic Materials

Prerequisites

some package required:

  • pytorch: 2.0.1
  • accelerate: 0.20.0
  • pymatgen: 2023.5.10
  • PyYAML: 6.0
  • tqdm: 4.64.0

Other required packages are listed in the requirements.txt file.

Run

  1. run files in the preprocess directory, move the output files of label0.csv and candidate.csv to root_dir directory
  2. check required data files in root_dir
  • atom_init.json: a JSON file that stores the initialization vector for each element.
  • label0.csv: a CSV file that stores the ID for the non-altermagnetic crystal
  • label1.csv: a CSV file that stores the ID for the altermagnetic crystal
  • candidate.csv: a CSV file that stores the ID for the crystal in candidate datasets
  1. run download.py to download CIF files of all crystals in the three CSV files from Materials Project. Download time depends on your internet speed. Once completed, the structure under root_dir will be
root_dir
├── atom_init.json
├── label0.csv
├── label1.csv
├── candidate.csv
├── id_prop_0.csv
├── id_prop_1.csv
├── id_prop_-1.csv
├── id0.cif
├── id1.cif
├── ...
  1. set the configuration of accelerate in a proper path, for example
accelerate config --config_file yamls/accelerate.yaml
  1. check and update yamls/pretrain.yaml, then run pretrain.py
nohup sh pretrain.sh &

or

accelerate launch --config_file yamls/accelerate.yaml pretrain.py --file yamls/pretrain.yaml 
  1. check and update yamls/train.yaml, then run train.py
nohup sh train.sh &

or

accelerate launch --config_file yamls/accelerate.yaml train.py --file yamls/train.yaml
  1. check and update yamls/predict.yaml, then run predict.py
python predict.py --file yamls/predict.yaml

Downloading all CIF files of all crystals using the download.py script takes about 1 hour, depending on your network speed. Pretraining the auto-encoder model for 10 epochs with a batch size of 64 on 2 NVIDIA A100 GPUs takes over 2 days. Predicting the candidate datasets of over 42,000 samples takes about 10 seconds with a batch size of 512.

You can also directly load our trained model, which has undergone multiple iterative training processes, without pre-training and training it yourself. The weights of our classifier model can be downloaded from Google Drive. The corresponding output is presented in the out/output.csv.

mataltmag's People

Contributors

zengbocheng avatar zfgao66 avatar

Stargazers

 avatar JC avatar João Augusto Sobral avatar

Watchers

 avatar

mataltmag's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.