Skip to content

Commit

Permalink
minor typos in demo (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
babbush committed Oct 22, 2017
1 parent 152298a commit 0233d10
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
6 changes: 4 additions & 2 deletions docker/README.md
@@ -1,6 +1,8 @@
# Docker setup for OpenFermion and select plugins # Docker setup for OpenFermion and select plugins


This Docker image will help users to install [OpenFermion](https://github.com/quantumlib/OpenFermion) and its available plugins for [ProjectQ](https://github.com/ProjectQ-Framework/ProjectQ), [Psi4](https://github.com/quantumlib/OpenFermion-Psi4), and [PySCF](https://github.com/quantumlib/OpenFermion-PySCF). This Docker image will help users to install [OpenFermion](https://github.com/quantumlib/OpenFermion)
and its available plugins for [ProjectQ](https://github.com/ProjectQ-Framework/ProjectQ),
[Psi4](https://github.com/quantumlib/OpenFermion-Psi4), and [PySCF](https://github.com/quantumlib/OpenFermion-PySCF).
Check out Docker's [website](https://www.docker.com/what-container) that describes what a container image is and why it can be so useful. Check out Docker's [website](https://www.docker.com/what-container) that describes what a container image is and why it can be so useful.
The Docker based installation is extremely robust and runs on any operating The Docker based installation is extremely robust and runs on any operating
system and so is an ideal solution for anyone having difficulty installing system and so is an ideal solution for anyone having difficulty installing
Expand Down Expand Up @@ -60,7 +62,7 @@ docker build -t openfermion_docker .
where "openfermion_docker" is just an arbitrary name for our docker image. where "openfermion_docker" is just an arbitrary name for our docker image.
What the Dockerfile does is to start from a base image of Ubuntu and install What the Dockerfile does is to start from a base image of Ubuntu and install
OpenFermion, its plugins, and the necessary applications needed for running these OpenFermion, its plugins, and the necessary applications needed for running these
programs. This is a fairly involved installation and will take some time programs. This is a fairly involved setup and will take some time
(perhaps up to thiry minutes depending on the computer). Once installation has (perhaps up to thiry minutes depending on the computer). Once installation has
completed, run the image with completed, run the image with


Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Expand Up @@ -253,7 +253,7 @@ InteractionOperator and InteractionRDM for efficient numerical representations


Fermion Hamiltonians can be expressed as :math:`H=h_0+\sum_{pq} h_{pq} a^\dagger_p a_q + \frac12 \sum_{pqrs} h_{pqrs} a^\dagger_p a^\dagger_q a_r a_s`, where :math:`h_0` is a constant shift due to the nuclear repulsion and :math:`h_{pq}` and :math:`h_{pqrs}` are the famous molecular integrals. Since fermions interact pairwise, their energy is thus a unique function of the one-particle and two-particle reduced density matrices which are expressed in second quantization as :math:`\rho_{pq} = \langle p | a^\dagger_p a_q | q\rangle` and :math:`\rho_{pqrs} = \langle pq | a^\dagger_p a^\dagger_q a_r a_s | rs \rangle`, respectively. Fermion Hamiltonians can be expressed as :math:`H=h_0+\sum_{pq} h_{pq} a^\dagger_p a_q + \frac12 \sum_{pqrs} h_{pqrs} a^\dagger_p a^\dagger_q a_r a_s`, where :math:`h_0` is a constant shift due to the nuclear repulsion and :math:`h_{pq}` and :math:`h_{pqrs}` are the famous molecular integrals. Since fermions interact pairwise, their energy is thus a unique function of the one-particle and two-particle reduced density matrices which are expressed in second quantization as :math:`\rho_{pq} = \langle p | a^\dagger_p a_q | q\rangle` and :math:`\rho_{pqrs} = \langle pq | a^\dagger_p a^\dagger_q a_r a_s | rs \rangle`, respectively.


Because the RDMs and molecular Hamiltonians are both compactly represented and manipulated as 2- and 4- index tensors, we can represent them in a particularly efficient form using similar data structures. The InteractionOperator data structure can be initialized for a Hamiltonian by passing the constant h0h0 (or 0), as well as numpy arrays representing :math:`h_{pq}` (or :math:`\rho_{pq}`) and :math:`h_{pqrs}` (or :math:`\rho_{pqrs}`). Importantly, InteractionOperators can also be obtained by calling MolecularData.get_molecular_hamiltonian() or by calling the function get_interaction_operator() (found in openfermion.utils) on a FermionOperator. The InteractionRDM data structure is similar but represents RDMs. For instance, one can get a molecular RDM by calling MolecularData.get_molecular_rdm(). When generating Hamiltonians from the MolecularData class, one can choose to restrict the system to an active space. Because the RDMs and molecular Hamiltonians are both compactly represented and manipulated as 2- and 4- index tensors, we can represent them in a particularly efficient form using similar data structures. The InteractionOperator data structure can be initialized for a Hamiltonian by passing the constant h0h0 (or 0), as well as numpy arrays representing :math:`h_{pq}` (or :math:`\rho_{pq}`) and :math:`h_{pqrs}` (or :math:`\rho_{pqrs}`). Importantly, InteractionOperators can also be obtained by calling MolecularData.get_molecular_hamiltonian() or by calling the function get_interaction_operator() (found in openfermion.transforms) on a FermionOperator. The InteractionRDM data structure is similar but represents RDMs. For instance, one can get a molecular RDM by calling MolecularData.get_molecular_rdm(). When generating Hamiltonians from the MolecularData class, one can choose to restrict the system to an active space.


These classes inherit from the same base class, InteractionTensor. This data structure overloads the slice operator [] so that one can get or set the key attributes of the InteractionOperator: .constant, .one_body_coefficients and .two_body_coefficients. For instance, InteractionOperator[p,q,r,s] would return :math:`h_{pqrs}` and InteractionRDM would return :math:`\rho_{pqrs}`. Importantly, the class supports fast basis transformations using the method InteractionTensor.rotate_basis(rotation_matrix). But perhaps most importantly, one can map the InteractionOperator to any of the other data structures we've described here. These classes inherit from the same base class, InteractionTensor. This data structure overloads the slice operator [] so that one can get or set the key attributes of the InteractionOperator: .constant, .one_body_coefficients and .two_body_coefficients. For instance, InteractionOperator[p,q,r,s] would return :math:`h_{pqrs}` and InteractionRDM would return :math:`\rho_{pqrs}`. Importantly, the class supports fast basis transformations using the method InteractionTensor.rotate_basis(rotation_matrix). But perhaps most importantly, one can map the InteractionOperator to any of the other data structures we've described here.


Expand Down
60 changes: 30 additions & 30 deletions examples/openfermion_demo.ipynb

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions setup.py
Expand Up @@ -14,6 +14,7 @@


from setuptools import setup, find_packages from setuptools import setup, find_packages



# This reads the __version__ variable from openfermion/_version.py # This reads the __version__ variable from openfermion/_version.py
exec(open('src/openfermion/_version.py').read()) exec(open('src/openfermion/_version.py').read())


Expand All @@ -24,15 +25,13 @@
requirements = open('requirements.txt').readlines() requirements = open('requirements.txt').readlines()
requirements = [r.strip() for r in requirements] requirements = [r.strip() for r in requirements]



setup( setup(
name='openfermion', name='openfermion',
version=__version__, version=__version__,
author='The OpenFermion Developers', author='The OpenFermion Developers',
author_email='help@openfermion.org', author_email='help@openfermion.org',
url='http://www.openfermion.org', url='http://www.openfermion.org',
description=('Open source package for analyzing, compiling and ' description=('The electronic structure package for quantum computers.'),
'emulating quantum algorithms for simulation of fermions.'),
long_description=long_description, long_description=long_description,
install_requires=requirements, install_requires=requirements,
license='Apache 2', license='Apache 2',
Expand All @@ -42,5 +41,4 @@
package_data={ package_data={
'': [os.path.join('src', 'openfermion', 'data', '*.hdf5'), '': [os.path.join('src', 'openfermion', 'data', '*.hdf5'),
os.path.join('src', 'openfermion', 'data', '*.npy')] os.path.join('src', 'openfermion', 'data', '*.npy')]
} })
)

0 comments on commit 0233d10

Please sign in to comment.