def __update_layer_density(self):
_stack = self.stack<EOL>_density_lock = self.density_lock<EOL>list_compound = _stack.keys()<EOL>for _key in list_compound:<EOL><INDENT>if _density_lock[_key]:<EOL><INDENT>continue<EOL><DEDENT>_list_ratio = _stack[_key]['<STR_LIT>']<EOL>_list_density = []<EOL>for _element in _stack[_key]['<STR_LIT>']:<EOL><INDENT>_list_density.append(_stack[_key][_element]['<STR_LIT>']['<STR_LIT:value>'])<EOL>_compound_density = _utilities.get_compound_density(list_density=_list_density,<EOL>list_ratio=_list_ratio)<EOL><DEDENT>_stack[_key]['<STR_LIT>']['<STR_LIT:value>'] = _compound_density<EOL><DEDENT>self.stack = _stack<EOL>
calculate or update the layer density