def __update_density(self, compound='<STR_LIT>', element='<STR_LIT>'):
_density_element = <NUM_LIT:0><EOL>list_ratio = self.stack[compound][element]['<STR_LIT>']['<STR_LIT>']<EOL>list_density = self.stack[compound][element]['<STR_LIT>']['<STR_LIT>']['<STR_LIT:value>']<EOL>ratio_density = zip(list_ratio, list_density)<EOL>for _ratio, _density in ratio_density:<EOL><INDENT>_density_element += np.float(_ratio) * np.float(_density)<EOL><DEDENT>self.stack[compound][element]['<STR_LIT>']['<STR_LIT:value>'] = _density_element<EOL>_density_lock = self.density_lock<EOL>if not _density_lock[compound]:<EOL><INDENT>self.__update_layer_density()<EOL><DEDENT>
Re-calculate the density of the element given due to stoichiometric changes as
        well as the compound density (if density is not locked)

        Parameters:
        ===========
        compound: string (default is '') name of compound
        element: string (default is '') name of element