Now guards against positions or amplitudes vectors being empty, raising an exception, to avoid segfaults