Skip to content

Commit

Permalink
fix c-contigous problem
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Aug 3, 2023
1 parent e4118ca commit 3ba0a6d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MolecularNodes/assembly/mmtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_transformations(self, assembly_id):
chain_ids = np.array(self._file["chainNameList"], dtype="U4")
affected_chain_ids = chain_ids[transform["chainIndexList"]]
transformations.append((
affected_chain_ids,
affected_chain_ids.tolist(),
matrix[:3, :3].tolist(),
matrix[:3, 3].tolist()
))
Expand Down
4 changes: 2 additions & 2 deletions MolecularNodes/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def add_attribute(object: bpy.types.Object, name: str, data, type="FLOAT", domai
att = object.data.attributes.new(name, type, domain)
# currently vectors have to be added as a 1d array. may change in the future
# but currently must be reshaped then added as a 'vector' but supplying a 1d array
vec_1d = data.reshape(len(data) * 3)
vec_1d = data.reshape(len(data) * 3).copy(order = 'c')
att.data.foreach_set('vector', vec_1d)
else:
att = object.data.attributes.new(name, type, domain)
att.data.foreach_set('value', data)
att.data.foreach_set('value', data.copy(order = 'c'))

return att

Expand Down
1 change: 0 additions & 1 deletion tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def test_1cd3_bio_assembly(snapshot):
# Results shows the same number of atoms and atom positions are resulting from the
# different import methods so it still works
positions = [np.sort(mn.obj.get_attribute(obj, 'position'), axis = 0, kind = 'quicksort')[::-1] for obj in objects]
print(positions)
assert np.allclose(positions[0], positions[1], atol = 1e-4)

# TODO: for some reason when opening from .CIF files, we are ending up with double the
Expand Down

0 comments on commit 3ba0a6d

Please sign in to comment.