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 a bug in add two bond lists. #618

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

0ut0fcontrol
Copy link
Contributor

@0ut0fcontrol 0ut0fcontrol commented Jun 30, 2024

after adding two bond list, merged_bond_list has wrong _max_bonds_per_atom.

import numpy as np
import biotite.structure as struc
bond_list1 = struc.BondList(2, np.array([(0,1)])) # max_bond_per_atom=1
bond_list2 = struc.BondList(3, np.array([(0,1),(0,2)])) # max_bond_per_atom=2
added_list = bond_list1 + bond_list2

print(f"{added_list._max_bonds_per_atom=}")

bonds, types = added_list.get_bonds(2)
print(f"{bonds.tolist()=} {types.tolist()=}")

print(f"{added_list.as_array().tolist()=}")

# output values:
# added_list._max_bonds_per_atom=1   (wrong, expected value is 2)
# bonds.tolist()=[3] types.tolist()=[0] (wrong, expect 2 bonds)
# added_list.as_array().tolist()=[[0, 1, 0], [2, 3, 0], [2, 4, 0]] (right)


Copy link
Member

@padix-key padix-key left a comment

Choose a reason for hiding this comment

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

Nice find! This is definitely a typo from my side.

This looks ready to merge from my side, but with the new PR policy of the new governance I will leave the PR open for 48 hours.

@padix-key padix-key merged commit 79568bb into biotite-dev:master Jul 2, 2024
20 checks passed
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.

None yet

2 participants