Simulations to study protein folding and unfolding were performed. The unfolding simulations make use of molecular dynamics and treat an atomic model of barnase in aqueous solvent. The cooperative nature of the unfolding transition and the important role of water are described. The folding simulations are based on a bead model of the protein on a cubic lattice. It is shown for the 27-mer model that a large energy gap between the lowest energy (native) state and the excited states is a necessary and sufficient condition for fast folding.