# Where in the source code is the density built?

**URL:** <https://discuss.avogadro.cc/t/where-in-the-source-code-is-the-density-built/3747>\
**Category:** General Discussion\
**Created:** [March 16, 2022, 7:05pm UTC](https://discuss.avogadro.cc/t/where-in-the-source-code-is-the-density-built/3747 "2022-03-16T19:05:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ser3na](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/s/e19b73/32.png) [@ser3na](https://discuss.avogadro.cc/u/ser3na)\
**Post date:** [March 16, 2022, 7:05pm UTC](https://discuss.avogadro.cc/t/where-in-the-source-code-is-the-density-built/3747/1 "2022-03-16T19:05:32Z")

</div>

Avogadro can plot densities out of molden files. An electron density is the square of two vectors of molecular orbitals. I was wondering where in the source code the electron density is built such that I am able to tinker around with how this is done. Specifically I am looking to replace certain d-orbitals in one of the MO vectors iff in the other MO vector is a p-orbital, etc. I’d imagine there to be a big loop structure somewhere in the source code where it is looped over all GTOs but I didn’t find it. If I have that, recompiling it and running it should be doable.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [March 16, 2022, 10:23pm UTC](https://discuss.avogadro.cc/t/where-in-the-source-code-is-the-density-built/3747/2 "2022-03-16T22:23:25Z")

</div>

See, for example in Avo2:

> <https://github.com/OpenChemistry/avogadrolibs/blob/09d379440fe0c449fcb967f64c2b4118cf5995c7/avogadro/core/gaussiansettools.cpp#L82>

---

<div class="post-metadata">

**Author:** ![system](https://discuss.avogadro.cc/uploads/default/original/1X/93fe5a56d10b304e678127e54139c28cde211662.png) [@system](https://discuss.avogadro.cc/u/system)\
**Post date:** [March 21, 2022, 9:25pm UTC](https://discuss.avogadro.cc/t/where-in-the-source-code-is-the-density-built/3747/3 "2022-03-21T21:25:55Z")

</div>

Closed on March 21, 2022, 9:25pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
