{"action":"created","issue":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/216","repository_url":"https://api.github.com/repos/quantumlib/OpenFermion","labels_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/216/labels{/name}","comments_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/216/comments","events_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/216/events","html_url":"https://github.com/quantumlib/OpenFermion/issues/216","id":299557534,"number":216,"title":"orbital reordering in FermionOperator class","user":{"login":"conta877","id":23045820,"avatar_url":"https://avatars2.githubusercontent.com/u/23045820?v=4","gravatar_id":"","url":"https://api.github.com/users/conta877","html_url":"https://github.com/conta877","followers_url":"https://api.github.com/users/conta877/followers","following_url":"https://api.github.com/users/conta877/following{/other_user}","gists_url":"https://api.github.com/users/conta877/gists{/gist_id}","starred_url":"https://api.github.com/users/conta877/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/conta877/subscriptions","organizations_url":"https://api.github.com/users/conta877/orgs","repos_url":"https://api.github.com/users/conta877/repos","events_url":"https://api.github.com/users/conta877/events{/privacy}","received_events_url":"https://api.github.com/users/conta877/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-23T00:23:58Z","updated_at":"2018-02-23T17:32:05Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"We would like to add a function to FermionOperator class that reorders the orbitals as\r\n0,1,2,3,4,5,... -> 0,2,4,...,1,3,5... \r\n(from updownupdown... to upupupupdowndowndown)\r\ntwo ways we can do this:\r\n\r\n1) just writing a function that takes in a FermionOperator and spits out a reordered FermionOperator. which is what I did to begin with but @msteudtner raised the following concern:\r\nthe FermionOperator does not know its order inherently and a user may end up adding/multiplying two differently ordered FermionOperators :scream_cat: \r\n\r\n2) we can make it a class method and let the FermionOperator know its order. This way it can check if its being added/multiplied with a another FermionOperator with the same order and if not - raises an error. \r\nThis seems to be the _right_ way of doing it to me but it would require overloading basic class methods. (unless there is some magic trick we can pull off :fireworks:)"},"comment":{"url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/comments/368080622","html_url":"https://github.com/quantumlib/OpenFermion/issues/216#issuecomment-368080622","issue_url":"https://api.github.com/repos/quantumlib/OpenFermion/issues/216","id":368080622,"user":{"login":"kevinsung","id":4296166,"avatar_url":"https://avatars1.githubusercontent.com/u/4296166?v=4","gravatar_id":"","url":"https://api.github.com/users/kevinsung","html_url":"https://github.com/kevinsung","followers_url":"https://api.github.com/users/kevinsung/followers","following_url":"https://api.github.com/users/kevinsung/following{/other_user}","gists_url":"https://api.github.com/users/kevinsung/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinsung/subscriptions","organizations_url":"https://api.github.com/users/kevinsung/orgs","repos_url":"https://api.github.com/users/kevinsung/repos","events_url":"https://api.github.com/users/kevinsung/events{/privacy}","received_events_url":"https://api.github.com/users/kevinsung/received_events","type":"User","site_admin":false},"created_at":"2018-02-23T17:32:05Z","updated_at":"2018-02-23T17:32:05Z","author_association":"COLLABORATOR","body":"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?"}}
{"actor":{"display_login":"kevinsung"}}