Skip to content
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

Fix normalisation in ring of atoms #750

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

HaroldErbin
Copy link
Contributor

The original formulas was normalized using np.tan(np.pi / L). However, this is not correct, as can be checked by computing the normalization between the distances between the atoms (one does not get R_interatomic).

Here is a quick code to show the issue:

import numpy as np


def setup_coords(L, R_interatomic, fn=np.sin):

    coords = (
        R_interatomic
        / (2 * fn(np.pi / L))
        * np.array(
            [
                (np.cos(theta * 2 * np.pi / L), np.sin(theta * 2 * np.pi / L))
                for theta in range(L)
            ]
        )
    )

    distances = np.linalg.norm(coords - np.roll(coords, shift=1, axis=0), axis=1)

    return distances


L = 5
R_interatomic = 1

print("sin:", setup_coords(L, R_interatomic, fn=np.sin))
print("tan:", setup_coords(L, R_interatomic, fn=np.tan))

which gives

sin: [1. 1. 1. 1. 1.]
tan: [0.80901699 0.80901699 0.80901699 0.80901699 0.80901699]

The original formulas was normalized using np.tan(np.pi / L). However,
this is not correct, as can be checked by computing the normalization
between the distances between the atoms (one does not get
R_interatomic).
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Collaborator

@HGSilveri HGSilveri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this @HaroldErbin , LGTM!

@HGSilveri HGSilveri merged commit 956af97 into pasqal-io:develop Oct 14, 2024
9 checks passed
@HaroldErbin HaroldErbin deleted the doc-fix-circle branch October 14, 2024 14:20
@HGSilveri HGSilveri mentioned this pull request Oct 17, 2024
HGSilveri added a commit that referenced this pull request Oct 18, 2024
**Main changes**:
- Add layout restricting parameters to BaseDevice (#751) 
- Incorporate automatic layout generation in Register (#753) 

**Fixes**:
- Fix rounding error in RampWaveform (#747) 
- Fix normalisation in ring of atoms (#750)
- Improve the NoiseModel unused parameters warning message (#752)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants