In the band theory, first-principles calculations, the tight-binding method and the effective
k
·
p
model are usually employed to investigate electronic structures of condensed matters. The effective
k
·
p
model has a compact form with a clear physical picture, and first-principles calculations can give more accurate results. Nowadays, it has been widely recognized to combine the
k
·
p
model and first-principles calculations to explore topological materials. However, the traditional method to derive the
k
·
p
Hamiltonian is complicated and time-consuming by hand. We independently developed a programmable algorithm to construct effective
k
·
p
Hamiltonians for condensed matters. Symmetries and orbitals are used as the input information to produce the one-/two-/three-dimensional
k
·
p
Hamiltonian in our method, and the open-source code can be directly downloaded online. At last, we also demonstrated the application to MnBi2Te4-family magnetic topological materials.