How to construct the Hamiltonian matrix? I'm trying to understand if there's a more systematic approach to build the matrix associated with the Hamiltonian in a quantum system of finite dimension. For example, I know that for the ammonia molecule (which has two states based on the position of the nitrogen), it should be:
$$ 
\begin{pmatrix}
 E & -A \\
 -A & E
\end{pmatrix}
$$
but the explanation tends to be just "based on symmetry". Or another example that we did with a cyclobutadiene molecule (the four states correspond to a $\pi$ electron on each of the four carbons), the Hamiltonian matrix was given as:
$$
\begin{pmatrix}
 0 & b & 0 & b  \\
 b & 0 & b & 0  \\
 0 & b & 0 & b  \\
 b & 0 & b & 0  \\
\end{pmatrix}
$$
Again, it makes sense based on symmetry, but I was wondering if there's an actual systematic approach to this, or if it's just "feeling".
 A: In general this is a hard problem and physical hamiltonians are usually far more complicated, infinite-dimensional objects. For the cases you mention and other simple ones one can often assume the system to be in (superpositions of) a finite number of states. This brings the dimension of the hamiltonian matrix down to the finite size of your basis, but it still could be anything, provided it's hermitian.
In general, the procedure one should (in principle) do is to list the relevant physical interactions, formulate the corresponding operators, and calculate the matrix elements as the relevant inner products.
In the examples you mention, the symmetry of the problem provides additional constraints on what the hamiltonian's matrix can look like, reducing the number of parameters involved. Thus one can equate certain matrix elements to each other or to zero, but these considerations can never provide the actual numbers, so at least one number - such as the $b$ in your example - remains indeterminate and must be either calculated or measured through experiment. This is reasonable enough as one can often say a lot about the structure of the resulting eigenstates without actually having the parameters (and if there's only one then all it does is provide an energy scale without affecting the structure).
A: There is definitely a systematic way to compute the elements of a Hamiltonian matrix. If you have some set of basis functions $\{ \phi_i \}$ (these are the "orbitals" in case of atomic/molecular systems) then the elements of the Hamiltonian are given by $H_{ij} = \langle \phi_i |H| \phi_j \rangle$ (it may be be more complicated than this, but this expression applies for the purpose of this question). How this matrix looks exactly, depends on your approximation method. The Hamiltonian you show in your example for butadiene is for the simplest possible approximation, the (pi-electron) Huckel method (http://en.wikipedia.org/wiki/H%C3%BCckel_method). This method was used in quantum chemistry in the 60's, before we had powerful computers. In the Huckel butadiene Hamiltonian, only the $p_z$ orbitals are being taken into account; the energy of the diagonal elements $H_{ii} = \langle p_i |H| p_i \rangle$ is set as a reference level (to zero) for simplicity. The off-diagonal elements are $b = \langle p_i |H| p_j \rangle$; interactions between orbital that are not adjacent to each other are ignored (set to zero). 
Thus, for the simple Huckel method your Hamiltonian matrix is given by the adjacency matrix (http://en.wikipedia.org/wiki/Adjacency_matrix) of the graph of your molecule (it is used only for $\pi$-electron systems). 
This book available for free from Caltech's Library Service http://authors.library.caltech.edu/25020/ is old, but it explains perfectly and in simple terms the Huckel method and the use of symmetry to simplify calculations. It explains in detail how to build the Hamiltonian of butadiene and should clarify your doubts. Keep in mind that the pi-electron Huckel's method is the simplest possible method and is, in fact, unphysical as it does not uses antisymmetric wavefunctions (necessary for electronic (or, in fact, any fermionic) wavefunctions). Nowdays, Huckel's method is used only for educational purposes.
In general, the Hamiltonian for a molecular system may be very complicated to calculate and computers are used for these purposes ($e.g.$ computational quantum chemistry); obviously, a computer computer needs a completely systematic method to compute the Hamiltonian (it can't certainly do that "by feeling"). 
