Comments (14)
from openfermion.
Hi @jarrodmcc
We want to relabel the indices.
Maybe to highlight a bit the relevance of this problem:
Let's say we have a molecule with spatial orbitals labeled ( A, B, C, ... ). The multiplicity of the spin will give you a spin-up version of A, let's call it A0, and a spin-down version of A, called A1. Similar for all other orbitals.
Now in OpenFermion, we consider (when we talk about a Fermion basis state) that it is generated by creation operators like in the following example:
a^{+}_0 a^{+}_1 a^{+}_2 a^{+}_3 ... |vac> .
Here the indices (0, 1, 2, 3, ... ) are short for the labels (A0, A1, B0, B1 , ... ).
That's a good choice: in Jordan-Wigner transform, Hubbard-like terms will probably be local i. e. ~ Z2 Z3 .
However: hopping terms from e.g. A0 to C0 will run over some orbitals with opposite spin, so here yield operators ~ X0 Z1 Z2 Z3 X4.
In arXiv:1403.1539 it is argued that one can save gates if we switch the ordering to
(A0, B0, C0, ... A1, B1, C1, ... ). Its true that the same hopping is then ~ X0 Z1 X2.
from openfermion.
I am not a big fan of increasing the complexity of FermionOperator for this purpose. So I would vote against any solution that involves letting FermionOperator "know" its order. While it is conceivable that users could make the mistake mentioned in (1) by @conta877 , I don't have a lot of sympathy for such users. If one reorders FermionOperator A but not FermionOperator B and then adds them, that's sort of their fault (from my perspective). One should never need to reorder until immediately before mapping to qubits. In that sense, this problem should not be such a concern.
from openfermion.
I agree with Ryan. Right now our approach is that users can specify the spin-indexing in functions that generate Hamiltonian models; the default is the even-odd scheme, but you can also specify other schemes (right now this is true for the functions in hamiltonians/_special_operators.py
but #217 makes this true for Hubbard and mean-field as well). @conta877 @msteudtner is this approach is good enough for your purposes?
from openfermion.
Would it perhaps be more practical to define a function somewhere that takes a FermionOperator and the number of modes as input and outputs the reordered FermionOperator (+ a function to undo this)?
The advantage would be that you wouldnt need to define it into every model, also not for any model in the future. Furthermore it allows me to do this reordering to a custom Hamiltonian. The disadvantage would be though, that it is faster to do this when creating a Hamiltonian rather than going over every index again afterwards.
What do you think ?
from openfermion.
Do you have an example of a situation where you would want to use different spin-indexing schemes for different parts of the computation? If not, then I think it's better to just initialize all of your FermionOperators using the indexing scheme that you intend to use.
I just noticed that the even-odd scheme is hard-coded into the MolecularData data structure, but I think we can change that too.
from openfermion.
Actually, if we could build in a 'half up'-option for the molecules, I would be deeply satisfied.
from openfermion.
Sure, this should be fairly straightforward. I think this is a good solution.
from openfermion.
So we are allowed to embed it into molecularData instead of a separate function? maybe initialize with a half_up = bool toggle?
from openfermion.
from openfermion.
Yes I think that is okay. @jarrodmcc or @kevinsung do you have any specific thoughts about that?
from openfermion.
I think a boolean toggle to indicate which spin-indexing scheme to use is fine.
from openfermion.
from openfermion.
@msteudtner @conta877 a while back I implemented something that can generically reorder fermionic modes in OpenFermion-ProjectQ. But looking at the discussion you might not need it after all :)
https://github.com/quantumlib/OpenFermion-ProjectQ/blob/master/openfermionprojectq/_ffft.py#L242 has swap_adjacent_fermionic_modes
, the other half you'd need is some of the parallel bubble sort routines in OpenFermion-ProjectQ/_parallel_bubble_sort.py. Let me know if you have any questions.
from openfermion.
Related Issues (20)
- Help with one-body and two-body coefficients for orbital removal
- UHF energy with openfermion HOT 1
- scipy > 1.9.3 breaks QuarticFermionicSimulationGate decompose method. HOT 5
- Incorrect Bounds on Trotter Error
- Incorrect formula to calculate required Trotter steps HOT 1
- Resource estimation code not tested as part of the CI
- Should move to black for formatting.
- Why does MajoranaOperator not subclass SymbolicOperator? HOT 1
- Some inconsistencies in molecular single factorization costings HOT 1
- Inconsistencies in the double factorized chemistry resource estimate costing function
- 91 tests fail HOT 7
- Nightly tests are broken HOT 1
- slight modification to function generate_hamiltonian ?
- Operation between MajoranaOperator and numbers? HOT 5
- QuadraticFermionicSimulationGate tests fail with cirq == 1.3.0 HOT 5
- Hubbard model notebook is flaky
- Trotter evolution time may be off by a factor of 2 HOT 2
- 1 test fails HOT 1
- get_sparse_operator fails on non-simplified QubitOperators
- Bad behavior when working with sympy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openfermion.