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

BUG: wrong calculation or gyration tensor #78

Closed
kay-ro opened this issue Oct 25, 2024 · 1 comment · Fixed by #80
Closed

BUG: wrong calculation or gyration tensor #78

kay-ro opened this issue Oct 25, 2024 · 1 comment · Fixed by #80
Assignees
Labels
bug Something isn't working module: cluster module: pbc release: patch Issues that need to be addressed in a patch release status: ready for review Needs to be reviewed

Comments

@kay-ro
Copy link
Member

kay-ro commented Oct 25, 2024

Description:

As described in discussion #61 , the gration_tensor gives greatly different results for the radius of gyration than the direct calculation of the radius_of_gyration.

Code for reproduction:

path="gyrationstuffex/"
traj= amep.load.traj(path, reload=False)
#need masses for gyration tensor
mass = 5e-2
masses = np.empty(traj[0].n(), dtype=np.double)
masses.fill(mass)

coords=traj[-1].coords()
box_boundary=traj[-1].box
clusters, ids=amep.cluster.identify(coords, box_boundary)
clusters = clusters[-10:]
print(box_boundary)

# sanity check radius of gyration first
gts = amep.cluster.gyration_tensor(coords, box_boundary, masses, pbc=True, clusters=clusters)
rogs = amep.cluster.radius_of_gyration(coords, box_boundary, masses, pbc=True, clusters=clusters)
for i, cluster in enumerate(clusters):
    print(i)
    print("how many particles",len(cluster))
#     print(cluster)
    print("gyration tensor\n",gts[i])
    ev = np.linalg.eigvals(gts[i])
#     print("ev", ev)
#     print("sum ev",np.sum(ev))
    print("sqrt(sum(ev))*0.05", np.sqrt(np.sum(ev))*0.05)
    print("sqrt(sum(ev))", np.sqrt(np.sum(ev)))
    print("rgs", rogs[i])
#     print("sqrt(sum(ev))-rgs",np.sqrt(np.sum(ev))-rgs[i])

Error message:

No response

Python and AMEP versions:

1.0.3

Additional information:

gyrationstuffex.zip
The issue seems to be with the calculation of the distances between particles in gyration_tensor. The calculation with pbc_diff returns wrong results.
Screenshot from 2024-10-25 14-01-10

How did you install AMEP?

None

@kay-ro kay-ro added bug Something isn't working release: patch Issues that need to be addressed in a patch release status: in progress Someone is working on this issue module: cluster module: pbc labels Oct 25, 2024
@kay-ro kay-ro added this to the release v1.1.0 milestone Oct 25, 2024
@kay-ro
Copy link
Member Author

kay-ro commented Oct 25, 2024

underlying issue is described in issue #79

@kay-ro kay-ro added status: ready for review Needs to be reviewed and removed status: in progress Someone is working on this issue labels Oct 25, 2024
@kay-ro kay-ro linked a pull request Oct 25, 2024 that will close this issue
@kay-ro kay-ro closed this as completed Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module: cluster module: pbc release: patch Issues that need to be addressed in a patch release status: ready for review Needs to be reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants