<div>The position-dependent diffusion coefficient along with free energy profile are important parameters needed to study mass transport in heterogeneous systems such as biological and polymer membranes, and molecular dynamics (MD) calculation is a popular tool to obtain them. Among many methodologies, the Marrink-Berendsen (MB) method is often employed to calculate the position-dependent diffusion coefficient, in which the autocorrelation function of the force on a fixed molecule is related to the friction on the molecule. However, the diffusion coefficient is shown to be affected by the period of the removal of the center-of-mass velocity, which is necessary when performing MD calculations using the Ewald method for Coulombic interaction. We have clarified theoretically in this study how this operation affects the diffusion coefficient calculated by the MB method, and the theoretical predictions are proven by MD calculations. Therefore, we succeeded in providing guidance on how to select an appropriate the period of the removal of the center-of-mass velocity in estimating the position-dependent diffusion coefficient by the MB method. This guideline is applicable also to the Woolf-Roux method.</div>