"detection/git@developer.sourcefind.cn:OpenDAS/dcnv3.git" did not exist on "4182170a9b4843d153b58197701c5352232313d9"
Commit 45a98436 authored by Marta's avatar Marta
Browse files

center coordinates at 0

parent 1c4d2c71
...@@ -429,7 +429,7 @@ def _is_set(data: str) -> bool: ...@@ -429,7 +429,7 @@ def _is_set(data: str) -> bool:
def get_atom_coords( def get_atom_coords(
mmcif_object: MmcifObject, chain_id: str mmcif_object: MmcifObject, chain_id: str, zero_center: bool = True
) -> Tuple[np.ndarray, np.ndarray]: ) -> Tuple[np.ndarray, np.ndarray]:
# Locate the right chain # Locate the right chain
chains = list(mmcif_object.structure.get_chains()) chains = list(mmcif_object.structure.get_chains())
...@@ -474,4 +474,9 @@ def get_atom_coords( ...@@ -474,4 +474,9 @@ def get_atom_coords(
all_atom_positions[res_index] = pos all_atom_positions[res_index] = pos
all_atom_mask[res_index] = mask all_atom_mask[res_index] = mask
if zero_center:
binary_mask = all_atom_mask.astype(np.bool)
translation_vec = all_atom_positions[binary_mask].mean(axis=0)
all_atom_positions[binary_mask] -= translation_vec
return all_atom_positions, all_atom_mask return all_atom_positions, all_atom_mask
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment