Skip to content

AntBoc/pace-tutorial-2024

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 

Repository files navigation

pace-tutorial

This repo contains files for tutorial on P(GR)ACE and p(gr)acemaker

Supporting slides here

Preparation

From dashboard (https://www.mahti.csc.fi/pun/sys/dashboard/)

  • Start Jupyter

    • Partition: interactive
    • Resources: Cores - 16
    • Time: 4 hours
    • Settings: Python - tensorflow
    • Module version: tensorflow/2.15
    • Jupyter type - lab
    • Working directory: /user/[YOUR_USER_NAME]
  • Connect to Jupyter

Installation of pace(grace)maker (python-ace and tensorpotential)

PYTHON-ACE

git clone --depth 1 --branch feature/grace_fs https://github.com/ICAMS/python-ace.git
cd python-ace
pip install .
cd ..

GRACE-TENSORPOTENTIAL

git clone --depth 1 https://github.com/ICAMS/grace-tensorpotential.git
cd grace-tensorpotential
pip install .
cd ..

PACEMAKER DOCS

Documentation on pacemaker and installation instruction without GRACE https://pacemaker.readthedocs.io/en/latest/pacemaker/install/

LAMMPS

git clone --depth 1 --branch grace https://github.com/yury-lysogorskiy/lammps.git
cd lammps/
mkdir build
cd build/
cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_MPI=ON -DPKG_ML-01-PACE=ON -DPKG_MC=ON -DPKG_MANYBODY=ON ../cmake

# Check that you have line `TensorFlow library is FOUND at ...` after previous command

cmake --build . -- -j 
make install

cd ../..

Path to the TensorFlow lib should be automatically set, but in case of problems try setting it manually

export LD_LIBRARY_PATH=/usr/local/lib64/python3.9/site-packages/tensorflow:$LD_LIBRARY_PATH

Tutorial materials

git clone https://github.com/AntBoc/pace-tutorial-2024.git
cd pace-tutorial-2024

TUTORIAL: pacemaker

DFT data collection

cd 01-PACE/00-AlLi-VASP-DATA
tar zxvf AlLi_vasp_data.tar.gz
cd  AlLi_vasp_data
pace_collect --free-atom-energy auto --output-dataset-filename AlLi.pkl.gz
cd ../..

pacemaker: automatic input file generation

Prepare the folder and copy the dataset

cd 01-AlLi-FIT
cp ../00-AlLi-VASP-DATA/AlLi.pkl.gz .

and run automatic input file generation

pacemaker -t

You will see following requests and should reply:

Generating 'input.yaml'
Enter training dataset filename (ex.: data.pckl.gzip, [TAB] – autocompletion): AlLi.pkl.gz
Enter test set fraction or size (ex.: 0.05 or [ENTER] - no test set): 0.05
Please enter list of elements (ex.: "Cu", "AlNi", [ENTER] - determine from dataset): [ENTER]
Enter number of functions per element ([ENTER] - default 700): 300
Enter cutoff (Angstrom, default:7.0): 6.0
Enter weighting scheme type - `uniform` or `energy` ([ENTER] - `uniform`): energy
Input file is written into `input.yaml`

pacemaker: run fit

If you have input.yaml file in the current folder, then just execute:

pacemaker input.yaml

At the end you should find output_potential.yaml (if program terminates successfully) and interim_potential_0.yaml (always contains latest version of potential) You can rename one of these files into AlLi.yaml

mv interim_potential_0.yaml AlLi.yaml

pace_activeset: calculation of active set

In order to compute active set, run

pace_activeset -d fitting_data_info.pckl.gzip AlLi.yaml

LAMMPS: run MD with uncertainty indication

Go to AlLi-LAMMPS folder and execute LAMMPS there

cd pace-tutorial-2024/02-AlLi-LAMMPS
lmp -in in.lammps

You should see extrapolative_structures.dump file. If it is empty, then no extrapolation occurs. Also check c_max_pace_gamma column in log.lammps output. Try to increase supercell size, change temperature profile, switch to NPT, change atom types to get extrapolative structures. Remember, that LAMMPS will overwrite extrapolative_structures.dump file, so copy it beforehand.

pace_select: selection of structures for active learning

pace_select -p AlLi.yaml -a AlLi.asi -e "Al Li" -m 20 -o selected/POSCAR extrapolative_structures.dump

In case of problems with maxvolpy library, go to python-ace/lib/maxvolpy and try to run

pip install .

(optional) Active exploration

Check the Jupyter notebook in python-ace/examples/active_learning/Active_Exploration.ipynb and adapt it for Al and/or Li and for your AlLi.yaml/asi potential

(optional) Using ACE models in python with ASE

Check out the 01-PACE/pace_basic_validation.ipynb for basic manipulations with a trained model in python

TUTORIAL: gracemaker

gracemaker: run fit

cd 02-GRACE/01-HEA25-FS-FIT
gracemaker input.yaml -sf 

OR

after termination of gracemaker, run the following command to export model to LAMMPS format

gracemaker -r -s -sf

If a problem with yaml appers, run

pip install --upgrade pyyaml

construction of active set

cd seed/1/
pace_activeset -d training_set.pkl.gz FS_model.yaml

Now you can rename potential and active set files for using it in further examples:

mv FS_model.yaml HEA25_FS_model.yaml
mv FS_model.asi HEA25_FS_model.asi

OR

We will use previously trained models available

Run LAMMPS with GRACE-FS

cd 02-GRACE/02-HEA25-LAMMPS/10-elems-HEA25
orterun -n 2 --oversubscribe lmp -in in.lammps.ext

(Optional) Universal GRACE

cd 02-GRACE/02-HEA25-LAMMPS/10-elems-mp-1layer

Download universal GRACE models

grace_download

Identify the path to the 1-LAYER model

grace_download | grep mp-1layer

copy this path and inset into the in.lammps :

...
pair_style grace
pair_coeff      * * /PATH/TO/HOME/.cache/grace/train_1.5M_test_75_grace_1layer_v2_7Aug2024 Ag Au Cu Ir Ni Pd Pt Rh Ru Sc
...

Run lammps WITHOUT mpi (on GPU, ideally):

lmp -in in.lammps

(Optional) Visualize elements distribution

Check out notebook 02-GRACE/02-HEA25-LAMMPS/Visualize_elemt_distrb.ipynb for visualization of the elements distribution before and after the MDMC run.

Links

ACE users support group

Pacemaker (and gracemaker soon) documentation

Further reading

About

Tutorial/workshop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%