diff --git a/example/input.yaml b/example/input.yaml index b1f96e8..d9bdf51 100644 --- a/example/input.yaml +++ b/example/input.yaml @@ -1,27 +1,24 @@ PARAMS: - kpar: 8 + kpar: 4 # 'KPAR' tag to be used in VASP simulations ppn: 13 # NPROCS/KPAR ; NPROCS: number of total processors to be used in VASP simulations - reciprocal_density: 200 + reciprocal_density: 50 # reciprocal density that determines the k-grid using 'automatic_density_by_vol' method of pymatgen encutgw: 100 # ENCUTGW to be used in VASP simulations - nbgwfactor: 5 + nbgwfactor: 2 # NBANDS=nbgwfactor x nocc'; nocc' is the smallest multiple of ppn which is larger than number of occupied bands - nomegagw: 80 + nomegagw: 50 # NOMEGAGW to be used in VASP simulations - convparam: NBANDS - # NBANDS/ENCUTGW/NOMEGA parameter to run convergence test for - - convsteps: 2 - # steps to be used for convergence test + convsteps: [50, 0, 0] + # percentage increments to be used for convergence tests of NBANDS, ENCUTGW, NOMEGA conviter: 5 # maximum number of iteration in convergence test @@ -39,27 +36,27 @@ STRUCTURE: mat_name: NEW_MAT # unique identifier in the database when source=POSCAR - material_id: mp-661 + material_id: mp-149 # material_id of the input structure in MP database WFLOW_DESIGN: - skip_emc: false + skip_emc: true # set true to skip effective mass calculation - skip_wannier: false + skip_wannier: true # set true to skip wannier bandstructure interpolation - skip_conv: false + skip_conv: false # set true to skip convergence test - skip_gw: false + skip_gw: true # set true to skip GW calculation scgw: true # set true to perform self-consistent GW instead of G0W0 - skip_bse: false + skip_bse: true # set true to skip BSE calculation diff --git a/pyGWBSE/make_wflow.py b/pyGWBSE/make_wflow.py index 296df11..9c115d5 100644 --- a/pyGWBSE/make_wflow.py +++ b/pyGWBSE/make_wflow.py @@ -69,7 +69,6 @@ def create_wfs(struct, params_dict, vasp_cmd=None, sumo_cmd=None, wannier_cmd=No nbgwfactor=params["nbgwfactor"] encutgw=params["encutgw"] nomegagw=params["nomegagw"] - convparam=params["convparam"] convsteps=params["convsteps"] conviter=params["conviter"] enwinbse=params["enwinbse"] @@ -90,21 +89,6 @@ def create_wfs(struct, params_dict, vasp_cmd=None, sumo_cmd=None, wannier_cmd=No print("You have ",nocc,"occupied bands") print("You have ",nkpt,"kpoints") print("You have ",mesh,"k-grid") - if not(skip_conv): - print("Will perform convergence test for: ",convparam) - print("Values that will be used for convergence test: ",end='') - if convparam=='NOMEGA': - initparam=nomegagw - if convparam=='NBANDS': - initparam=nbgwfactor - if convparam=='ENCUTGW': - initparam=encutgw - for citer in range(conviter): - if convparam=='NBANDS': - print(nbands*(initparam+citer*convsteps),end=' ') - else: - print(initparam+citer*convsteps,end=' ') - print( ) print("KPAR=",kpar) print("reciprocal_density=",rd) if not(skip_bse): @@ -134,7 +118,7 @@ def create_wfs(struct, params_dict, vasp_cmd=None, sumo_cmd=None, wannier_cmd=No ifw=ifw+1 parents = fws[0] - fw = convFW(structure=struct, mat_name=mat_name, nbands=nbands, nbgwfactor=nbgwfactor, encutgw=encutgw, nomegagw=nomegagw, convparam=convparam, convsteps=convsteps, conviter=conviter, + fw = convFW(structure=struct, mat_name=mat_name, nbands=nbands, nbgwfactor=nbgwfactor, encutgw=encutgw, nomegagw=nomegagw, convsteps=convsteps, conviter=conviter, tolerence=0.1, no_conv=skip_conv, vasp_cmd=vasp_cmd,db_file=db_file,parents=parents,kpar=kpar,nbandsgw=nbandsgw,reciprocal_density=rd) fws.append(fw) diff --git a/pyGWBSE/wflows.py b/pyGWBSE/wflows.py index 2c4b683..c2da180 100644 --- a/pyGWBSE/wflows.py +++ b/pyGWBSE/wflows.py @@ -5,7 +5,7 @@ Defines standardized Fireworks that can be chained easily to perform various sequences of VASP calculations. """ - +import numpy as np from atomate.common.firetasks.glue_tasks import PassCalcLocs from atomate.vasp.firetasks.write_inputs import WriteVaspFromIOSet from fireworks import Firework, Tracker @@ -45,48 +45,64 @@ def __init__(self, mat_name=None, structure=None, nbands=None, kpar=None, recipr class convFW(Firework): def __init__(self, mat_name=None, structure=None, tolerence=None, no_conv=None, nbands=None, - nbgwfactor=None, encutgw=None, nomegagw=None, convparam=None, convsteps=None, conviter=None, + nbgwfactor=None, encutgw=None, nomegagw=None, convsteps=None, conviter=None, kpar=None, nbandsgw=None, reciprocal_density=None, vasp_input_set=None, vasp_input_params=None, - vasp_cmd="vasp", - prev_calc_loc=True, prev_calc_dir=None, db_file=None, vasptodb_kwargs={}, parents=None, **kwargs): + vasp_cmd="vasp", prev_calc_loc=True, prev_calc_dir=None, db_file=None, vasptodb_kwargs={}, parents=None, **kwargs): t = [] name = "CONV" fw_name = "{}-{}".format(mat_name, name) niter = 0 + nocc=nbands + convsteps=np.array(convsteps)*0.01 for niter in range(conviter): niter = niter + 1 files2copy = ['WAVECAR'] task_label = 'Convergence_Iteration: ' + str(niter) - if convparam == 'NBANDS': - nbgwfactor = nbgwfactor + (niter - 1) * convsteps - if convparam == 'ENCUTGW': - encutgw = encutgw + (niter - 1) * convsteps - if convparam == 'NOMEGA': - nomegagw = nomegagw + (niter - 1) * convsteps + + hviter=np.heaviside((niter-1),0) + + nbgwfactor = nbgwfactor + nbgwfactor*hviter*convsteps[0] + encutgw = encutgw + encutgw*hviter*convsteps[1] + nomegagw = nomegagw + nomegagw*hviter*convsteps[2] + + nbands=round(nocc*nbgwfactor) + encutgw=round(encutgw) + nomegagw=round(nomegagw) + + if no_conv==False: + if hviter==0: + print('Convergence test will be performed using following values') + print('Iteration, NBANDS, ENCUTGW, NOMEGA') + print('%10i' %niter, '%7i' %nbands, '%8i' %encutgw, '%6i' %nomegagw) + else: + if hviter==0: + print('values of follwing parameters will be used') + print('NBANDS, ENCUTGW, NOMEGA') + print('%7i' %nbands, '%8i' %encutgw, '%6i' %nomegagw) + if prev_calc_dir: t.append(CopyOutputFiles(additional_files=files2copy, calc_dir=prev_calc_dir, contcar_to_poscar=True)) elif parents: if prev_calc_loc: t.append( CopyOutputFiles(additional_files=files2copy, calc_loc=prev_calc_loc, contcar_to_poscar=True)) - vasp_input_set = CreateInputs(structure, mode='DIAG', nbands=nbands * nbgwfactor, kpar=kpar, + vasp_input_set = CreateInputs(structure, mode='DIAG', nbands=nbands, kpar=kpar, reciprocal_density=reciprocal_density) t.append(WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set, vasp_input_params=vasp_input_params)) t.append(Run_Vasp(vasp_cmd=vasp_cmd)) - vasp_input_set = CreateInputs(structure,mode='CONV',nbands=nbands*nbgwfactor,encutgw=encutgw,nomegagw=nomegagw,kpar=kpar,reciprocal_density=reciprocal_density,nbandsgw=nbandsgw) + vasp_input_set = CreateInputs(structure,mode='CONV',nbands=nbands,encutgw=encutgw,nomegagw=nomegagw,kpar=kpar,reciprocal_density=reciprocal_density,nbandsgw=nbandsgw) t.append(WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set, vasp_input_params=vasp_input_params)) if no_conv==False: t.append(Run_Vasp(vasp_cmd=vasp_cmd)) - t.append(SaveConvParams(nbands=nbands*nbgwfactor, encutgw=encutgw, nomegagw=nomegagw)) + t.append(SaveConvParams(nbands=nbands, encutgw=encutgw, nomegagw=nomegagw)) t.append(CheckBeConv(niter=niter, tolerence=tolerence, no_conv=no_conv)) t.append(PasscalClocsCond(name=name)) if no_conv==False: - t.append(gw2db(structure=structure, mat_name=mat_name, task_label=task_label, db_file=db_file, - defuse_unsuccessful=False)) + t.append(gw2db(structure=structure, mat_name=mat_name, task_label=task_label, db_file=db_file, defuse_unsuccessful=False)) t.append(StopIfConverged()) tracker = Tracker('vasp.log', nlines=100) super(convFW, self).__init__(t, parents=parents, name=fw_name, spec={"_trackers": [tracker]}, **kwargs)