Skip to content

Instantly share code, notes, and snippets.

View ncrubin's full-sized avatar

Nicholas Rubin ncrubin

View GitHub Profile
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])
@ncrubin
ncrubin / parse_rdms
Created August 17, 2021 19:23
problem between computer and screen?
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])
"""
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)
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
"""
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):
"""
"""
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
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
"""
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():
from pyscf import lib
import numpy as np
from pyscf.pbc import gto, dft
import os
import numpy as np
@ncrubin
ncrubin / tensor.py
Created October 18, 2017 01:39
Tensor object with a basis over ride.
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