This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from itertools import zip_longest | |
class Bijection(object): | |
def __init__(self, fwd, rev, sizes): | |
""" | |
Bijection holds forward maps and backwards maps | |
:param fwd: forward mapping function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyscf import lib | |
import numpy as np | |
from pyscf.pbc import gto, dft | |
import os | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
pip install openfermion pyscf openfermionpyscf fqe | |
""" | |
import openfermion as of | |
from openfermionpyscf import run_pyscf | |
import fqe | |
from fqe.openfermion_utils import integrals_to_fqe_restricted | |
def main(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from pyscf import fci, ao2mo, mcscf | |
from pyscf.fci.cistring import make_strings | |
from pyscf import gto, scf | |
from pyscf.fci.cistring import make_strings | |
import pyscf | |
from pyscf.cc.addons import spatial2spin | |
from functools import reduce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
pip install openfermion pyscf openfermionpyscf fqe | |
""" | |
import numpy as np | |
import cirq | |
import openfermion as of | |
from openfermionpyscf import run_pyscf | |
import fqe | |
from fqe.openfermion_utils import integrals_to_fqe_restricted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Utility to convert pyscf mean-field objects to RDMs | |
""" | |
import numpy as np | |
from pyscf import gto, scf, ao2mo | |
from functools import reduce | |
def rhf_to_v2rdm(mf: scf.RHF, rdm_constraints: str): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyscf import gto, scf, mcscf, ao2mo, fci | |
import pyscf | |
from pyscf.fci.cistring import make_strings | |
import numpy as np | |
import openfermion as of | |
from openfermion.chem.molecular_data import spinorb_from_spatial | |
import fqe | |
from fqe.openfermion_utils import integrals_to_fqe_restricted | |
from functools import reduce | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Use pyscf's cell infrastructure to define computational cell and grids | |
Implement Hamiltonian and SCF cycle | |
""" | |
from itertools import product | |
import warnings | |
import numpy as np | |
from pyscf.pbc import gto, scf | |
# divide by this quantity to get value in Bohr (atomic unit length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
from itertools import product | |
def read_dr_li_data(ofile): | |
with open(ofile, 'r') as fid: | |
text = fid.read().strip().split('\n') | |
file_name = text[0] | |
nelectrons = int(text[1].split('=')[-1]) | |
norb = int(text[2].split('=')[-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
from itertools import product | |
import openfermion as of | |
def read_dr_li_data(ofile): | |
with open(ofile, 'r') as fid: | |
text = fid.read().strip().split('\n') | |
file_name = text[0] | |
nelectrons = int(text[1].split('=')[-1]) |