10
$\begingroup$

I am looking for a free code for Hartree-Fock calculations in solids especially a code optimized (quite fast) compared to Pyscf which is quite slow and unstable. I do not have any clue to explain why HF so slow in solids compared to molecular systems.

$\endgroup$
11
  • 3
    $\begingroup$ Hartree-Fock calculations scale quadratically with the number of k points. For molecules you only have one of those (if you see them in a Bloch theorem context at all). For solids you have many. This is, why it takes much longer. Also for molecules you often use localized basis sets, while for solids, systematically extandable basis sets are much more common. Local basis sets may have a considerable performance advantage here. $\endgroup$ Apr 10 at 8:51
  • $\begingroup$ Thank you for the answer, indeed difficult to see a Bloch theorem for molecule but it is very clear. There are some programs that use localized basis sets for solids precisely for the performance at the expense of the accuracy (Siesta, Openmx, Crystal etc.). I am looking for something like that for HF using a gto basis sets or similar. $\endgroup$
    – M06-2x
    Apr 10 at 9:35
  • 1
    $\begingroup$ I want to calculate the bandstructures using a simple personal computer in a reasonable time with very few number of atoms per unit cell (4 maximum). I tried Pyscf the calculation took more than 10 hours and output an error. I also used a LAPW code but the calculation could take days. $\endgroup$
    – M06-2x
    Apr 10 at 10:15
  • 1
    $\begingroup$ The band structure is probably very demanding with respect to the number of k-points, even if you perform a Wannier interpolation, which I assume you plan. On the other hand it may be less demanding with respect to the basis set size. Whatever code you use in the end the calculation will be demanding for your workstation. I suggest to try out a calculation with a strongly reduced basis set size first and then increase it slowly to see what you actually need for a converged band structure. $\endgroup$ Apr 10 at 10:50
  • 1
    $\begingroup$ HF is extremely inefficient for the calculations of solids, due to the nonlocal nature of the method. Your best guess is codes that implement local basis sets together with some cutoff scheme to handle the non-locality and sophisticated symmetry treatments to spread up what you can. Good luck. $\endgroup$
    – Greg
    Apr 10 at 12:58

2 Answers 2

8
$\begingroup$

Quantum ESPRESSO (QE) is a plane wave basis and various types of pseudopotential-based density functional theory (DFT) code. The PWscf package in it can perform both DFT and Hartree-Fock calculations. It is completely free. It also has a nice user forum here. It is written in Fortran, so it is quite fast and stable too. So it fulfills all your requirement I believe.

However, it doesn't have out-of-the-box support for HF calculation, you can perform such calculations with some tweaking as described here. What I understood is that you have to set the flag exx_fraction=1 in the &SYSTEM namelist of QE input file. Here, by setting exx_fraction=1, you are treating HF as a hybrid functional with 100% of exchange and 0% of other exchange-correlation contributions. In the QE chatroom of Matter Modeling SE, you will find some example input files with hybrid functional.

Note that, as one of the QE authors mentioned here, plane waves are probably not the most efficient basis set to implement non-local (Fock) exchange.

Lastly, see this List of quantum chemistry and solid-state physics software. Here, you will find links to many codes that have HF capability. Some of them are also available free of charge for academic use such as CASTEP. You can also filter codes from that list that are free, have HF functionality, and use other basis sets than plane waves.

$\endgroup$
7
  • $\begingroup$ Thank you very much I had not tried pwsf for this job, I normally prefer a LCAO basis sets than a plane wave basis sets for a matter of speed for this specific task. I wanted a LCAO code (OPTIMIZED for HF) may be not in the simple Wikipedia list. $\endgroup$
    – M06-2x
    Apr 10 at 10:24
  • 1
    $\begingroup$ Congratulations on reaching 1000! $\endgroup$ Apr 10 at 14:09
  • $\begingroup$ Thanks a lot, @NikeDattani. From that list, I found the following codes that are free, with LCAO basis set, and capable of performing HF calculation: FreeON, Dalton, DIRAC, COLUMBUS. $\endgroup$ Apr 10 at 19:10
  • $\begingroup$ @AbdulMuhaymin those are some of the many free codes that can do HF in an LCAO basis (and those ones are not even nearly as popular as PySCF, OpenMolcas, CFOUR, NWChem, Psi4, GAMMES, MRCC, etc.) but most of these codes won't work for "solids", which is the key word in the title. PySCF works on solids, but the OP basically said it was too slow for OP's purposes. $\endgroup$ Apr 10 at 21:44
  • 2
    $\begingroup$ I think what PySCF has, that the other software that we mentioned doesn't have, is the ability to do HF(PW). Almost all of those programs that we mentioned, can do DFT(LCAO). As for when it's preferred to use HF/DFT(LCAO) vs HF/DFT(PW), it might be the subject of an excellent new question on the main site! The problem with LCAO for solids is computational expense, but I think the benefit is accuracy and the potential to systematically improve the result: Once you do a DFT calculation for a specific fucntional, you can't improve it much, but for HF there's post-HF methods that converge to exact $\endgroup$ Apr 11 at 1:11
6
$\begingroup$

I am looking for a free code for Hartree-Fock calculations in solids especially a code optimized (quite fast) compared to Pyscf which is quite slow and unstable.

PySCF is in general one of the fastest codes available. It is also the only free one.

If you really want to do periodic Hartree-Fock calculations on solids, you should look into the CRYSTAL program, which is, however, not free ($2000 for a license). However, from what I hear from my colleagues, CRYSTAL is well worth the license cost since it is unparallelled in its use of symmetry to reduce the cost of Hartree-Fock calculations, especially.

I do not have any clue to explain why HF so slow in solids compared to molecular systems.

Because you are comparing two entirely different things. For a molecule, the Gaussian basis set is simply the atomic basis $$ \chi_{\mu}({\bf r}) = \phi_\mu({\bf r}-{\bf R}_\mu) $$ where $\chi_{\mu}$ is the $\mu$th molecular basis function and $\phi_\mu$ is the corresponding Gaussian basis function centered on ${\bf R}_\mu$.

In contrast, in a periodic system you have to satisfy Bloch's theorem $$ \psi_{\boldsymbol{k}}(\boldsymbol{r}+\boldsymbol{g})=u_{\boldsymbol{k}}(\boldsymbol{r})e^{i\boldsymbol{k}\cdot\boldsymbol{g}}, $$ which arises from translational invariance, and where $u_{\boldsymbol{k}}(\boldsymbol{r})$ is a periodic function. These functions are thereby expanded in a periodic basis set $$ \chi_{\mu}(\boldsymbol{r};\boldsymbol{k})=\sum_{\boldsymbol{g}}e^{i{\bf k}\cdot\boldsymbol{g}}\phi_{\mu}(\boldsymbol{r}-\boldsymbol{R}_{\mu}-\boldsymbol{g}) $$ where the sum over $g$ runs over the grid points. This feature also propagates to all the other parts of the calculation. For example, to calculate the overlap integrals, you have to sum over an infinite series of cells while in a molecular calculation you only calculate the integrals over one copy of the system. This has a huge impact on the evaluation of Coulomb and exchange integrals which are needed for Hartree-Fock calculations. Periodic and molecular calculations are different types of beasts altogether! The former always has an infinite number of atoms, and has to evaluate more terms than the latter.

I would like to point out that periodic calculations are not as simple to run as molecular calculations, since you have many more choices to make, first and foremost the k-point grid sampling and the truncation of Coulomb and exchange sums. PySCF also has several algorithms for performing periodic calculations, which don't have the same computational costs. It sounds to me like you could improve the runtimes a fair bit by a judicious choice of the algorithm and parameters.

$\endgroup$
1
  • 2
    $\begingroup$ Thanks for this consice answer. If Pyscf was suitable I would not ask the question because I have some experience with this code. Crystal seems to be the best but is not free. The last part was already discussed to reduce the number of k-points and it works fine, but I wanted a code more optimized with works with a higher density of k-points. $\endgroup$
    – M06-2x
    Apr 11 at 7:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .