A computational model has been developed which describes the structure of the pyroxene mineral diopside, CaMgSi2O6, at the atomic level. The best model for the one-dimensional silicate chains permits all bond angles and the bond distances along the chain to vary. The crystal energy of the model is calculated from Coulomb, near-neighbor repulsion, bond-angle bending, and bond stretching terms. Minimizing this energy with respect to 16 structural variables, including the lattice parameters, yields a structure which reproduces the observed one reasonably well. Elastic constants were calculated which also agree well with experiment. Calculations for the model have been repeated at a simulated pressure of 50 kbar, and pressure derivatives of the elastic constants have been obtained. Calculated pressure derivatives of the lattice parameters, bond distances, and bond angles are in rough agreement with those observed experimentally. Two other models, with more constraints on the silicate chains, did not reproduce the elastic constants satisfactorily.