Skip to content

value overwrite #20

Description

@LanceKnight

Hi, I don't quite understand the following code excerpt from get_bin_feature(r, max_natoms) in ioutils_direct.py. From importing mol_graph.py, the bond_fdim = 6, so f[1:1+bond_fdim] is f[1:7], which will be overwritten by f[-4] and f[-3], so I'm not sure what this is doing. Also, f[-4] and f[-3] seems to be checking whether two atoms are in the same molecule. I'm not sure why we need both f[-4] and f[-3] to check this. Isn't using one of them enough?

`for i in range(max_natoms):

for j in range(max_natoms):

    f = np.zeros((binary_fdim,)) # binary_fdim = 4+bond_fdim, which equals to 10 in this case

    if i >= n_atoms or j >= n_atoms or i == j:

        features.append(f)

        continue

    if (i,j) in bond_map:

        bond = bond_map[(i,j)]

        f[1:1+bond_fdim] = bond_features(bond)

    else:

        f[0] = 1.0

    f[-4] = 1.0 if comp[i] != comp[j] else 0.0

    f[-3] = 1.0 if comp[i] == comp[j] else 0.0

    f[-2] = 1.0 if n_comp == 1 else 0.0

    f[-1] = 1.0 if n_comp > 1 else 0.0

    features.append(f)`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions