def run_task(self, fw_spec): potcar_symbols = env_chk(self.get("potcar_symbols"), fw_spec) functional = self.get("functional", None) potcar_name = self.get("input_filename", "POTCAR") potcar = Potcar.from_file(potcar_name) # Replace PotcarSingles corresponding to elements # contained in potcar_symbols for n, psingle in enumerate(potcar): if psingle.element in potcar_symbols: potcar[n] = PotcarSingle.from_symbol_and_functional( potcar_symbols[psingle.element], functional) potcar.write_file(self.get("output_filename", "POTCAR"))
def run_task(self, fw_spec): potcar_symbols = env_chk(self.get("potcar_symbols"), fw_spec) functional = self.get("functional", None) potcar_name = self.get("input_filename", "POTCAR") potcar = Potcar.from_file(potcar_name) # Replace PotcarSingles corresponding to elements # contained in potcar_symbols for n, psingle in enumerate(potcar): if psingle.element in potcar_symbols: potcar[n] = PotcarSingle.from_symbol_and_functional( potcar_symbols[psingle.element], functional) potcar.write_file(self.get("output_filename", "POTCAR"))
def add_file(self, src_abs, dst_filename=None): """Add the POTCAR file to the archive and set attributes.""" src_path = py_path.local(src_abs) self.set_version() if self._filelist: raise AttributeError('Can only hold one POTCAR file') super(PotcarFileData, self).add_file(src_abs, dst_filename) self._set_attr('md5', self.get_file_md5(src_abs)) potcar = PotcarSingle.from_file(src_abs) self._set_attr('title', potcar.keywords['TITEL']) self._set_attr('functional', potcar.functional) self._set_attr('element', potcar.element) self._set_attr('symbol', potcar.symbol) src_rel = src_path.relto(src_path.join( '..', '..', '..')) # familyfolder/Element/POTCAR self._set_attr('original_filename', src_rel) dir_name = src_path.dirpath().basename self._set_attr('full_name', dir_name) self._set_attr('potential_set', src_path.parts()[-3].basename)
def add_file(self, src_abs, dst_filename=None): """Add the POTCAR file to the archive and set attributes.""" self.set_version() if self._filelist: raise AttributeError('Can only hold one POTCAR file') super(PotcarFileData, self).add_file(src_abs, dst_filename) self.set_attribute('sha512', self.get_file_sha512(src_abs)) # PotcarSingle needs a string for path potcar = PotcarSingle.from_file(str(src_abs)) self.set_attribute('title', potcar.keywords['TITEL']) self.set_attribute('functional', potcar.functional) self.set_attribute('element', potcar.element) self.set_attribute('symbol', potcar.symbol) src_path = src_abs.resolve() src_rel = src_path.relative_to(src_path.parents[2]) # familyfolder/Element/POTCAR # Make sure we store string elements of Path in the attributes self.set_attribute('original_filename', str(src_rel)) dir_name = src_path.parent dir_name = dir_name.name self.set_attribute('full_name', str(dir_name)) self.set_attribute('potential_set', str(src_path.parts[-3]))
def get_pymatgen(self): """Create a corresponding pymatgen ``PotcarSingle`` instance.""" return PotcarSingle(self.get_content())