The Varian Real-time Position Management (RPM) system allows respiratory gating based on either the phase or displacement (amplitude) of the breathing waveform. A problem in clinical application is that phase-based gating, required for respiration-correlated (4D-CT) simulation, is not robust to irregular breathing patterns during treatment, and a widely used system version (1.6) does not provide an easy means to change from a phase-based gate into an equivalent displacement-based one. We report on the development and evaluation of a robust method to convert phase-gate thresholds, set by the physician, into equivalent displacement-gate thresholds to facilitate its clinical application to treatment. The software tool analyzes the respiration trace recorded during the 4D-CT simulation, and determines a relationship between displacement and phase through a functional fit. The displacement gate thresholds are determined from an average of two values of this function, corresponding to the start and end thresholds of the original phase gate. The software tool was evaluated in two ways: first, whether in-gate residual target motion and predicted treatment beam duty cycle are equivalent between displacement gating and phase gating during 4D-CT simulation (using retrospective phase recalculation); second, whether residual motion is improved with displacement gating during treatment relative to phase gating (using real-time phase calculation). Residual target motion was inferred from the respiration traces and quantified in terms of mean and standard deviation in-gate displacement measured relative to the value at the start of the recorded trace. For retrospectively-calculated breathing traces compared with real-time calculated breathing traces, we evaluate the inaccuracies of real-time phase calculation by measuring the phase gate position in each trace as well as the mean in-gate displacement and standard deviation of the displacement. Retrospectively-calculated data from ten patients were analyzed. The patient averaged in-gate mean +/- standard deviation displacement (representing residual motion) was reduced from 0.16 +/- 0.14 cm for phase gating under simulation conditions to 0.12 +/- 0.08 cm for displacement gating. Evaluation of respiration traces under treatment conditions (real-time phase calculation) showed that the average displacement gate threshold results in a lower in-gate mean and residual motion (variance) for all patients studied. The patient-averaged in-gate mean +/- standard deviation displacement was reduced from 0.26 +/- 0.18 cm for phase gating (under treatment conditions) to 0.15 +/- 0.09 cm for displacement gating. Real-time phase gating sometimes leads to gating on incorrect portions of the breathing cycle when the breathing trace is irregular. Displacement gating is less prone to such errors, as evidenced by the lower in-gate residual motion in a large majority of cases.