A polymer model for BeF2 and SiO2 melts