<commit_before>#!/usr/bin/env python

'''
Showing use of the parallelized CCSD with K-point sampling.
'''

import numpy as np
from pyscf import cc
from pyscf.pbc import cc as pbccc
from pyscf.pbc import scf as pbchf
from pyscf.pbc import gto
from pyscf.pbc.tools.pbc import super_cell

nmp = [1, 1, 2]
cell = gto.M(
    unit='B',
    a=[[0., 3.37013733, 3.37013733],
       [3.37013733, 0., 3.37013733],
       [3.37013733, 3.37013733, 0.]],
    mesh=[24,]*3,
    atom='''C 0 0 0
              C 1.68506866 1.68506866 1.68506866''',
    basis='gth-szv',
    pseudo='gth-pade',
    verbose=4
)

# We build a supercell composed of 'nmp' replicated units and run
# our usual molecular Hartree-Fock program, but using integrals
# between periodic gaussians.
#cell = build_cell(ase_atom, ke=50., basis=basis)
supcell = super_cell(cell, nmp)
mf = pbchf.RHF(supcell)
mf.kernel()
supcell_energy = mf.energy_tot() / np.prod(nmp)

mycc = cc.RCCSD(mf)
gccsd_energy = mycc.ccsd()[0] / np.prod(nmp)
eip, wip = mycc.ipccsd(nroots=2)
eea, wea = mycc.eaccsd(nroots=2)<commit_msg>use wrapper to use exxdiv consistently<commit_after>#!/usr/bin/env python

'''
Showing use of the parallelized CCSD with K-point sampling.
'''

import numpy as np
from pyscf.pbc import cc as pbccc
from pyscf.pbc import scf as pbchf
from pyscf.pbc import gto
from pyscf.pbc.tools.pbc import super_cell

nmp = [1, 1, 2]
cell = gto.M(
    unit='B',
    a=[[0., 3.37013733, 3.37013733],
       [3.37013733, 0., 3.37013733],
       [3.37013733, 3.37013733, 0.]],
    mesh=[24,]*3,
    atom='''C 0 0 0
              C 1.68506866 1.68506866 1.68506866''',
    basis='gth-szv',
    pseudo='gth-pade',
    verbose=4
)

# We build a supercell composed of 'nmp' replicated units and run
# our usual molecular Hartree-Fock program, but using integrals
# between periodic gaussians.
#cell = build_cell(ase_atom, ke=50., basis=basis)
supcell = super_cell(cell, nmp)
mf = pbchf.RHF(supcell)
mf.kernel()
supcell_energy = mf.energy_tot() / np.prod(nmp)

# A wrapper calling molecular CC method for gamma point calculation.
mycc = pbccc.RCCSD(mf)
gccsd_energy = mycc.ccsd()[0] / np.prod(nmp)
eip, wip = mycc.ipccsd(nroots=2)
eea, wea = mycc.eaccsd(nroots=2)
{'fraction_non_alphanumeric': 0.13896457765667575, 'fraction_numerical': 0.08991825613079019, 'mean_word_length': 3.6281512605042017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4874803', 'n_tokens_mistral': 1033, 'n_tokens_neox': 910, 'n_words': 236}