Momentum removal to obtain the position‐dependent diffusion constant in constrained molecular dynamics simulation