BackgroundInterfragmentary motion (IFM) is a complex state that significantly impacts the healing process of fractures following implant placement. It is crucial to fully consider the IFM state after implantation in the design and biomechanical testing of implants. However, current finite element analysis software lacks direct tools for calculating IFM, and existing IFM tools do not offer a comprehensive solution in terms of accuracy, functionality, and visualization. MethodsIn our study, we developed a Python-based algorithm for calculating IFM that addresses limitations. Our algorithm automatically calculated IFM distances, sliding distances, gaps, as well as the angles and rotation of the two fracture surfaces using all nodes on both sides of the fracture ends. Researchers could input data and selected desired parameters in the interface. The algorithm then performed the necessary calculations and presented the results in a clear and concise manner. The algorithm also provided comprehensive data export capabilities, allowing researchers to customize analyses based on specific needs.To provide a more intuitive demonstration of the calculation process and usage of IFM-Cal, we conducted simulations in Ansys using two rectangular blocks to compare the accuracy and function of three different methods (Point based method, contact tool and IFM-Cal). ResultsThe point-based method and the contact tool could not accurately calculate IFA, while IFM-Cal could provide a comprehensive evaluation of IFA. In simulation 1, the IFM distances calculated using the point sampling method, contact tool, and IFM-Cal were 2.00 mm, 3.15 mm, and 2.00 mm, respectively. In simulation 2, both the point sampling method and contact tool failed to calculate the interfragmentary angle (IFA), while the IFM-Cal algorithm estimated an angle of -7.87°, which had a small error compared to the ground-truth value of 7.9°. ConclusionWe have developed an algorithm for computing IFM which can be utilized in finite element analysis and biomechanical experiments. By conducting comparative simulations with other existing algorithms, we have demonstrated the superior accuracy and expanded evaluation capabilities of our algorithm.