Skip to content

Commit

Permalink
Merge pull request #11 from MDIL-SNU/python3
Browse files Browse the repository at this point in the history
Python3
  • Loading branch information
yybbyb committed Feb 24, 2020
2 parents 99e1a91 + 870932a commit c9218a2
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 16 deletions.
Binary file modified docs/Examples/NiO/dos_GGA.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Examples/Si/dos_GGA.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/Output/Output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Results
- Band_gap_hybrid_GGA.log:
Information of band gap with HSE@PBE scheme

- dos_GGA.pnd (dos_GGA.pdf):
- dos_GGA.png (dos_GGA.pdf):
Density of states image

- dielectric_GGA.log:
Expand Down Expand Up @@ -117,4 +117,4 @@ name_with_U
If the material is metallic and DFT+U calculation has been conducted,
all of results move to this directory.

Additionally, AMP\ :sup:`2`\ provides log file as amp2.log for tracing the calculation.
Additionally, AMP\ :sup:`2`\ provides log file as amp2.log for tracing the calculation.
Binary file modified docs/Overview/dos_GGA.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/amp2_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### Date: 2019-04-08 ###
### yybbyb@snu.ac.kr ###
###########################################
import math, glob, os, shutil, sys, subprocess
import math, os, shutil, sys, subprocess
import yaml
from module_vasprun import wincar,incar_from_yaml
from module_log import *
Expand Down
3 changes: 2 additions & 1 deletion src/band.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

pot_type = sys.argv[5]
if pot_type == 'LDA':
POT = 'LDA'
pin
/spinPOT = 'LDA'
else:
POT = 'GGA'

Expand Down
20 changes: 10 additions & 10 deletions src/config_def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ program:
mpi_command: mpirun

calculation:
kp_test: 1
encut_test: 1
relaxation: 1
band: 1
density_of_states: 1
hse_oneshot: 1
dielectric: 1
effective_mass: 1
plot: 1
magnetic_ordering: 1
kp_test: T
encut_test: T
relaxation: T
band: T
density_of_states: T
hse_oneshot: T
dielectric: T
effective_mass: T
plot: T
magnetic_ordering: T
large_off: -1

cif2vasp:
Expand Down
23 changes: 22 additions & 1 deletion src/module_band.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def gap_estimation(target,fermi,spin,ncl,KPT,Band,nelect):
gap_simple.write(' metal\n')
if metal == 2 :
gap_log.write('! If it is not hybrid calculation, additional search is required for hybrid calculation.\n')
gap_simple.write('! If it is not hybrid calculation, Additional search is required for hybrid calculation.\n')
gap_simple.write('! If it is not hybrid calculation, additional search is required for hybrid calculation.\n')
else :
gap_log.write("Use the 'KPT' file for hybrid calculation\n")
kpt_out.write("Example file\n 0\nReciprocal\n")
Expand Down Expand Up @@ -793,3 +793,24 @@ def band_warning(Band,target):
make_amp2_log(target,'\tIndex of kpts: '+str(warn_list[0]+1)+'\t from '+str(warn_list[1][0]+1)+' th band')

return warn

def check_half_metal(target):
spin = pygrep('ISPIN',target+'/OUTCAR',0,0).split()[2]
ncl = pygrep('NONCOL',target+'/OUTCAR',0,0).split()[2]
if not (spin == '2' and ncl =='F'):
half_metal = 0
else:
[KPT,Band,nelect] = EIGEN_to_array(target+'/EIGENVAL',spin)
fermi = get_fermi_level(Band,nelect,ncl)
half_metal = 0
for i in range(int(spin)) :
metal = 0
for n in range(len(Band)) :
single_band = [Band[n][x][i] for x in range(len(KPT))]
band_max = max(single_band)
band_min = min(single_band)
if band_max > fermi and band_min < fermi:
metal = 1
if metal = 0:
half_metal = 1
return half_metal
2 changes: 1 addition & 1 deletion src/module_vasprun.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def make_multiple_kpts(kp_log,kpt_file,pos_file,kp_multi,sym,gam_option):
KP_ori = khead[3].split()
KP=[]
for i in range(3) :
if sym == 5 or sym == 6:
if sym in [5,6,10]:
KP.append(str(max([int(x) for x in KP_ori[i]])*kp_multi))
else:
KP.append(str(int(KP_ori[i])*kp_multi))
Expand Down
11 changes: 11 additions & 0 deletions src/rerun_for_metal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from input_conf import input_conf
from module_amp2_input import *
from module_log import *
from module_band import check_half_metal
from input_conf import set_on_off
from _version import __version__
code_data = 'Version '+__version__+'. Modified at 2020-01-15'
Expand Down Expand Up @@ -54,6 +55,16 @@
if U_on == 0 :
sys.exit()

# Check half metal
if os.path.isfile(target+'/band_GGA/Band_gap.log'):
if check_half_metal(target+'/band_GGA') == 1:
sys.exit()
elif os.path.isfile(target+'/band_LDA/Band_gap.log'):
if check_half_metal(target+'/band_LDA') == 1:
sys.exit()
else:
sys.exit()

# Backup +U calculation results
backup_path = target+'/'+target.split('/')[-1]+'_with_U'
if not os.path.isdir(backup_path):
Expand Down

0 comments on commit c9218a2

Please sign in to comment.