コード例 #1
0
 def test_kpts(self,kw={}):
     start,end,step = kw.get('start'),kw.get('end'),kw.get('step')
     is_login_node,kw = run_vasp.clean_parse(kw,'is_login_node',False)
     kw.pop('start');kw.pop('end');kw.pop('step')
     kpts = Kpoints()
     kpts_list = set()
     kppa_list = []
     for kppa in range(start,end,step):
         kpts.automatic_density(structure=read_vasp(self.poscar),kppa=kppa)
         if tuple(kpts.kpts[0]) not in kpts_list:
             kpts_list.add(tuple(kpts.kpts[0]))
             kppa_list.append(kppa)
     idx = 0
     for kppa in kppa_list:
         _kw = kw.copy()
         if 'style' not in _kw:
             _kw.update({'kppa':kppa,'style':'auto','job_name':'test_kpts'+str(idx),'NSW':0})
         prep_vasp.prep_single_vasp(poscar=self.poscar,kw=_kw)
         idx += 1
     for i in range(idx):
         run_vasp.run_single_vasp(job_name='test_kpts'+str(i),is_login_node=is_login_node)
     kpts_res = []
     for ii in range(len(kppa_list)):
         EV = ExtractValue(data_folder='test_kpts'+str(ii))
         kpts_res.append([kppa_list[ii],EV.get_energy(),EV.get_cpu_time()])
     with open('test_kpts.txt','w') as f:
         f.writelines('KPTS\tEnergy\tcpu_time\n')
         for line in kpts_res:
             f.writelines(str(line[0])+'\t'+str(line[1])+'\t'+str(line[2])+'\n')
コード例 #2
0
 def test_encut(self,kw={}):
     start,end,step = kw.get('start'),kw.get('end'),kw.get('step')
     is_login_node,kw = run_vasp.clean_parse(kw,'is_login_node',False)
     kw.pop('start');kw.pop('end');kw.pop('step')
     _kw = kw.copy()
     prep_vasp.write_potcar(poscar=self.poscar,kw=_kw)
     with open('POTCAR') as f:
         lines = f.readlines()
     en_line = [i for i in lines if 'ENMAX' in i]
     enmax = max([float(i.split()[2].replace(';','')) for i in en_line])
     remove('POTCAR')
     idx = 0
     for en in np.arange(start*enmax,end*enmax,step):
         _kw = kw.copy()
         _kw.update({'ENCUT':int(en),'job_name':'test_encut'+str(idx),'NSW':0})
         prep_vasp.prep_single_vasp(poscar=self.poscar,kw=_kw)
         idx += 1
     for i in range(idx):
         run_vasp.run_single_vasp(job_name='test_encut'+str(i),is_login_node=is_login_node)
     encut_list = []
     encut = np.arange(start*enmax,end*enmax,step)
     for ii in range(len(encut)):
         EV = ExtractValue(data_folder='test_encut'+str(ii))
         encut_list.append([encut[ii],EV.get_energy(),EV.get_cpu_time()])
     with open('test_encut.txt','w') as f:
         f.writelines('ENMAX\tEnergy\tcpu_time\n')
         for line in encut_list:
             f.writelines(str(line[0])+'\t'+str(line[1])+'\t'+str(line[2])+'\n')
コード例 #3
0
ファイル: pyvasp.py プロジェクト: Secondlalala/pyvaspflow
def main(wd, attribute, number):
    """
    Example:

    pyvasp main -a gap  # this can read the gap and vbm, cbm

    pyvasp main -a fermi  -w work_dir  # this can read the fermi energy, -w is your work directory

    pyvasp main -a energy  # this can read the total energy

    pyvasp main -a ele  # this can read the electrons in your OUTCAR

    pyvasp main -a ele-free  # this can get electrons number of  the defect-free system

    pyvasp main -a  Ewald  # this can get the Ewald energy of your system

    pyvasp main -a cpu  # this can get CPU time
    """

    EV = ExtractValue(wd)
    if 'gap' in attribute:
        get_gap(EV)
    elif 'fermi' in attribute:
        click.echo(EV.get_fermi())
    elif 'total' in attribute.lower() or 'energy' in attribute.lower():
        click.echo(EV.get_energy())
    elif 'ele' in attribute.lower() and 'free' in attribute.lower():
        click.echo(EV.get_Ne_defect_free())
    elif 'ele' in attribute.lower() and 'free' not in attribute.lower(
    ) and 'static' not in attribute.lower():
        click.echo(EV.get_Ne_defect())
    elif 'ima' in attribute or 'ewald' in attribute.lower():
        clikc.echo(EV.get_image())
    elif 'elect' in attribute and 'static' in attribute:
        outcar = os.path.join(wd, 'OUTCAR')
        click.echo(str(number) + ' ' + str(get_ele_sta(outcar, number)))
    elif 'cpu' in attribute.lower():
        click.echo(EV.get_cpu_time())
コード例 #4
0
ファイル: pyvasp.py プロジェクト: ChangChunHe/pyvaspflow
def energy(wd):
    EV = ExtractValue(wd)
    click.echo(EV.get_energy())
コード例 #5
0
ファイル: utils.py プロジェクト: Secondlalala/pyvaspflow
def get_grd_state(job_name,start_job_num,end_job_num):
    energy = []
    for ii in range(start_job_num,end_job_num+1):
        EV = ExtractValue(data_folder=job_name+str(ii))
        energy.append(EV.get_energy())
    return np.argmin(energy)