Computational methods and a program to obtain crystal structures that have the perfectly identical diffraction patterns, i.e. structure factors with the same absolute values and the same lattice symmetry are discussed. This is directly related to the uniqueness of solutions in crystal structure determination of single-crystal/powder-crystal samples from diffraction data. In order to solve the problem, it is necessary to solve a system of quadratic equations. The framework of positive-semidefinite programming is used herein to solve the system efficiently.