-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupercell_maker.py
75 lines (57 loc) · 3.25 KB
/
supercell_maker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/share/apps/EPD_64bit/bin/python2.7
"""
__author__ = 'Nabil Khossossi'
__date__ = 'Last updated September 27, 2018'
__email__ = 'n.khossossi@edu.umi.ac.ma'
This app is designed to make it very easy to create supercells of any material contained in the Materials Project (or
from an existing POSCAR file.
################################################
General info to use this suite of analysis tools
################################################
You will need the following Python modules installed: VASP_Analyzer, VASP_Setup, VASP_PostProcessing, pymatgen, and
MPinterfaces
VASP_Analyzer, VASP_Setup and VASP_PostProcessing can be obtained from emailing Ryan Jacobs at rjacobs3@wisc.edu
Pymatgen can be downloaded and installed by running the following in your terminal:
# pip install pymatgen --user
MPinterfaces can be downloaded and installed by running the following in your terminal (note that installation of
version 1.1.2 seems to fail, so version 1.2.0 is used):
# pip install mpinterfaces=="1.2.0" --user
You will also need to set your Materials API key (obtained from Materials Project) in your .bashrc file as MAPI_KEY.
This can be done by doing the following steps at your terminal:
# vi ~/.bashrc
# export MAPI_KEY="abcdefg"
Lastly, you will also need to set the location of your VASP pseudopotentials in your .bashrc file as VASP_PSP_DIR.
If you have installed MAST, this should already be done for you. If not, this can be done by doing the following steps
at your terminal:
# vi ~/.bashrc
# export VASP_PSP_DIR="/home/user/vasp_pps"
"""
########################################################################################################################
########################################################################################################################
####################################################
# Required entries are below, with examples provided
####################################################
# Specify whether you'd like to use an existing POSCAR to generate a surface or import the structure from Materials Project
use_existing_poscar = True
# If you specified "False" above, you must specify a material composition below (e.g. 'CaTiO3').
# Specifying "True" above overrides this entry
material = 'W'
# The scaling matrix to create a supercell from the conventional cell of your material. To use just the conventional
# cell, use the identity matrix as the scaling matrix.
scaling_matrix = [[2, 0, 0], [0, 2, 0], [0, 0, 2]]
########################################################################################################################
########################################################################################################################
from VASP_Setup import *
import os
import warnings
def main():
mapi_key = os.environ['MAPI_KEY']
with warnings.catch_warnings():
warnings.simplefilter("ignore")
if use_existing_poscar == bool(False):
make_psr = PoscarFileSetup(material_composition=material, mapi_key=mapi_key, get_only_most_stable_structure=True)
make_psr.write_poscar_file()
mod_psr = PoscarFileModifier(poscar="POSCAR")
mod_psr.make_poscar_supercell(scaling_matrix=scaling_matrix)
if __name__ == "__main__":
main()