void Wfcgrid::update_potential_1D(Hamiltonian& ham){ /** \brief Update the Hamiltonian for 1D grid \param[in,out] ham The Hamiltonian object. The internal state of the object will be updated Eventually, it will correspond to that of the last point on the grid. Here, we use this Hamiltonian object only as the functor (it defines how to compute potential and couplings), but we don't care about the final state of the ham variable. The results for each point of the grid will be saved internally in H matrix. This function recomputes the Hamiltonian for all points working in atomic units: hbar = 1 */ vector<double> q(1, 0.0); // Precompute H, d_ij, ... along grid for(int nx=0;nx<Nx;nx++){ // For all r points of the grid compute local(potential energy) part q[0] = real(X->M[nx]); ham.set_q(q); ham.compute(); for(int nst=0;nst<nstates;nst++){ for(int nst1=0;nst1<nstates;nst1++){ H[nst][nst1].M[nx] = ham.Hvib(nst, nst1); }// for nst1 }// for nst }// for nx }// update_potential_1D