I am trying to find the d-band center of pdos data generated using quantum espresso 6.8. I'm aware that this maybe calculated by the formula:

$$ \frac{\int_{-\infty}^\infty E \cdot \textrm{pdos}(E)dE}{\int_{-\infty}^\infty \textrm{pdos}(E)dE} \tag{1}$$

I tried XMgrace as suggested here but was not able to do it. Is there a way to use this formula using MatLab, or any other software to integrate the pdos curve (maybe a piece of code)? Any help would be appreciated :)

  • 2
    $\begingroup$ if you have E and pdos(E) data, you can use trapz function in matlab to integrate numerator and denominator of equation. mathworks.com/help/matlab/ref/trapz.html $\endgroup$ Feb 5 at 15:26
  • $\begingroup$ That worked. Thank you @pranavkumar $\endgroup$
    – ansonthms
    Feb 6 at 3:05
  • $\begingroup$ @pranavkumar Can you turn that into an answer? $\endgroup$ Mar 2 at 19:17
  • $\begingroup$ @pranavkumar Nike has a good point. If you can provide even a little more detail about this process, an answer is much more visible for future users (and much less likely to disappear than a comment). $\endgroup$
    – Tyberius
    Mar 2 at 20:07

1 Answer 1


Numerical integration for evenly-spaced data can be performed using trapz function in MATLAB. Here infinite integration can assumed to integrate between extrema of data.


Trapezoidal rule of integration

$\int_{a}^{b}f(x)dx=\frac{b-a}{2N}( f(x_{1})+2f(x_{2})...+2f(x_{n})+f(x_{n+1}))$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.