The underwater traps of the carnivorous plants of the Utricularia species catch their prey through the repetition of an "active slow deflation followed by passive fast suction" sequence. In this paper, we propose a mechanical model that describes both phases and strongly supports the hypothesis that the trap door acts as a flexible valve that buckles under the combined effects of pressure forces and the mechanical stimulation of trigger hairs, and not as a panel articulated on hinges. This model combines two different approaches, namely (i) the description of thin membranes as triangle meshes with strain and curvature energy, and (ii) the molecular dynamics approach, which consists of computing the time evolution of the position of each vertex of the mesh according to Langevin equations. The only free parameter in the expression of the elastic energy is the Young's modulus E of the membranes. The values for this parameter are unequivocally obtained by requiring that the trap model fires, like real traps, when the pressure difference between the outside and the inside of the trap reaches about 15 kPa. Among other results, our simulations show that, for a pressure difference slightly larger than the critical one, the door buckles, slides on the threshold, and finally swings wide open, in excellent agreement with the sequence observed in high-speed videos.