Skip to content

Commit

Permalink
my added code for removing nearby residues runs on gpus (did not before)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriella Reggiano committed Sep 27, 2022
1 parent 323b924 commit 0bc022c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions deepAccNet/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def calculate_LDDT(estogram, mask, center=7):
nres = mask.shape[-1]
diags = torch.ones((nres, nres)).to(device) - torch.eye(nres).to(device)
for i in range(1,5):
diags = diags - torch.diag(torch.ones(nres-i), diagonal=i)
diags = diags - torch.diag(torch.ones(nres-i), diagonal=-1*i)
diags = diags - torch.diag(torch.ones(nres-i).to(device), diagonal=i).to(device)
diags = diags - torch.diag(torch.ones(nres-i).to(device), diagonal=-1*i).to(device)
mask = torch.mul(mask, diags)
masked = torch.mul(estogram, mask)

Expand Down Expand Up @@ -167,4 +167,4 @@ def scatter_nd(indices, updates, shape):
out = out.scatter_add(0, flattened_indices, updates)

# Reshape
return out.view(shape)
return out.view(shape)
6 changes: 3 additions & 3 deletions deepAccNet/model2.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ def calculate_LDDT(estogram, mask, center=7):
nres = mask.shape[-1]
diags = torch.ones((nres, nres)).to(device) - torch.eye(nres).to(device)
for i in range(1,5):
diags = diags - torch.diag(torch.ones(nres-i), diagonal=i)
diags = diags - torch.diag(torch.ones(nres-i), diagonal=-1*i)
diags = diags - torch.diag(torch.ones(nres-i).to(device), diagonal=i).to(device)
diags = diags - torch.diag(torch.ones(nres-i).to(device), diagonal=-1*i).to(device)
masked = torch.mul(estogram, mask)

p0 = (masked[center]).sum(axis=0)
Expand Down Expand Up @@ -335,4 +335,4 @@ def scatter_nd(indices, updates, shape):
out = out.scatter_add(0, flattened_indices, updates)

# Reshape
return out.view(shape)
return out.view(shape)

0 comments on commit 0bc022c

Please sign in to comment.