An important aspect of atomistic simulations of interfaces and dislocations is the construction of reliable initial atomic configurations. Interfacial energy calculated with an atomistic model is very sensitive to adding atoms to or removing atoms from the interface, especially when the interface has a general orientation. Also, limited dislocation configurations can be constructed by previous methods, impeding the simulations of a general dislocation configuration in real materials. In this work, a simple and robust method is proposed for constructing the atomic configuration of a general interface and dislocation structures, under the condition that the interface or the cut of the dislocation is virtually free of interstitial and vacancy. Examples of its applications to a dislocation helix and heterostructure of the precipitate interface are presented, showing the capacity and robustness of the present method.