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

Update equibind.py #67

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions models/equibind.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ def forward(self, lig_graph, rec_graph, coords_lig, h_feats_lig, original_ligand
else:
x_evolved_rec = coords_rec

lig_graph.update_all(fn.copy_edge('msg', 'm'), fn.mean('m', 'aggr_msg'))
rec_graph.update_all(fn.copy_edge('msg', 'm'), fn.mean('m', 'aggr_msg'))
lig_graph.update_all(fn.copy_e('msg', 'm'), fn.mean('m', 'aggr_msg'))
rec_graph.update_all(fn.copy_e('msg', 'm'), fn.mean('m', 'aggr_msg'))

if self.fine_tune:
x_evolved_lig = x_evolved_lig + self.att_mlp_cross_coors_V_lig(h_feats_lig) * (
Expand Down Expand Up @@ -515,7 +515,7 @@ def forward(self, lig_graph, rec_graph, coords_lig, h_feats_lig, original_ligand
Loss = torch.sum((d_squared - geometry_graph.edata['feat'] ** 2)**2) # this is the loss whose gradient we are calculating here
grad_d_squared = 2 * (x_evolved_lig[src] - x_evolved_lig[dst])
geometry_graph.edata['partial_grads'] = 2 * (d_squared - geometry_graph.edata['feat'] ** 2)[:,None] * grad_d_squared
geometry_graph.update_all(fn.copy_edge('partial_grads', 'partial_grads_msg'),
geometry_graph.update_all(fn.copy_e('partial_grads', 'partial_grads_msg'),
fn.sum('partial_grads_msg', 'grad_x_evolved'))
grad_x_evolved = geometry_graph.ndata['grad_x_evolved']
x_evolved_lig = x_evolved_lig + self.geometry_reg_step_size * grad_x_evolved
Expand Down