def generate_files(args): from pymatgen.io.vaspio.vasp_input import Potcar if args.symbols: try: p = Potcar(args.symbols, functional=args.functional) p.write_file("POTCAR") except Exception as ex: print "An error has occurred: {}".format(str(ex)) else: print "No valid options selected."
def generate_files(args): from pymatgen.io.vaspio.vasp_input import Potcar if args.symbols: try: p = Potcar(args.symbols, functional=args.functional) p.write_file("POTCAR") except Exception as ex: print("An error has occurred: {}".format(str(ex))) else: print("No valid options selected.")
sd_flag_slab= [] for i in iface.sites: sd_flag_iface.append(false_site) for i in iface_slab.sites: sd_flag_slab.append(false_site) #POSCAR and POTCAR construction, pending setting of exact flags for POSCAR interface_poscar = Poscar(iface, selective_dynamics= sd_flag_iface) interface_potcar= Potcar(interface_poscar.site_symbols) slab_poscar = Poscar(iface_slab, selective_dynamics= sd_flag_slab) slab_potcar= Potcar(slab_poscar.site_symbols) #write the files in appropriate directories interface_poscar.write_file("./Interface/POSCAR_PbS100DMF_interface_with_sd.vasp") slab_poscar.write_file("./Slab/POSCAR_PbS100_slab_with_sd.vasp") interface_potcar.write_file("./Interface_with_vdw/POTCAR") 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,
def get_ModifiedMaterialsProject_VASP_inputs(structure, workdir, job_name, nproc=16, U_strategy_instance = None, supplementary_incar_dict = None): """ Inputs will be inspired by MaterialsProject, but this function is appropriate when we are seriously modifying the inputs such that they no longer conform to Materials Project. """ if os.path.exists(workdir): print 'WORKDIR ALREADY EXISTS. DELETE TO LAUNCH NEW JOB' return -1 os.mkdir(workdir) # let's start with MP input_set = MPVaspInputSet() incar = input_set.get_incar(structure) if U_strategy_instance != None: # reading the structure here insures consistency, rather # than having the strategy read the structure outside this driver. U_strategy_instance.read_structure(structure) # Generate all LDAU-related variables according to specified strategy. LDAU_dict, poscar_need_hack, potcar_need_hack = U_strategy_instance.get_LDAU() incar.update(LDAU_dict) # set the number of parallel processors to sqrt(nproc), # as recommended in manual. incar.update({'NPAR':int(np.sqrt(nproc))}) if supplementary_incar_dict != None: incar.update(supplementary_incar_dict) poscar = input_set.get_poscar(structure) kpoints = input_set.get_kpoints(structure) potcar = input_set.get_potcar(structure) incar.write_file(workdir+'INCAR') poscar.write_file(workdir+'POSCAR', vasp4_compatible = True) kpoints.write_file(workdir+'KPOINTS') potcar.write_file(workdir+'POTCAR') if poscar_need_hack: # do we need specialized hacking of the poscar because of the U strategy? new_poscar_lines = U_strategy_instance.get_new_poscar_lines() with open(workdir+'POSCAR','w') as f: for line in new_poscar_lines: print >>f, line.strip() if potcar_need_hack: # do we need specialized hacking of the potcar because of the U strategy? new_potcar_symbols = U_strategy_instance.get_new_potcar_symbols(potcar) new_potcar = Potcar(new_potcar_symbols) # overwrite the previous potcar new_potcar.write_file(workdir+'POTCAR') 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