Пример #1
0
 def test_to_dict_and_from_dict(self):
     file_name = os.path.join(test_dir, "INCAR")
     incar = Incar.from_file(file_name)
     d = incar.to_dict
     incar2 = Incar.from_dict(d)
     self.assertEqual(incar, incar2)
Пример #2
0
 def run_task(self, fw_spec):
     Incar.from_dict(fw_spec['vasp']['incar']).write_file('INCAR')
     Poscar.from_dict(fw_spec['vasp']['poscar']).write_file('POSCAR')
     Potcar.from_dict(fw_spec['vasp']['potcar']).write_file('POTCAR')
     Kpoints.from_dict(fw_spec['vasp']['kpoints']).write_file('KPOINTS')
Пример #3
0
 def test_to_dict_and_from_dict(self):
     file_name = os.path.join(test_dir, 'INCAR')
     incar = Incar.from_file(file_name)
     d = incar.to_dict
     incar2 = Incar.from_dict(d)
     self.assertEqual(incar, incar2)
Пример #4
0
 def test_as_dict_and_from_dict(self):
     d = self.incar.as_dict()
     incar2 = Incar.from_dict(d)
     self.assertEqual(self.incar, incar2)
Пример #5
0
slab_potcar.write_file("./Slab_with_vdw/POTCAR")

#set the common INCAR file and KPOINTS
incar_dict = {
                 'SYSTEM': 'ligand_PbS', 
                 'ENCUT': 600, 
                 'ISIF': 2, 
                 'IBRION': 2, 
                 'ALGO': 'Normal', 
                 'ISMEAR': 1, 
                 'ISPIN': 1, 
                 'EDIFF': 1e-06, 
                 'EDIFFG': -0.005, 
                 'NPAR': 8, 
                 'SIGMA': 0.1, 
                 'PREC': 'Accurate',
		 'IVDW': 2,
		 'NSW': 1000
    }

incar = Incar.from_dict(incar_dict)
kpoints = Kpoints.monkhorst_automatic(kpts= (8, 8, 1), shift= (0, 0, 0))

#write the files in appropriate directory
incar.write_file("./Interface_with_vdw/INCAR")
incar.write_file("./Slab_with_vdw/INCAR")
kpoints.write_file("./Interface_with_vdw/KPOINTS")
kpoints.write_file("./Slab_with_vdw/KPOINTS")
shu.copy("./submit_job", "./Interface_with_vdw/")
shu.copy("./submit_job", "./Slab_with_vdw")
Пример #6
0
def get_VASP_inputs(structure, workdir, job_name, nproc=64, kppa=500, extra_incar_dict = None):

    if os.path.exists(workdir):
        print 'WORKDIR ALREADY EXISTS. DELETE TO LAUNCH NEW JOB'
        return -1

    poscar  = Poscar(structure)

    list_potcar_singles, potcar= get_POTCAR(poscar)

    kpoints = Kpoints.automatic_density(structure, kppa=kppa)

    # Default values
    incar_dict = dict(  SYSTEM  =   structure.formula, # Name of job
                        LREAL   =   'Auto',     # Should projections be done in real space? Let VASP decide
                        ENCUT   =   520.,       # 520. eV, just like Ceder
                        IBRION  =   2,          # Controls ionic relataxion: 1-> DISS, 2 -> CG, 3-> MD
                        EDIFF   =   1E-7,       # criterion to stop SCF loop, in eV
                        EDIFFG  =  -1E-3,       # criterion to stop ionic relaxations. Negative means FORCES < |EDIFFG|
                        PREC    =   'HIGH',     # level of precision
                        AMIX    =   0.2,
                        AMIX_MAG=   0.8,
                        BMIX    =   0.001,
                        BMIX_MAG=   0.001,
                        NSW     =   150,        # Maximum number of ionic steps
                        ISMEAR  =   0,          # smearing scheme. Use 0 for insulators, as suggested by VASPWIKI
                        ISPIN   =   2,          # spin polarized 
                        NPAR    =   8,          # VASPWIKI recommends sqrt(ncore)
                        LSCALU  =   False,      # Don't use scalapack. Probably a can of worms.
                        ALGO    =   'NORMAL',   # what ionic relaxation scheme to use? 
                        LORBIT  =   11,         # 11 prints out the DOS
                        ISIF    =   3,          # Controls the computation of stress tensor. 3 computes everything
                        NSIM    =   4,          # how many bands to treat in parallel? Default is 4, probably fine.
                        SIGMA   =   0.025,      # smearing in eV
                        LMAXMIX =   4,          # Description: LMAXMIX controls up to which l-quantum number the one-center PAW charge densities are passed through the charge density mixer. MaterialsProject uses 4.
                        LCHARG  =   False,      # Write charge densities?
                        LWAVE   =   False,      # write out the wavefunctions?
                        LPLANE  =   True,       # Plane distribution of FFT coefficients. Reduces communications in FFT.
                        NELM    =   100,        # maximum number of SCF cycles.
                        NELMDL  =  -10,         # since initial orbitals may be random, fixes hamiltonian for |NELM| SCF cycles to give wf a chance to simmer down.
                        ISTART  =   0,          # begin from scratch!
                        ISYM    =   2)          # use symmetry 

    if extra_incar_dict  != None:
        incar_dict.update( extra_incar_dict  )

    incar   = Incar.from_dict(incar_dict )


    incar.write_file(workdir+'INCAR')
    poscar.write_file(workdir+'POSCAR', vasp4_compatible = True)
    kpoints.write_file(workdir+'KPOINTS')
    potcar.write_file(workdir+'POTCAR')


    potcar.sort()
    hack_potcar_file(workdir,list_potcar_singles)
    

    with open(workdir+'job.sh','w') as f:
        f.write(submit_template.format(job_name,nproc))

    with open(workdir+'clean.sh','w') as f:
        f.write(clean_template)

    return 0
def get_calibration_task(structure, phase="CalibrateBulk", \
                         slab_interface_params={'hkl':[1,0,0], 'ligand': None},\
                         turn_knobs={}, incar_params={}, other_params={}):
    """
    returns general calibration task for a structure
    
    Args:
        structure    : pymatgen structure to be calibrated (can be a bulk, ligand, slab
                       or interface)  
        phase        : calibration type, viz. CalibrateBulk, CalibrateMolecule,
                       CalibrateSlab, CalibrateInterface
        hkl          : in case of Slab and Interface miller indices of facet 
        turn_knobs   : specifies the parameters to be calibrated 
        incar_params : dictionary of additional incar parameters, refer defined 
                       incar_dict for defaults 
        other_params : other parameters for calibration, viz. job_dir, is_matrix, etc. 
                       described in the calibrate module
    """
    #structure definition 
    
    poscar = Poscar(structure)
    incar_dict = { 'SYSTEM': 'slab',
                   'ENCUT': 500, 
                   'ISIF': 2, 
                   'IBRION': 2, 
                   'ISMEAR': 1, 
                   'EDIFF': 1e-05, 
                   'NPAR': 4, 
                   'SIGMA': 0.1, 
                   'PREC': 'Accurate'
                 }
    if incar_params: 
        incar_dict.update(incar_params)
    incar = Incar.from_dict(incar_dict)
    kpoints = Kpoints.monkhorst_automatic(kpts=(8, 8, 1))
    que  = { 'nnodes':1,
             'nprocs':16,
             'walltime':'48:00:00',
             'job_bin': '/home/km468/Software/VASP/vaspsol_kappa.5.3.5/vasp'             
            }
    # calibration task: relax hkl
    calparams = {}
    calparams['calibrate'] = phase
    calparams['incar'] = incar.as_dict()
    calparams['poscar'] = poscar.as_dict()
    calparams['kpoints'] = kpoints.as_dict()
    calparams['que_params'] = que
    calparams['turn_knobs'] = turn_knobs
    if phase == 'CalibrateSlab':
         calparams['system'] = {'hkl':slab_interface_params['hkl'],
                                'ligand':slab_interface_params['ligand']
                               }
    elif phase == 'CalibrateInterface':
         calparams['system'] = {'hkl':hkl,
                                'ligand':structure.ligand.reduced_formula
                               }
    calparams['other_params'] = {
        'is_matrix':False,
        'from_ase':True,
        'Grid_type':'M'
        }
    if other_params:
        calparams['other_params'].update(other_params)
    return MPINTCalibrateTask(calparams)
Пример #8
0
 def run_task(self, fw_spec):
     Incar.from_dict(fw_spec['vasp']['incar']).write_file('INCAR')
     Poscar.from_dict(fw_spec['vasp']['poscar']).write_file('POSCAR')
     Potcar.from_dict(fw_spec['vasp']['potcar']).write_file('POTCAR')
     Kpoints.from_dict(fw_spec['vasp']['kpoints']).write_file('KPOINTS')
Пример #9
0
def get_calibration_task(structure, phase="CalibrateBulk", \
                         slab_interface_params={'hkl':[1,0,0], 'ligand': None},\
                         turn_knobs={}, incar_params={}, other_params={}):
    """
    returns general calibration task for a structure
    
    Args:
        structure    : pymatgen structure to be calibrated (can be a bulk, ligand, slab
                       or interface)  
        phase        : calibration type, viz. CalibrateBulk, CalibrateMolecule,
                       CalibrateSlab, CalibrateInterface
        hkl          : in case of Slab and Interface miller indices of facet 
        turn_knobs   : specifies the parameters to be calibrated 
        incar_params : dictionary of additional incar parameters, refer defined 
                       incar_dict for defaults 
        other_params : other parameters for calibration, viz. job_dir, is_matrix, etc. 
                       described in the calibrate module
    """
    #structure definition

    poscar = Poscar(structure)
    incar_dict = {
        'SYSTEM': 'slab',
        'ENCUT': 500,
        'ISIF': 2,
        'IBRION': 2,
        'ISMEAR': 1,
        'EDIFF': 1e-05,
        'NPAR': 4,
        'SIGMA': 0.1,
        'PREC': 'Accurate'
    }
    if incar_params:
        incar_dict.update(incar_params)
    incar = Incar.from_dict(incar_dict)
    kpoints = Kpoints.monkhorst_automatic(kpts=(8, 8, 1))
    que = {
        'nnodes': 1,
        'nprocs': 16,
        'walltime': '48:00:00',
        'job_bin': '/home/km468/Software/VASP/vaspsol_kappa.5.3.5/vasp'
    }
    # calibration task: relax hkl
    calparams = {}
    calparams['calibrate'] = phase
    calparams['incar'] = incar.as_dict()
    calparams['poscar'] = poscar.as_dict()
    calparams['kpoints'] = kpoints.as_dict()
    calparams['que_params'] = que
    calparams['turn_knobs'] = turn_knobs
    if phase == 'CalibrateSlab':
        calparams['system'] = {
            'hkl': slab_interface_params['hkl'],
            'ligand': slab_interface_params['ligand']
        }
    elif phase == 'CalibrateInterface':
        calparams['system'] = {
            'hkl': hkl,
            'ligand': structure.ligand.reduced_formula
        }
    calparams['other_params'] = {
        'is_matrix': False,
        'from_ase': True,
        'Grid_type': 'M'
    }
    if other_params:
        calparams['other_params'].update(other_params)
    return MPINTCalibrateTask(calparams)
Пример #10
0
 def test_as_dict_and_from_dict(self):
     d = self.incar.as_dict()
     incar2 = Incar.from_dict(d)
     self.assertEqual(self.incar, incar2)