class_docstr: A deep-learning based Variational Monte Carlo method [1]_ for calculating the ab-initio
  solution of a many-electron system.
  
  This model must be pre-trained on the HF baseline and then can be used to improve on it using electronic interactions
  via the learned electron distance features. Ferminet models the orbital values using envelope functions and the
  calculated electron features, which can then be used to approximate the wavefunction for better sampling of electrons.
  
  Example
  -------
  >>> import numpy as np
  >>> import deepchem as dc
  >>> from deepchem.models.torch_models.ferminet import Ferminet
  >>> import torch
  >>> H2_molecule =  torch.Tensor([[0, 0, 0.748], [0, 0, 0]])
  >>> H2_charge = torch.Tensor([[1], [1]])
  >>> model = Ferminet(nucleon_pos=H2_molecule, nuclear_charge=H2_charge, spin=0, batch_size=1)
  >>> electron = np.random.rand(1, 2*3)
  >>> wavefunction = model.forward(electron)
  
  References
  ----------
  .. [1] Spencer, James S., et al. Better, Faster Fermionic Neural Networks. arXiv:2011.07125, arXiv, 13 Nov. 2020. arXiv.org, http://arxiv.org/abs/2011.07125.
class_docstr_tok: ["A","deep-learning","based","Variational","Monte","Carlo","method","[","1","]","_","for","calculating","the","ab-initio","solution","of","a","many-electron","system",".","This","model","must","be","pre-trained","on","the","HF","baseline","and","then","can","be","used","to","improve","on","it","using","electronic","interactions","via","the","learned","electron","distance","features",".","Ferminet","models","the","orbital","values","using","envelope","functions","and","the","calculated","electron","features",",","which","can","then","be","used","to","approximate","the","wavefunction","for","better","sampling","of","electrons",".","Example","--","--","--","-",">",">",">","import","numpy","as","np",">",">",">","import","deepchem","as","dc",">",">",">","from","deepchem.models.torch_models.ferminet","import","Ferminet",">",">",">","import","torch",">",">",">","H2_molecule","=","torch.Tensor","(","[","[","0",",","0",",","0.748","]",",","[","0",",","0",",","0","]","]",")",">",">",">","H2_charge","=","torch.Tensor","(","[","[","1","]",",","[","1","]","]",")",">",">",">","model","=","Ferminet","(","nucleon_pos=H2_molecule",",","nuclear_charge=H2_charge",",","spin=0",",","batch_size=1",")",">",">",">","electron","=","np.random.rand","(","1",",","2","*","3",")",">",">",">","wavefunction","=","model.forward","(","electron",")","References","--","--","--","--","--","..","[","1","]","Spencer",",","James","S.",",","et","al",".","Better",",","Faster","Fermionic","Neural","Networks",".","arXiv:2011.07125",",","arXiv",",","13","Nov.","2020.","arXiv.org",",","http",":","\/\/arxiv.org\/abs\/2011.07125","."]
docstr: Function to calculate where only the nucleus terms are involved and does not change when new electrons are sampled.
  atom-atom potential term = Zi*Zj/|Ri-Rj|, where Zi, Zj are the nuclear charges and Ri, Rj are nuclear coordinates
  
  Returns:
  --------
  A torch tensor of a scalar value containing the nuclear-nuclear potential term (does not change for the molecule system with sampling of electrons)
docstr_tok: ["Function","to","calculate","where","only","the","nucleus","terms","are","involved","and","does","not","change","when","new","electrons","are","sampled",".","atom-atom","potential","term","=","Zi","*","Zj\/|Ri-Rj|",",","where","Zi",",","Zj","are","the","nuclear","charges","and","Ri",",","Rj","are","nuclear","coordinates","Returns",":","--","--","--","--","A","torch","tensor","of","a","scalar","value","containing","the","nuclear-nuclear","potential","term","(","does","not","change","for","the","molecule","system","with","sampling","of","electrons",")"]
code: def calculate_nuclear_nuclear(
      self,
  ) -> torch.Tensor:
      """
      Function to calculate where only the nucleus terms are involved and does not change when new electrons are sampled.
      atom-atom potential term = Zi*Zj/|Ri-Rj|, where Zi, Zj are the nuclear charges and Ri, Rj are nuclear coordinates
  
      Returns:
      --------
      A torch tensor of a scalar value containing the nuclear-nuclear potential term (does not change for the molecule system with sampling of electrons)
      """
  
      potential = torch.nan_to_num(
          (
              self.nuclear_charge
              * 1
              / torch.cdist(
                  self.nucleon_pos.float(), self.nucleon_pos.float()
              )
              * self.nuclear_charge.unsqueeze(1)
          ),
          posinf=0.0,
          neginf=0.0,
      )
      potential = (torch.sum(potential) / 2).unsqueeze(0)
      return potential.detach()
  
imports: import logging
  from typing import List, Optional, Tuple
  from rdkit import Chem
  import numpy
  from deepchem.utils.molecule_feature_utils import ALLEN_ELECTRONEGATIVTY
  from deepchem.models.torch_models import TorchModel
  import torch
  from deepchem.models.torch_models.layers import FerminetElectronFeature, FerminetEnvelope
  from deepchem.utils.electron_sampler import ElectronSampler
label_desc: Use image node_id 4 for calling the Ferminet obj's underlying member method code with example usage: obj.calculate_nuclear_nuclear() and returns: potential