Nucleic acid parameters are developed for the all-atom empirical energy function used in the CHARMM program. The parameters were determined by use of results for model compounds, including the nucleic acid bases, dimethyl phosphate and anionic and dianionic methyl phosphate, ribose, and deoxyribose. Internal parameters (bond length, bond angle, Urey-Bradley, dihedral, and improper dihedral terms) were chosen to reproduce geometries and vibrational spectra from experimental crystal structures, infrared and Raman spectroscopic data, and ab initio calculations. Interaction parameters (electrostatic and van der Waals terms) were derived from 6-31G* ab initio interaction energies and geometries for water molecules bonded to polar sites of the model compounds and from the experimentally measured gas phase Watson-Crick base pair energies and geometries, base heats of sublimation, and experimental and 6-31G* ab initio dipole moments. Emphasis was placed on a proper balance between solvent-solvent, solvent-solute, and solute-solute interactions with reference to the TIP3P water model. Tests on nucleic acid base crystals showed satisfactory agreement between calculated and experimental values for the lattice parameters, nonbonded interactions, and heats of sublimation. Base pair variations in stacking energies are consistent with experiment and ab initio calculations. Further testing was performed on GpC and B-DNA dodecamer crystal structures, including water molecules and counterions. Simulations of these systems revealed the parameters to accurately reproduce Watson-Crick base pairing, internal geometries including the backbone dihedrals, sugar puckering and glycosidic linkages, and the hydration of the nucleic acids. The present parameters should be useful for modeling and simulation studies of nucleic acids, including both structural and energetic analysis. Further, they provide a parameter set that is consistent with the protein parameters in CHARMM so that complexes between proteins and nucleic acids can be modeled. A list of the parameter values is included in an Appendix (supporting information). In the test simulations, a number of interesting results were obtained. Significant anharmonicity is present due to nonbonded terms in certain bond angles (P-O-C) of the phosphate group that may play a role in the observed variation of these angles. There is a wide range of stacking energies of the bases of B-DNA due to repulsive electrostatic interactions. The motion of the two strands appears to be correlated for bases involved in Watson-Crick interactions while there is a lack of correlation for the sugar and phosphate moieties. The importance of conformational substates in the B-DNA dodecamer is pointed out. Comparisons with nucleic acid simulations made with other energy functions show the importance of the parameters in determining the internal geometry and the interactions with the surroundings. A summary of these results is given in the concluding section.