forked from cja14/CASTEP_VCA_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSS_to_endmember.py
32 lines (27 loc) · 1.06 KB
/
SS_to_endmember.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
#!/usr/bin/env python3
import mixmap
import readmixcastep as rc
import sys
""" Command line tool to quickly get a pure cell file from a solid soln. """
# Load the input file (accepts .castep or .cell)
casfile = str(sys.argv[1])
if '.castep' in casfile:
chem = casfile.replace('.castep', '')
cas = rc.readcas(casfile)
elif '.cell' in casfile:
chem = casfile.replace('.cell', '')
cas = rc.readcell(casfile)
# Extract calculation parameters and convert from mix to pure structure
mixatom = cas.extract_struc(iteration=None)
mixkey = cas.get_mixkey(iteration=None)
press = cas.get_ext_press()
kpoints, offset = cas.get_kpoints()
pseudos = cas.get_psps()
constraints = cas.get_cell_constrs()
mapping = mixmap.mixmap(mixatom, mixkey)
pureatom = mapping.mix2pure(mixatom)
# Write the pure cell (always with the same handle plus the suffix _nonSS)
mapping.setcellparams(pressure=press, cell_constrs=constraints,
pseudos=pseudos, kpoints=kpoints, kpoints_offset=offset)
cellfile = chem+'_nonSS.cell'
mapping.casprint(pureatom, cellfile, pure=True)