Fix QM/MM memory allocation error