We study the dynamics of a Bose-Einstein condensate in a double-well p
otential in the two-mode approximation. The dissipation of energy from
the condensate is described by the coupling to a thermal reservoir of
noncondensate modes. As a consequence of the coupling, the self-locke
d population imbalance in the macroscopic quantum self-trapping decays
away. We show that a coherent state predicted by spontaneous symmetry
breaking is not robust and decoheres rapidly into a statistical mixtu
re due to the interactions between condensate and noncondensate atoms.
However, via stochastic simulations we find that with a sufficiently
fast measurement rate of the relative phase between the two wells the
matter wave coherence is established even in the presence of the decoh
erence.