Computational modelling of defects and charge trapping in amorphous and crystalline metal oxides