Skip to content

Commit 101334f

Browse files
authored
Merge pull request #11 from Kintukp/cpydock_optimization
Cpydock optimization
2 parents 6939900 + 2d38864 commit 101334f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightdock/scoring/cpydock/energy/c/cpydock.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static PyObject * cpydock_calculate_energy(PyObject *self, PyObject *args) {
2929
PyArrayObject *rec_hydrogens, *lig_hydrogens, *rec_asa, *lig_asa, *rec_des_energy, *lig_des_energy = NULL;
3030
double atom_elec, total_elec, total_vdw, total_solvation_rec, total_solvation_lig, vdw_energy, vdw_radius, p6, k, solv_rec, solv_lig;
3131
unsigned int rec_len, lig_len, i, j, interface_len, intf_array_size, *interface_receptor, *interface_ligand;
32-
double **rec_array, **lig_array, x, y, z, distance2, interface_cutoff;
32+
double **rec_array, **lig_array, x, y, z, distance2, interface_cutoff, interface_cutoff2;
3333
npy_intp dims[2];
3434
double *rec_c_charges, *lig_c_charges, *rec_c_vdw, *lig_c_vdw, *rec_c_vdw_radii, *lig_c_vdw_radii = NULL;
3535
double *rec_c_asa, *lig_c_asa, *rec_c_des_energy, *lig_c_des_energy = NULL;
@@ -51,6 +51,8 @@ static PyObject * cpydock_calculate_energy(PyObject *self, PyObject *args) {
5151
&rec_vdw, &lig_vdw, &rec_vdw_radii, &lig_vdw_radii, &rec_hydrogens, &lig_hydrogens,
5252
&rec_asa, &lig_asa, &rec_des_energy, &lig_des_energy, &interface_cutoff)) {
5353

54+
interface_cutoff2 = interface_cutoff*interface_cutoff;
55+
5456
tmp0 = PyObject_GetAttrString(receptor_coordinates, "coordinates");
5557
tmp1 = PyObject_GetAttrString(ligand_coordinates, "coordinates");
5658

@@ -122,7 +124,7 @@ static PyObject * cpydock_calculate_energy(PyObject *self, PyObject *args) {
122124
total_vdw += k;
123125
}
124126

125-
if (sqrt(distance2) <= interface_cutoff) {
127+
if (distance2 <= interface_cutoff2) {
126128
interface_receptor[interface_len] = i;
127129
interface_ligand[interface_len++] = j;
128130
}

0 commit comments

Comments
 (0)