NPT molecular-dynamics simulations have been carried out, using the Gromacs package, of the coarse-grained united-atom model of a polymer melt in the vicinity of the glass transition and confined between two crystalline substrates. The pair interactions between all united atoms are described with the help of the Lennard-Jones (LJ) potential. For a corresponding bulk polymer at fixed potential cutoff distance the temperature dependence of density is not influenced by different methods of shifting the potential but is affected by the long range energy and pressure correction. At the same time the shift to higher densities and higher glass-transition temperatures is observed upon increasing the LJ cutoff distance from 2.5s2.5s to 5s5s. Depending on the potential cutoff value the polymer-film density can be both below and above the corresponding bulk density at fixed temperature; these dependences are also very sensitive to modification of the potential at a fixed cutoff distance. The effect increases with decreasing film thickness, thus resulting in a different thickness dependence of the glass-transition temperature at different cutoff values.