def potcar_from_linklist(cls, poscar_data, linklist): """ Assemble pymatgen Potcar object from a list of VaspPotcarData instances Reads pseudo-potential from the passed list connecting each element with it's potential and creates the complete Potcar file according to the element ordering fodun in the passed poscar data object. :param poscar_data: input structure for VASP calculations :type poscar: :class:`aiida_cusp.data.inputs.VaspPoscarData` :param linklist: dictionary mapping element names to VaspPotcarData instances :type linklist: `dict` :returns: pymatgen Potcar data instance with containing the concatenated pseudo-potential information for all elements defined in the linklist :rtype: :class:`~pymatgen.io.vasp.inputs.Potcar` """ # initialize empty Potcar object complete_potcar = Potcar() # file empty potcar with potential in order of elements found in the # passed structure data site_symbols = poscar_data.get_poscar().site_symbols for site_symbol in site_symbols: try: potential_pointer = linklist[site_symbol] except KeyError: raise VaspPotcarDataError( "Found no potential in passed " "potential-element map for " "site symbol '{}'".format(site_symbol)) potential_file = potential_pointer.load_potential_file_node() potential_contents = potential_file.get_content() potcar_single = PotcarSingle(potential_contents) complete_potcar.append(potcar_single) return complete_potcar