Three complete neutron diffraction datasets have been collected for deuterated malonic acid single crystals, DOOC(CD(2))COOD, above (153 K), just below (56 K) and further below (50 K) the low-temperature phase transition (T(c) = 57 K). The structural details obtained for this transition, studied previously solely by spectroscopic and calorimetric techniques, clearly establish its first-order nature. At 153 K, the space group is P\bar 1, Z = 2, Z' = 1. The molecules are packed as linear chains linked end-to-end by asymmetric hydrogen bonds so that the carboxyl groups form cyclic dimers. The deuterons in the carboxyl links are ordered. Neighboring chains are cross-linked through C-D...O hydrogen bonds. Upon cooling through the transition the cell doubles along the a axis. Molecules which are equivalent by symmetry above T(c) become independent below T(c) owing to conformational changes in alternate chains. At 50 K, the space group is P\bar 1, Z = 4, Z' = 2. Thermal motion analysis, using for all three temperatures the same segmented rigid-body model, reveals a large torsional motion around the one COOD group associated with the conformational change. Refinements were carried out on all three datasets with an anharmonic structural model, including higher-order displacement tensors (Gram-Charlier expansion up to fourth order). Only atoms involved in torsional motion exhibit a significant anharmonic component which increases with temperature.