The lattice constants and the symmetry of the lattice determine the position of the diffraction peaks observed along the $2\theta$-scale. The intensity of the diffracton peaks, leaving out increase by accidental or systematic superposition of them, is due to the arrangement within the asymmetric unit, i.e. the motif which -- after application of the symmetry operators (centres of inversion, proper axes, rotoinversion axes, glide planes, mirror planes) -- builds the unit cell.
So you face the phase problem (as single crystal diffraction analysis does, too). If you do not want to rely on already existing software (like DASH, MAUD, Jana, or FOX to mention a few), you will look up the Rietveld refinement. Beside by the comment by @porphyrin, as shown in this lecture briefly providing some background, the numerous properties of sample and experiment (including their statistics) equally lead me to the recommendation to use software already proven to work. The International Union of Crystallography maintains a software directory, along with -- under their educational umbrella -- the notes of a dedicated workshop about powder diffraction.
Perhaps contacting a local crystallographer may be helpful, too; like via the American Crystallographic Association ACA.