Skip to content

code to calculate bulk modulus using machine learning potentials such as MACE and CHGNet

License

Notifications You must be signed in to change notification settings

Mofahdi/bulk_modulus_MACE_CHGNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bulk_modulus_MACE_CHGNet

code to calculate bulk modulus using machine learning potentials such as MACE and CHGNet
methodology: the method depends on fitting several volumes with their total energies thorugh BirchMurnaghan fitting

Usage

python bulk_modulus_calc.py \ --atoms_path='POSCAR' \ --calculator='mace' \ --dtype='float64' \ --device='cpu' \ --opt_atoms=True \ --output_opt_atoms=True \ --force_max=0.01 \ --max_strain=0.1 \ --num_samples=11 \ --output_strains=False \ --output_traj_strains=False \

Args Explanation

--atoms_path: structure path ('./POSCAR' by default)
--calculator: 'mace' or 'chgnet' are supported currently. Case does not matter ('mace' by default)
--dtype: 'float64' or 'float32' for 'mace' calculator. If you select 'chgnet' calculator, then this command does not matter ('float64' by default)
--device: 'cpu', 'mp', or 'cuda' for 'mace' calculator. If you select 'chgnet' calculator, then this command does not matter ('cpu' by default)
--opt_atoms: whether you optimize the input structure. If True, the code will output the optimized structure in "POSCAR_opt" (True by default)
--output_opt_atoms: if you optimize the input structure, you can choose whether you optimize the input structure (True by default)
--force_max: (0.01 by default)
--max_strain: (0.1 by default)
--num_samples: (11 by default)
--output_strains: (False by default)
--output_traj_strains: (False by default)

Note: you have to put both files "mace_chgnet_classes.py" and "bulk_modulus_calc.py" in the same path since "bulk_modulus_calc.py" inherits classes from "mace_chgnet_classes.py". The code will output the above files in the same path where you put "mace_chgnet_classes.py" and "bulk_modulus_calc.py".
Another Note: "mace_chgnet_classes.py" has other functions for optimization and md runs, but the main class inherited from it is "mace_EOS" starting in line 600 and ending in line 746 for the equation of state. You might observe lots of classes are for mace, and that is because the code was originally designed for mace but now it adopts chgnet as well for comparison purposes.

Required Packages

the code is tested on the following packages and versions: torch=2.0.1 ase=3.23.0 pymatgen=2023.11.12 e3nn=0.4.4 mace-torch=0.3.6 chgnet=0.3.5 jarvis-tools=2024.4.30
The code can probably work with different versions of the above packages

Credit

  • Please consider reading my published work in Google Scholar using this link thank you :)
  • also please let me know if more features are needed to be added and/or improved

About

code to calculate bulk modulus using machine learning potentials such as MACE and CHGNet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages