-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Mollist2 as internal system information data structure #103
Conversation
The second commit 9293d9d makes
I've thought of retaining |
In e112ab9 the |
Implement `SpinBosonModel` as a subclass of `MolList2`. Original interface in `HolsteinModel` is removed. Original `SpinBosonModel` in `sbm/sbm.py` is renamed to `SpinBosonDynamics`.
In the build for 4dd41ff I found a performance regression on finite temperature CV DMRG:
After some closer examination, It is concluded the regression is caused by the zero-point energy included in |
Contents of the last three commits:
The new interface generally reduces boilerplate when constructing a new model, and most importantly the new interface is natural and consistent for different model and basis. An example in 1d-Heisenberg.ipynb:
By now the PR is almost complete. I understand the content could be overwhelming. I could introduce the changes in a coding group meeting if necessary. |
It's a rather big update. Thanks, Weitang! |
Now the only problem is the SVD compress test for MPO in |
renormalizer/model/phonon.py
Outdated
self.qbtrunc = qbtrunc | ||
self.base = int(round(n_phys_dim ** (1.0 / nqboson))) | ||
self.hartree = hartree | ||
|
||
if hartree: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove the hartree part?
The Hatree (SCF, TDH) is actually limited to Holstein model.
I think the same calculations could be carried out with DMRG/TD-DMRG with M=1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I think it's OK to remove them.
renormalizer/model/phonon.py
Outdated
@@ -161,7 +154,7 @@ def e0(self): | |||
|
|||
@property | |||
def is_simple(self): | |||
return self.force3rd == (0.0, 0.0) and self.nqboson == 1 and self.omega[0] == self.omega[1] | |||
return self.force3rd == (0.0, 0.0) and self.omega[0] == self.omega[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the force3d is not needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is now only used in TDH module. This feature will be removed along with the module.
renormalizer/mps/mp.py
Outdated
mt.sigmaqn = np.zeros(mt.pdim_prod, dtype=np.int) | ||
else: | ||
mt.sigmaqn = self._get_sigmaqn(idx) | ||
mt.sigmaqn = np.zeros_like(mt.sigmaqn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is use_dummy_qn
necessary or not now? we could set sigmaqn=0 to achieve the same purpose, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. I'll try to remove this to see if it is necessary or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be more consistent to use sigmaqn=0 if not considering the quantum number.
renormalizer/mps/tests/test_mpo.py
Outdated
|
||
|
||
@pytest.mark.parametrize("nsites", [5, 10]) | ||
# More states make MPO representation not efficient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More sites?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly
self.symbol: str = symbol | ||
# replace " + " so that " " can be used to split the symbol ("b^\dagger + b") | ||
# the logic of Op is based on multiplication of symbols. So special treatment on addition is inevitable | ||
self.split_symbol : List[str] = [s.replace("plus", " + ") for s in symbol.replace(" + ", "plus").split(" ")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it is better to replace " + " in defining "b^\dagger + b" with "b^\dagger+b"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this is a possible improvement but I usually prefer b^\dagger + b
in writing LaTeX. In the near future, I don't think the change is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
renormalizer/mps/mpo.py
Outdated
# Construct mapping from easy-to-manipulate integer to actual Op | ||
# There has to be an Identity for the algorithm to work | ||
# even if Identity is not in the table | ||
primary_ops = {0: Op.identity()} | ||
# unique operators with DoF names taken into consideration | ||
# The inclusion of DoF names is necessary fo multi-dof basis. | ||
unique_op: Set[Op] = set(np.array(table).ravel()) | ||
if primary_ops[0] in unique_op: | ||
unique_op.remove(primary_ops[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why Op.identity
is necessary here (restricting the key to be 0).
Though the left-most in_ops
is an identity operator physically, it is technically just a placeholder with qn=0
and corresponds to an additional column np.zeros
attached to op_table
to make the logic more consistent when looping from 0 to N-1.
For example primary_ops = {0:xxx, 1: op.indentity()} will also obtain the correct answer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key could be anything. The problem is that if the operator "identity" is not present in the model, there will be actually no primary_ops
key for the operator "identity". This is not a serious issue because the algorithm still works as you've pointed out, but I feel somewhat unhappy with the situation. I agree that the resulting code is ugly and hard to grasp. I'll clean it up and add a few comments on the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. If you think it is necessary to include operator "identity" in primary_ops
, I think the key should be 0, to be consistent with the first and the last artificial column.
In this commit, the TDH module is removed. The removal of After this PR I think it'll be appropriate to list the obsolete features in the project wiki for future reference. |
I‘m ok with this PR. The qn problem in mpdm could be fixed in the future. |
The outdated CI information sees to be a persisted issue. I'm merging this PR because CI results have been manually checked. |
This the first commit for #100 . The majority of this commit is to use
MolList2
as the only way to construct MPO. NowMpo.__init__
is by default constructing MPOs using the general algorithm. The biggest modification apart from deleting old code is to correct the zero-point energies due to different definitions betweenMolList
andMolList2
. The quasiboson algorithm #25 , chain representation #90 , and hybrid TDH algorithm #61 are removed.Apart from issues mentioned in #100, there are other things that are in the todo list:
MolList2
. Although the algorithm is not necessary I'd like to keep the example. (The example is removed in 5d6b3a9)"e"
to represent spins. (Fixed in 5d6b3a9)These things will be addressed in future commits.
Lastly, I observed that the svd compression test in
test_mp.py
won't pass forMpo
. I have to increase the bond dimension a little bit to let it pass. I tried to figure out why but I best speculation is that svd compression will stick into some local minimum when compressing the newMpo
structure byMolList2
. After all, it is not easy to understand whyMpdm
will work whileMpo
will not, and the distance metric is actually rather strict for large tensor. I'll keep an eye on this though.