class_docstr: Neural network xc functional of GGA class of functionals
  
  The Purdew-Burke-Ernzerhof (PBE) functional is a popular non-empirical
  functional which falls under the Generalized Gradient Approximation (GGA)
  class of functionals. GGA differs from LDA by incorporating nonlocal
  corrections involving gradients (or derivatives) of the electron density.
  In other words, the XC potential is a complicated function in 3D space
  since it depends on the electron density and its gradient.
  
  Hence, in this model we input the electron density as well as the
  calculated gradients. We calculate these values using the DQC and Xitorch
  libraries.
  
  Examples
  --------
  >>> from deepchem.models.dft.nnxc import NNPBE
  >>> import torch
  >>> import torch.nn as nn
  >>> n_input, n_hidden = 3, 3
  >>> nnmodel = (nn.Linear(n_input, n_hidden))
  >>> output = NNPBE(nnmodel)
  
  References
  ----------
  Perdew, John P., Kieron Burke, and Matthias Ernzerhof. "Generalized gradient approximation made simple." Physical review letters 77.18 (1996): 3865.
  A.W. Ghosh,
  5.09 - Electronics with Molecules,
  Editor(s): Pallab Bhattacharya, Roberto Fornari, Hiroshi Kamimura,
  Comprehensive Semiconductor Science and Technology,
  Elsevier,
  2011,
  Pages 383-479,
  ISBN 9780444531537,
  https://doi.org/10.1016/B978-0-44-453153-7.00033-X.
class_docstr_tok: ["Neural","network","xc","functional","of","GGA","class","of","functionals","The","Purdew-Burke-Ernzerhof","(","PBE",")","functional","is","a","popular","non-empirical","functional","which","falls","under","the","Generalized","Gradient","Approximation","(","GGA",")","class","of","functionals",".","GGA","differs","from","LDA","by","incorporating","nonlocal","corrections","involving","gradients","(","or","derivatives",")","of","the","electron","density",".","In","other","words",",","the","XC","potential","is","a","complicated","function","in","3D","space","since","it","depends","on","the","electron","density","and","its","gradient",".","Hence",",","in","this","model","we","input","the","electron","density","as","well","as","the","calculated","gradients",".","We","calculate","these","values","using","the","DQC","and","Xitorch","libraries",".","Examples","--","--","--","--",">",">",">","from","deepchem.models.dft.nnxc","import","NNPBE",">",">",">","import","torch",">",">",">","import","torch.nn","as","nn",">",">",">","n_input",",","n_hidden","=","3",",","3",">",">",">","nnmodel","=","(","nn.Linear","(","n_input",",","n_hidden",")",")",">",">",">","output","=","NNPBE","(","nnmodel",")","References","--","--","--","--","--","Perdew",",","John","P.",",","Kieron","Burke",",","and","Matthias","Ernzerhof",".","``","Generalized","gradient","approximation","made","simple",".","''","Physical","review","letters","77.18","(","1996",")",":","3865",".","A.W",".","Ghosh",",","5.09","-","Electronics","with","Molecules",",","Editor","(","s",")",":","Pallab","Bhattacharya",",","Roberto","Fornari",",","Hiroshi","Kamimura",",","Comprehensive","Semiconductor","Science","and","Technology",",","Elsevier",",","2011",",","Pages","383-479",",","ISBN","9780444531537",",","https",":","\/\/doi.org\/10.1016\/B978-0-44-453153-7.00033-X","."]
docstr: Parameters
  ----------
  nnmodel: torch.nn.Module
      Neural network for xc functional. Shape; (3,...). This is because
      the nnmodel receives an input with the shape (....,3). This
      dimension is for;
      (0) total density (n): (n_up + n_dn), and
      (1) spin density (xi): (n_up - n_dn) / (n_up + n_dn)
      (2) normalized gradients (s): |del(n)| / [2(3*pi^2)^(1/3) * n^(4/3)]
docstr_tok: ["Parameters","--","--","--","--","--","nnmodel",":","torch.nn.Module","Neural","network","for","xc","functional",".","Shape",";","(","3",",","...",")",".","This","is","because","the","nnmodel","receives","an","input","with","the","shape","(","....",",3",")",".","This","dimension","is","for",";","(","0",")","total","density","(","n",")",":","(","n_up","+","n_dn",")",",","and","(","1",")","spin","density","(","xi",")",":","(","n_up","-","n_dn",")","\/","(","n_up","+","n_dn",")","(","2",")","normalized","gradients","(","s",")",":","|del","(","n",")","|","\/","[","2","(","3","*","pi^2",")","^","(","1\/3",")","*","n^","(","4\/3",")","]"]
code: def __init__(self, nnmodel: torch.nn.Module):
      """
      Parameters
      ----------
      nnmodel: torch.nn.Module
          Neural network for xc functional. Shape; (3,...). This is because
          the nnmodel receives an input with the shape (....,3). This
          dimension is for;
          (0) total density (n): (n_up + n_dn), and
          (1) spin density (xi): (n_up - n_dn) / (n_up + n_dn)
          (2) normalized gradients (s): |del(n)| / [2(3*pi^2)^(1/3) * n^(4/3)]
      """
      super().__init__()
      self.nnmodel = nnmodel
  
imports: from abc import abstractmethod
  from typing import Union, List
  import torch
  from dqc.utils.datastruct import ValGrad
  from deepchem.utils.dftutils import SpinParam
  from dqc.api.getxc import get_xc
  from dqc.xc.base_xc import BaseXC
  from dqc.utils.safeops import safenorm, safepow
label_desc: Use image node_id 1 to create a new NNPBE object from inherited base classes: BaseNNXC with example: obj = NNPBE(nnmodel)