class_docstr: Create atomic convolution neural network potential for binding energy.
  
  Example:
  
  >>> B = 10 # batch_size
  >>> N_1 = 6 # frag1_n_atoms
  >>> N_2 = 6 # frag2_n_atoms
  >>> N = 12 # complex_n_atoms
  >>> M = 6 # n_neighbors
  >>> n_tasks = 1
  >>> C_1 = np.zeros((N_1, 3))
  >>> C_2 = np.zeros((N_2, 3))
  >>> C = np.zeros((N, 3))
  >>> NL_1 = {}
  >>> for i in range(n_atoms): NL_1[i] = [0 for m in range(M)]
  >>> NL_2 = {}
  >>> for i in range(n_atoms): NL_2[i] = [0 for m in range(M)]
  >>> NL = {}
  >>> for i in range(n_atoms): NL[i] = [0 for m in range(M)]
  >>> Z_1 = np.zeros((N))
  >>> Z_2 = np.zeros((N))
  >>> Z = np.zeros((N))
  >>> X = [(C_1, NL_1, Z_1, C_2, NL_2, Z_2, C, NL, Z) for i in range(B)]
  >>> y = np.zeros(B, n_tasks)
  >>> w = np.zeros(B, n_tasks)
  >>> ids = np.zeros(B,)
  >>> dataset = dc.data.NumpyDataset(X, y, w, ids)
  >>> rp = [[12.0, 0.0, 0.04]]
  >>> at = None
  >>> model = TensorflowFragmentRegressor(n_tasks, rp, at, N_1, N_2, N, M)
  >>> model.fit(dataset)
class_docstr_tok: ["Create","atomic","convolution","neural","network","potential","for","binding","energy",".","Example",":",">",">",">","B","=","10","#","batch_size",">",">",">","N_1","=","6","#","frag1_n_atoms",">",">",">","N_2","=","6","#","frag2_n_atoms",">",">",">","N","=","12","#","complex_n_atoms",">",">",">","M","=","6","#","n_neighbors",">",">",">","n_tasks","=","1",">",">",">","C_1","=","np.zeros","(","(","N_1",",","3",")",")",">",">",">","C_2","=","np.zeros","(","(","N_2",",","3",")",")",">",">",">","C","=","np.zeros","(","(","N",",","3",")",")",">",">",">","NL_1","=","{","}",">",">",">","for","i","in","range","(","n_atoms",")",":","NL_1","[","i","]","=","[","0","for","m","in","range","(","M",")","]",">",">",">","NL_2","=","{","}",">",">",">","for","i","in","range","(","n_atoms",")",":","NL_2","[","i","]","=","[","0","for","m","in","range","(","M",")","]",">",">",">","NL","=","{","}",">",">",">","for","i","in","range","(","n_atoms",")",":","NL","[","i","]","=","[","0","for","m","in","range","(","M",")","]",">",">",">","Z_1","=","np.zeros","(","(","N",")",")",">",">",">","Z_2","=","np.zeros","(","(","N",")",")",">",">",">","Z","=","np.zeros","(","(","N",")",")",">",">",">","X","=","[","(","C_1",",","NL_1",",","Z_1",",","C_2",",","NL_2",",","Z_2",",","C",",","NL",",","Z",")","for","i","in","range","(","B",")","]",">",">",">","y","=","np.zeros","(","B",",","n_tasks",")",">",">",">","w","=","np.zeros","(","B",",","n_tasks",")",">",">",">","ids","=","np.zeros","(","B",",",")",">",">",">","dataset","=","dc.data.NumpyDataset","(","X",",","y",",","w",",","ids",")",">",">",">","rp","=","[","[","12.0",",","0.0",",","0.04","]","]",">",">",">","at","=","None",">",">",">","model","=","TensorflowFragmentRegressor","(","n_tasks",",","rp",",","at",",","N_1",",","N_2",",","N",",","M",")",">",">",">","model.fit","(","dataset",")"]
docstr: Construct a feed dictionary from minibatch data.
  
  B = batch_size, N = max_num_atoms
  
  Parameters
  ----------
  
  F_b: np.ndarray of B tuples of (X_1, L_1, Z_1, X_2, L_2, Z_2, X, L, Z) 
    X_1: ndarray shape (N, 3).
      Fragment 1 Cartesian coordinates [Angstrom].
    L_1: dict with N keys.
      Fragment 1 neighbor list.
    Z_1: ndarray shape (N,).
      Fragment 1 atomic numbers.
    X_2: ndarray shape (N, 3).
      Fragment 2 Cartesian coordinates [Angstrom].
    L_2: dict with N keys.
      Fragment 2 neighbor list.
    Z_2: ndarray shape (N,).
      Fragment 2 atomic numbers.
    X: ndarray shape (N, 3).
      Complex Cartesian coordinates [Angstrom].
    L: dict with N keys.
      Complex neighbor list.
    Z: ndarray shape (N,).
      Complex atomic numbers.
  y_b: np.ndarray of shape (B, num_tasks)
    Tasks.
  w_b: np.ndarray of shape (B, num_tasks)
    Task weights.
  ids_b: List of length (B,) 
    Datapoint identifiers. Not currently used.
  
  Returns
  -------
  
  retval: dict
    Tensorflow feed dict
docstr_tok: ["Construct","a","feed","dictionary","from","minibatch","data",".","B","=","batch_size",",","N","=","max_num_atoms","Parameters","--","--","--","--","--","F_b",":","np.ndarray","of","B","tuples","of","(","X_1",",","L_1",",","Z_1",",","X_2",",","L_2",",","Z_2",",","X",",","L",",","Z",")","X_1",":","ndarray","shape","(","N",",","3",")",".","Fragment","1","Cartesian","coordinates","[","Angstrom","]",".","L_1",":","dict","with","N","keys",".","Fragment","1","neighbor","list",".","Z_1",":","ndarray","shape","(","N",",",")",".","Fragment","1","atomic","numbers",".","X_2",":","ndarray","shape","(","N",",","3",")",".","Fragment","2","Cartesian","coordinates","[","Angstrom","]",".","L_2",":","dict","with","N","keys",".","Fragment","2","neighbor","list",".","Z_2",":","ndarray","shape","(","N",",",")",".","Fragment","2","atomic","numbers",".","X",":","ndarray","shape","(","N",",","3",")",".","Complex","Cartesian","coordinates","[","Angstrom","]",".","L",":","dict","with","N","keys",".","Complex","neighbor","list",".","Z",":","ndarray","shape","(","N",",",")",".","Complex","atomic","numbers",".","y_b",":","np.ndarray","of","shape","(","B",",","num_tasks",")","Tasks",".","w_b",":","np.ndarray","of","shape","(","B",",","num_tasks",")","Task","weights",".","ids_b",":","List","of","length","(","B",",",")","Datapoint","identifiers",".","Not","currently","used",".","Returns","--","--","--","-","retval",":","dict","Tensorflow","feed","dict"]
code: def construct_feed_dict(self, F_b, y_b=None, w_b=None, ids_b=None):
      """Construct a feed dictionary from minibatch data.
  
      B = batch_size, N = max_num_atoms
  
      Parameters
      ----------
  
      F_b: np.ndarray of B tuples of (X_1, L_1, Z_1, X_2, L_2, Z_2, X, L, Z)
        X_1: ndarray shape (N, 3).
          Fragment 1 Cartesian coordinates [Angstrom].
        L_1: dict with N keys.
          Fragment 1 neighbor list.
        Z_1: ndarray shape (N,).
          Fragment 1 atomic numbers.
        X_2: ndarray shape (N, 3).
          Fragment 2 Cartesian coordinates [Angstrom].
        L_2: dict with N keys.
          Fragment 2 neighbor list.
        Z_2: ndarray shape (N,).
          Fragment 2 atomic numbers.
        X: ndarray shape (N, 3).
          Complex Cartesian coordinates [Angstrom].
        L: dict with N keys.
          Complex neighbor list.
        Z: ndarray shape (N,).
          Complex atomic numbers.
      y_b: np.ndarray of shape (B, num_tasks)
        Tasks.
      w_b: np.ndarray of shape (B, num_tasks)
        Task weights.
      ids_b: List of length (B,)
        Datapoint identifiers. Not currently used.
  
      Returns
      -------
  
      retval: dict
        Tensorflow feed dict
  
      """
  
      N = self.complex_num_atoms
      N_1 = self.frag1_num_atoms
      N_2 = self.frag2_num_atoms
      M = self.max_num_neighbors
  
      orig_dict = {}
      batch_size = F_b.shape[0]
      num_features = F_b[0][0].shape[1]
      frag1_X_b = np.zeros((batch_size, N_1, num_features))
      for i in range(batch_size):
          frag1_X_b[i] = F_b[i][0]
      orig_dict["frag1_X_placeholder"] = frag1_X_b
  
      frag2_X_b = np.zeros((batch_size, N_2, num_features))
      for i in range(batch_size):
          frag2_X_b[i] = F_b[i][3]
      orig_dict["frag2_X_placeholder"] = frag2_X_b
  
      complex_X_b = np.zeros((batch_size, N, num_features))
      for i in range(batch_size):
          complex_X_b[i] = F_b[i][6]
      orig_dict["complex_X_placeholder"] = complex_X_b
  
      frag1_Nbrs = np.zeros((batch_size, N_1, M))
      frag1_Z_b = np.zeros((batch_size, N_1))
      for i in range(batch_size):
          frag1_Z_b[i] = F_b[i][2]
      frag1_Nbrs_Z = np.zeros((batch_size, N_1, M))
      for atom in range(N_1):
          for i in range(batch_size):
              atom_nbrs = F_b[i][1].get(atom, "")
              frag1_Nbrs[i, atom, : len(atom_nbrs)] = np.array(
                  atom_nbrs
              )
              for j, atom_j in enumerate(atom_nbrs):
                  frag1_Nbrs_Z[i, atom, j] = frag1_Z_b[i, atom_j]
  
      orig_dict["frag1_Z_placeholder"] = frag1_Z_b
      orig_dict["frag1_Nbrs_placeholder"] = frag1_Nbrs
      orig_dict["frag1_Nbrs_Z_placeholder"] = frag1_Nbrs_Z
  
      frag2_Nbrs = np.zeros((batch_size, N_2, M))
      frag2_Z_b = np.zeros((batch_size, N_2))
      for i in range(batch_size):
          frag2_Z_b[i] = F_b[i][5]
      frag2_Nbrs_Z = np.zeros((batch_size, N_2, M))
      for atom in range(N_2):
          for i in range(batch_size):
              atom_nbrs = F_b[i][4].get(atom, "")
              frag2_Nbrs[i, atom, : len(atom_nbrs)] = np.array(
                  atom_nbrs
              )
              for j, atom_j in enumerate(atom_nbrs):
                  frag2_Nbrs_Z[i, atom, j] = frag2_Z_b[i, atom_j]
  
      orig_dict["frag2_Z_placeholder"] = frag2_Z_b
      orig_dict["frag2_Nbrs_placeholder"] = frag2_Nbrs
      orig_dict["frag2_Nbrs_Z_placeholder"] = frag2_Nbrs_Z
  
      complex_Nbrs = np.zeros((batch_size, N, M))
      complex_Z_b = np.zeros((batch_size, N))
      for i in range(batch_size):
          complex_Z_b[i] = F_b[i][8]
      complex_Nbrs_Z = np.zeros((batch_size, N, M))
      for atom in range(N):
          for i in range(batch_size):
              atom_nbrs = F_b[i][7].get(atom, "")
              complex_Nbrs[i, atom, : len(atom_nbrs)] = np.array(
                  atom_nbrs
              )
              for j, atom_j in enumerate(atom_nbrs):
                  complex_Nbrs_Z[i, atom, j] = complex_Z_b[i, atom_j]
  
      orig_dict["complex_Z_placeholder"] = complex_Z_b
      orig_dict["complex_Nbrs_placeholder"] = complex_Nbrs
      orig_dict["complex_Nbrs_Z_placeholder"] = complex_Nbrs_Z
      for task in range(self.n_tasks):
          if y_b is not None:
              orig_dict["labels_%d" % task] = y_b[:, task]
          else:
              orig_dict["labels_%d" % task] = np.zeros(
                  (self.batch_size,)
              )
          if w_b is not None:
              orig_dict["weights_%d" % task] = w_b[:, task]
          else:
              orig_dict["weights_%d" % task] = np.ones(
                  (self.batch_size,)
              )
      return TensorflowGraph.get_feed_dict(orig_dict)
  
file_path: deepchem/contrib/atomicconv/models/atomicnet.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import unicode_literals
  import os
  import time
  import numpy
  import tensorflow
  from deepchem.data import DiskDataset
  from deepchem.nn import model_ops
  from legacy import TensorflowGraph, TensorflowGraphModel, TensorflowMultiTaskRegressor
  from deepchem.utils.save import log
  import atomicnet_ops
label_desc: Use image node_id 2 for calling the TensorflowFragmentRegressor obj's underlying member method code with example usage: obj.construct_feed_dict(F_b, y_b, w_b, ids_b) and returns: TensorflowGraph