parameters: (self, atom="")
docstring: Calculates the classical kinetic energy of the simulation (p^2/2m)
  
        Args:
           atom: If given, specifies the atom to give the kinetic energy
              for. If not, the simulation kinetic energy is given.
docstring_summary: Calculates the classical kinetic energy of the simulation (p^2/2m)
docstring_tokens: Calculates the classical kinetic energy of the simulation ( p^2 / 2m )
function: def get_kinmd(self, atom=""):
        """Calculates the classical kinetic energy of the simulation (p^2/2m)
  
        Args:
           atom: If given, specifies the atom to give the kinetic energy
              for. If not, the simulation kinetic energy is given.
        """
  
        if atom == "":
           return self.nm.kin/self.beads.nbeads
        else:
           try:
              #iatom gives the index of the atom to be studied
              iatom = int(atom)
              latom = ""
              if iatom >= self.beads.natoms:
                 raise IndexError("Cannot output kinetic energy as atom index %d is larger than the number of atoms" % iatom)
           except ValueError:
              #here 'atom' is a label rather than an index which is stored in latom
              iatom = -1
              latom = atom
  
           pnm = depstrip(self.nm.pnm)
           dm3 = depstrip(self.nm.dynm3)
           kmd = 0.0
           ncount = 0
           for i in range(self.beads.natoms):
              if (atom != "" and iatom != i and latom != self.beads.names[i]):
                 continue
              k = 3*i
              for b in range(self.beads.nbeads):
                 kmd += (pnm[b,k]**2 + pnm[b,k+1]**2 + pnm[b,k+2]**2)/(2.0*dm3[b,k])
              ncount += 1
  
           if ncount == 0:
              warning("Couldn't find an atom which matched the argument of kinetic energy, setting to zero.", verbosity.medium)
  
           return kmd/self.beads.nbeads
function_tokens: def get_kinmd ( self , atom = "" ) : if atom == "" : return self . nm . kin / self . beads . nbeads else : try : #iatom gives the index of the atom to be studied iatom = int ( atom ) latom = "" if iatom >= self . beads . natoms : raise IndexError ( "Cannot output kinetic energy as atom index %d is larger than the number of atoms" % iatom ) except ValueError : #here 'atom' is a label rather than an index which is stored in latom iatom = - 1 latom = atom pnm = depstrip ( self . nm . pnm ) dm3 = depstrip ( self . nm . dynm3 ) kmd = 0.0 ncount = 0 for i in range ( self . beads . natoms ) : if ( atom != "" and iatom != i and latom != self . beads . names [ i ] ) : continue k = 3 * i for b in range ( self . beads . nbeads ) : kmd += ( pnm [ b , k ] ** 2 + pnm [ b , k + 1 ] ** 2 + pnm [ b , k + 2 ] ** 2 ) / ( 2.0 * dm3 [ b , k ] ) ncount += 1 if ncount == 0 : warning ( "Couldn't find an atom which matched the argument of kinetic energy, setting to zero." , verbosity . medium ) return kmd / self . beads . nbeads