calc = vasp_calculator.Vasp( encut=500, xc='PBE', #setups={'O': '_s', 'C': '_s'}, gga='PE', #kpts = (2,2,1), # kpts=(6, 6, 1), # For typical 2x2 cell IrO2 110 with 2 cusp sites and 2 bridge sites kpts=(4, 4, 1), kpar=10, npar=4, gamma=True, # Gamma-centered (defaults to Monkhorst-Pack) ismear=0, inimix=0, amix=0.2, bmix=0.0001, amix_mag=0.1, bmix_mag=0.0001, # Conservative Mixing Paramters # amix=0.05, # bmix=0.00001, # amix_mag=0.05, # bmix_mag=0.00001, #nupdown= 0, nelm=250, sigma=0.05, algo=algo, # algo='Very_Fast', # algorithm: Normal (Davidson) | Fast | Very_Fast (RMM-DIIS) # algo='normal', ibrion=ibrion, potim=potim, isif=2, ediffg=-0.02, # forces ediff=1e-5, # energy conv. #nedos=2001, prec='Normal', nsw=int(200 / potim), # don't use the VASP internal relaxation, only use ASE lvtot=False, ispin=2, ldau=u_corr, ldautype=2, lreal='auto', lasph=True, ldau_luj={ 'Ni': { 'L': 2, 'U': 6.45, 'J': 0.0 }, 'Co': { 'L': 2, 'U': 3.32, 'J': 0.0 }, 'Cr': { 'L': 2, 'U': 3.5, 'J': 0.0 }, 'Fe': { 'L': 2, 'U': 5.3, 'J': 0.0 }, 'Ce': { 'L': 3, 'U': 4.50, 'J': 0.0 }, 'V': { 'L': 2, 'U': 3.25, 'J': 0.0 }, 'Mn': { 'L': 2, 'U': 3.75, 'J': 0.0 }, 'Ti': { 'L': 2, 'U': 3.00, 'J': 0.0 }, 'W': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'O': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'C': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Au': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Ir': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Cu': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'H': { 'L': -1, 'U': 0.0, 'J': 0.0 }, }, ldauprint=2, # lmaxmix=4, lmaxmix=6, lorbit=11, idipol=3, dipol=(0, 0, 0.5), ldipol=dipole_corr, # ldipol=True, # addgrid=True, # isym=0, )
# Reading VASP parameters from file and merging with params in script from ase_modules.dft_params import VASP_Params VP = VASP_Params(load_defaults=False) VP.load_params() dft_calc_settings.update(VP.params) # ######################################################## if easy_params: dft_calc_settings.update(easy_dft_calc_settings) # Setting NSW to 1, just need to create Charge files dft_calc_settings.update(dict(nsw=1)) # ######################################################## calc = vasp_calculator.Vasp(**dft_calc_settings) # ######################################################## # Writing all calculator parameters to json with open("out_data/calc_params.json", "w") as outfile: json.dump(calc.todict(), outfile, indent=2) #__| # Setting magmoms to 0 if not running spin-polarized calculation if dft_calc_settings.get("ispin", None) == 1: print(30 * "*") print("Setting magnetic moments to 0 since ispin=1") print(30 * "*")
calc = vasp_calculator.Vasp( encut=500, xc='PBE', gga='PS', kpts=(3, 3, 3), kpar=10, npar=4, gamma=True, # Gamma-centered (defaults to Monkhorst-Pack) #ICHARG =1 , #ISTART = 2, #isym = 0, ismear=0, inimix=0, amix=0.1, bmix=0.00001, amix_mag=0.1, bmix_mag=0.00001, #NUPDOWN= 0, nelm=250, sigma=0.05, algo='normal', #algo = 'fast', ibrion=2, isif=2, ediffg=-0.02, # forces ediff=1e-5, #energy conv. nedos=2001, prec='Normal', #prec='Accurate', #nsw=130, # don't use the VASP internal relaxation, only use ASE nsw=0, # don't use the VASP internal relaxation, only use ASE lvtot=False, ispin=1, ldau=False, ldautype=2, lreal=False, lwave=True, lasph=True, #ldipol = True, #idipol = 3, ldau_luj={ 'Ni': { 'L': 2, 'U': 6.45, 'J': 0.0 }, #ldau_luj={'Ni':{'L':2, 'U':8, 'J':0.0}, 'Co': { 'L': 2, 'U': 3.32, 'J': 0.0 }, 'Fe': { 'L': 2, 'U': 5.3, 'J': 0.0 }, 'Ce': { 'L': 3, 'U': 5.5, 'J': 1.0 }, 'Sm': { 'L': 3, 'U': 4.5, 'J': 0.0 }, 'W': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'O': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'C': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Au': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Cu': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'H': { 'L': -1, 'U': 0.0, 'J': 0.0 } }, ldauprint=2, lmaxmix=6, lorbit=11, )
# new calculation atoms = read('init.traj') calc = vasp_calculator.Vasp( encut=500, xc='BEEF', luse_vdw=True, zab_vdw=True, zab_vdw=-1.8867, gga='BF', kpts=(4, 3, 1), npar=2, gamma=True, # Gamma-centered (defaults to Monkhorst-Pack) ismear=0, algo='fast', nelm=250, sigma=0.05, ibrion=2, ediffg=-0.05, # forces ediff= 1e-4, #energy conv. both of these are for the internal relaxation, ie nsw prec='Accurate', nsw=0, # don't use the VASP internal relaxation, only use ASE ispin=1, ldipol=True, lvhar=True, dipol=(0.5, 0.5, 0.5), idipol=3, icharg=1) #start from CHGCAR if icharg = 1 atoms.set_calculator(calc) atoms.get_potential_energy()
calc = vasp_calculator.Vasp( encut=500, xc='PBE', gga='BF', luse_vdw=True, zab_vdw=-1.8867, kpts=(4, 3, 1), kpar= 7, # use this if you run on one node (most calculations). see suncat confluence page for optimal setting npar= 1, # use this if you run on one node (most calculations). see suncat confluence page for optimal setting gamma=True, # Gamma-centered (defaults to Monkhorst-Pack) ismear=0, algo='all', nelm=250, sigma=0.05, ibrion=2, nelmdl=-9, #isif = 3, # 3 for vc-relax, otherwise delete the flag ediffg=-0.05, # forces ediff= 1e-4, # energy conv. both of these are for the internal relaxation, ie nsw prec='Accurate', nsw=0, # don't use the VASP internal relaxation, only use ASE ispin=1, lreal='auto', # automatically decide to do real vs recip space calc ldipol=True, lvhar=True, dipol=(0.0, 0.0, 0.0), idipol=3, icharg=1) # start from CHGCAR if icharg = 1
'L': -1, 'U': 0.0, 'J': 0.0 }, }, ldauprint=2, #lmaxmix=4, lmaxmix=6, lorbit=11, #idipol=3, #dipol=(0, 0, 0.5), #ldipol=True ) # Reading VASP parameters from file and merging with params in script from ase_modules.dft_params import VASP_Params VP = VASP_Params(load_defaults=False) VP.load_params() calc_params.update(VP.params) calc = vasp_calculator.Vasp(**calc_params) #__| atoms.set_calculator(calc) atoms.get_potential_energy() io.write('out.traj', atoms) io.write('out.traj', atoms) clean_up_dft()
def vasp_script(): import ase.calculators.vasp as vasp_calculator import json, multiprocessing, time, os, subprocess params, atoms = initialize( ) # Remove old .out/.err files, load from fw_spec, and write 'init.traj' ############################################# print "Initializing VASP calculator..." #----------------------------------------- calc = vasp_calculator.Vasp( encut=params['pw'], setups=json.loads(params['psp']) # dictionary {'Cu':'_s'} , xc=params['xc'], gga=params['gga'] # 'BF' , luse_vdw=params['luse_vdw'] # True , zab_vdw=params.get('zab_vdw'), kpts=json.loads(params['kpts']), npar= 1 # use this if you run on one node (most calculations). see suncat confluence page for optimal setting , kpar=1, gamma=params[ 'gamma'] # True, # Gamma-centered (defaults to Monkhorst-Pack) , ismear= 0 # assume gaussian smearing, we can make this parameter if necessary , algo=params['algo'] #'fast', , nelm=params['maxstep'], sigma=params['sigma'], ibrion=params['ibrion'] #2 , nelmdl=params['nelmdl'], isif=3 if params['jobkind'] == 'vcrelax' else 2, ediffg=-params['fmax'] # forces , ediff=params[ 'econv'] # energy conv. both of these are for the internal relaxation, ie nsw , prec=params['prec'] #'Accurate' , nsw=params['ionic_steps'] # use ASE ? , ispin=2 if params['spinpol'] else 1, lreal=params[ 'lreal'] # automatically decide to do real vs recip space calc , ldipol=params['dipole'] #True, , lvhar=params['lvhar'] #True, , dipol=params.get('dipol') #(0.5,0.5,0.5), , idipol=3 if params['dipole'] else None, icharg=1) # start from CHGCAR if icharg = 1 atoms.set_calculator(calc) ############################################ print "Generating VASP Input files with ASE" #------------------------------------------ try: proc = multiprocessing.Process(target=atoms.get_potential_energy) proc.start() time.sleep(10) if proc.is_alive(): proc.terminate() except IOError: pass #on nersc, we get io error ####################### print "Running VASP natively..." #---------------------- loader = { 'sherlock': "ml vasp/5.4.1.intel.gpu", 'sherlock2': "ml chemistry vasp/5.4.1", 'nersc': "module load vasp-tpc/5.4.1" } vaspout, vasperr = subprocess.Popen(loader[get_cluster()] + ';which vasp_std;srun -n 32 vasp_std', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate() print 'VASP output:\n', vaspout with open('OUTCAR', 'r') as f: if 'General timing and accounting informations for this job' in f.read( ): if rank() == 0: log(params) return 0 raise ValueError, vasperr
calc = vasp_calculator.Vasp( encut=500, xc='PBE', #setups={'O': '_s', 'C': '_s'}, gga='PE', kpts=(5, 5, 1), kpar=5, npar=8, gamma=True, # Gamma-centered (defaults to Monkhorst-Pack) ismear=0, INIMIX=0, AMIX=0.2, BMIX=0.0001, AMIX_MAG=0.4, BMIX_MAG=0.0001, #NUPDOWN= 0, nelm=250, sigma=0.05, algo='normal', ibrion=2, ediffg=-0.02, # forces ediff=1e-6, #energy conv. nedos=2001, prec='Normal', #prec='Accurate', nsw=0, # don't use the VASP internal relaxation, only use ASE #nsw=200, # don't use the VASP internal relaxation, only use ASE lvtot=False, ispin=2, ldau=True, ldautype=2, LREAL='auto', LASPH=True, LWAVE=False, LDIPOL=True, IDIPOL=3, dipol=(0, 0, 0), #ldau_luj={'Ni':{'L':2, 'U':6.45, 'J':0.0}, ldau_luj={ 'Ni': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Co': { 'L': 2, 'U': 3.32, 'J': 0.0 }, 'Fe': { 'L': 2, 'U': 5.3, 'J': 0.0 }, 'Ce': { 'L': 3, 'U': 5.5, 'J': 1.0 }, 'W': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'O': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'C': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Au': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Cu': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'H': { 'L': -1, 'U': 0.0, 'J': 0.0 } }, ldauprint=2, lmaxmix=6, lorbit=11)
calc = vasp_calculator.Vasp( encut=500, xc='PBE', gga='BF', luse_vdw=True, zab_vdw=-1.8867, kpts=(4, 3, 1), kpar= 1 # use this if you run on one node (most calculations). see suncat confluence page for optimal setting , npar= 4 # use this if you run on one node (most calculations). see suncat confluence page for optimal setting , lhfcalc=True # HSE parameter , hfscreen=0.3 # HSE parameter , setups={ 'K': '_pv', 'Nb': '_pv', 'Zr': '_sv' } # don't use default for these, _sv = include semi-core electrons too, _h and _s (hard vs soft)? , gamma=True # Gamma-centered (defaults to Monkhorst-Pack) , ismear=0 #,inimix = 0 # density mixing , amix=0.2 # etc. , bmix=0.00001 # , amix_mag=0.1 # magnetic mixing , bmix_mag=0.00001 #NUPDOWN= 0, , nelm=250 # max electronic steps , sigma=0.05 # fermi temp , algo='Normal' # diagonalization , ibrion=2 # conjugate gradient descent #POTIM=1.0, , ediffg=-0.02 # force cutoff (IF NEGATIVE) , ediff=1e-4 # energy conv. , nedos=2001 # # gridpoints in dos , prec='Normal' # precision #,nsw=0, # don't use the VASP internal relaxation, only use ASE , nsw=300 # don't use the VASP internal relaxation, only use ASE , lvtot= False # never want this to be true (if you want work function, use lvhar=True to write locpot) , ispin=2 # turns on spin polarization (1 = false 2 = true) , ldau=True # turns on + U , ldautype=2 # parameter ? , lreal='auto' # automatically decide to do real vs recip space calc , lasph= True # "also includes non-spherical contributions from the gradient corrections inside the PAW spheres. " , lwave=False # don't write out wf , ldau_luj={ 'Ni': { 'L': 2, 'U': 6.45, 'J': 0.0 }, # how to apply U correction (what shell, how much, etc.) 'Co': { 'L': 2, 'U': 3.32, 'J': 0.0 }, 'Cr': { 'L': 2, 'U': 3.5, 'J': 0.0 }, 'Fe': { 'L': 2, 'U': 5.3, 'J': 0.0 }, 'V': { 'L': 2, 'U': 3.10, 'J': 0.0 }, 'Mn': { 'L': 2, 'U': 3.75, 'J': 0.0 }, 'Ti': { 'L': 2, 'U': 3.00, 'J': 0.0 }, 'W': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'O': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'C': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Au': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Cu': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Ce': { 'L': 3, 'U': 5.5, 'J': 1.0 }, 'H': { 'L': -1, 'U': 0.0, 'J': 0.0 } }, ldauprint=2 # prints u values to outcar , idipol=3 # what direction (z) , dipol=(0, 0, 0.5) # location , ldipol=True # turns it on , lmaxmix=4, lorbit=11) # prints magnetic moments in outcar
calc = vasp_calculator.Vasp( encut=600, xc='PBE', #setups={'O': '_s', 'C': '_s'}, gga='PE', #kpts = (2,2,1), kpts=(kpoints[0], kpoints[1], kpoints[2]), kpar=kpar, npar=4, gamma=True, # Gamma-centered (defaults to Monkhorst-Pack) ismear=0, inimix=0, amix=0.2, bmix=0.0001, amix_mag=0.1, bmix_mag=0.0001, #nupdown= 0, nelm=120, sigma=0.05, algo='normal', ibrion=2, isif=3, ediffg=-0.02, # forces ediff=1e-5, #energy conv. #nedos=2001, prec='Normal', nsw=150, # don't use the VASP internal relaxation, only use ASE lvtot=False, ispin=2, ldau=False, ldautype=2, #lreal = 'False',#more accuratre volume lreal='auto', lasph=True, ldau_luj={ 'Ni': { 'L': 2, 'U': 6.45, 'J': 0.0 }, 'Co': { 'L': 2, 'U': 3.32, 'J': 0.0 }, 'Cr': { 'L': 2, 'U': 3.5, 'J': 0.0 }, 'Fe': { 'L': 2, 'U': 5.3, 'J': 0.0 }, 'Ce': { 'L': 3, 'U': 4.50, 'J': 0.0 }, 'V': { 'L': 2, 'U': 3.25, 'J': 0.0 }, 'Mn': { 'L': 2, 'U': 3.75, 'J': 0.0 }, 'Ti': { 'L': 2, 'U': 3.00, 'J': 0.0 }, 'W': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'O': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'C': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Au': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'Cu': { 'L': -1, 'U': 0.0, 'J': 0.0 }, 'H': { 'L': -1, 'U': 0.0, 'J': 0.0 } }, ldauprint=2, #lmaxmix=4, lmaxmix=6, lorbit=11, #idipol=3, #dipol=(0, 0, 0.5), #ldipol=True )
# 'Fe':{'L':2, 'U':5.3, 'J':0.0}, # 'Ce':{'L':3, 'U':5.5, 'J':1.0}, # 'Sm':{'L':3, 'U':4.5, 'J':0.0}, # 'W':{'L':-1, 'U':0.0, 'J':0.0}, # 'O':{'L':-1, 'U':0.0, 'J':0.0}, # 'C':{'L':-1, 'U':0.0, 'J':0.0}, # 'Au':{'L':-1, 'U':0.0, 'J':0.0}, # 'Cu':{'L':-1, 'U':0.0, 'J':0.0}, # 'H':{'L':-1, 'U':0.0, 'J':0.0}, # }, ldauprint=2, lmaxmix=6, lorbit=11, ) calc = vasp_calculator.Vasp(kpar=10, lwave=True, **shared_calc_settings) new_atoms.set_calculator(calc) new_atoms.get_potential_energy() calc = vasp_calculator.Vasp(kpar=5, lwave=False, **shared_calc_settings) #__| # assert False #| - Phonon Calculation from ase.phonons import Phonons ph = Phonons(new_atoms, calc, supercell=(1, 1, 1)) ph.run() ph.read(method='frederiksen', acoustic=True)
cc = stretchcombo(initial_value, liste, atoms) # adjust structure according to the initial value (in this example the initial value is not modified). atoms.set_positions(cc.return_adjusted_positions()) # set all constraints, keeping old constraints (there are no old constraints in this example). atoms.set_constraint([cc] + atoms.constraints) # PBE-D3 (zero damping). should work with any periodic DFT program calc = vasp_calculator.Vasp(encut=400, xc='PBE', ivdw=11, gga='PE', kpts=(1, 1, 1), ncore=2, gamma=True, ismear=0, nelm=250, algo='fast', sigma=0.1, ibrion=-1, ediffg=-0.01, ediff=1e-8, prec='normal', nsw=50, lreal='Auto', ispin=1) atoms.set_calculator(calc) dyn = arpess(atoms, scanned_constraint=cc) # minimum: scanned constraint needs to be specified. dyn.run(fmax=0.01) atoms.write('final.cif')