JohanSchott / impurityModel

Calculate many-body states of an impurity Anderson model and spectra (e.g. XPS, XAS, RIXS, NIXS)
MIT License
22 stars 2 forks source link

Add unit-tests to applyOp function #53

Closed JohanSchott closed 3 months ago

JohanSchott commented 3 months ago

Add unit-tests to the function applyOp in impurityModel/ed/finite.py.

applyOp is a cornerstone of this repo. It applied an operator on a multi-configurational state and returns the resulting multi-configurational state.

The input operator can be anything (following the syntax: dict(process: process_amplitude))

The input multi-configurational state can be anything (following the syntax: dict(product_state: product_state_probability_amplitude))

JohanSchott commented 3 months ago

I'll merge this PR in a couple of days unless someone objects or provide feedback.

johanjoensson commented 3 months ago

This looks good to me. However, I notice that you only use the bytes representation for the product states. Maybe it would be a good idea to test with int and the other representations as well?

JohanSchott commented 3 months ago

Thanks for your review @johanjoensson !

True, only test with bytes.

The current implementation of applyOp can only handle product states in the bytes representation. Does other representations, e.g. int, work in your fork version?

johanjoensson commented 3 months ago

Sorry, I was confused. My version of applyOp also only accepts bytes as well.

JohanSchott commented 3 months ago

Alright!

If it looks good to you, would you like to click the "approve" button?

So I can skip the red and dangerously looking "Merge without waiting for requirements to be met" button: Screenshot 2024-05-21 at 22 36 49