Would it help to look for the line that has now changed so do the following:
def read_center_of_mass(lines: List[str]) -> Optional[np.ndarray]:
_""" Scan through text for the center of mass """
_ com = None
for line in lines:
if 'Position of electric origin' in line:
line = re.sub(r'[(),]', '', line)
com = np.array([float(_) for _ in line.split()[-3:]])
if com is not None:
return com * Bohr # return the last match
return com