original_docstring: 
      Generate the FCHL19 representation (https://doi.org/10.1063/1.5126701).
      Requires the developer version of the QML package, see
      https://www.qmlcode.org/installation.html for installation instructions.
      Parameters
      ----------
      fxyz: string giving location of xyz file
      fdictxyz: string giving location of xyz file that is used as a dictionary
      prefix: string giving the filename prefix
      output: [xyz]: append the FCHL19 representation to extended xyz file; [mat] output as a standlone matrix
      :param nRs2: Number of gaussian basis functions in the two-body terms
      :type nRs2: integer
      :param nRs3: Number of gaussian basis functions in the three-body radial part
      :type nRs3: integer
      :param nFourier: Order of Fourier expansion
      :type nFourier: integer
      :param eta2: Precision in the gaussian basis functions in the two-body terms
      :type eta2: float
      :param eta3: Precision in the gaussian basis functions in the three-body radial part
      :type eta3: float
      :param zeta: Precision parameter of basis functions in the three-body angular part
      :type zeta: float
      :param two_body_decay: exponential decay for the two body function
      :type two_body_decay: float
      :param three_body_decay: exponential decay for the three body function
      :type three_body_decay: float
      :param three_body_weight: relative weight of the three body function
      :type three_body_weight: float
      :is_periodic: Boolean determining Whether the system is periodic.
      :type Boolean:
      
docstring: Generate the FCHL19 representation .
  
  string giving location of xyz file
  fdictxyz: string giving location of xyz file that is used as a dictionary
  prefix: string giving the filename prefix
  output: [xyz]: append the FCHL19 representation to extended xyz file; [mat] output as a standlone matrix
docstring_tokens: Generate the FCHL19 representation . string giving location of xyz file fdictxyz : string giving location of xyz file that is used as a dictionary prefix : string giving the filename prefix output : [ xyz ] : append the FCHL19 representation to extended xyz file ; [ mat ] output as a standlone matrix
code: def main(task=TASK_NAME, prefix= False , output= False , peratom= False, 
                      nRs2=24, nRs3=20, nFourier=1,
                      eta2=0.32, eta3=2.7, zeta=np.pi, 
                      rcut=8.0, acut=8.0,
                      two_body_decay=1.8, three_body_decay=0.57,
                      three_body_weight=13.4, 
                      periodic = False, kernel='global', n_comp=128):
      """
      Generate the FCHL19 representation (https://doi.org/10.1063/1.5126701).
      Requires the developer version of the QML package, see
      https://www.qmlcode.org/installation.html for installation instructions.
      Parameters
      ----------
      fxyz: string giving location of xyz file
      fdictxyz: string giving location of xyz file that is used as a dictionary
      prefix: string giving the filename prefix
      output: [xyz]: append the FCHL19 representation to extended xyz file; [mat] output as a standlone matrix
      :param nRs2: Number of gaussian basis functions in the two-body terms
      :type nRs2: integer
      :param nRs3: Number of gaussian basis functions in the three-body radial part
      :type nRs3: integer
      :param nFourier: Order of Fourier expansion
      :type nFourier: integer
      :param eta2: Precision in the gaussian basis functions in the two-body terms
      :type eta2: float
      :param eta3: Precision in the gaussian basis functions in the three-body radial part
      :type eta3: float
      :param zeta: Precision parameter of basis functions in the three-body angular part
      :type zeta: float
      :param two_body_decay: exponential decay for the two body function
      :type two_body_decay: float
      :param three_body_decay: exponential decay for the three body function
      :type three_body_decay: float
      :param three_body_weight: relative weight of the three body function
      :type three_body_weight: float
      :is_periodic: Boolean determining Whether the system is periodic.
      :type Boolean:
      """
  
      peratom = bool(peratom)
      frames = []
  
      # read frames
      if task != 'none':
          fxyz = 'data/'+task+'/'+task+'.xyz'
          frames = read(fxyz, ':')
          nframes = len(frames)
          print("read xyz file:", fxyz, ", a total of", nframes, "frames")
  
      global_species = []
      max_len = 0
      for frame in frames:
          max_len = max(max_len, len(frame.get_atomic_numbers()))
          global_species.extend(frame.get_atomic_numbers())
          if not periodic:
              frame.set_pbc([False, False, False])
      global_species = np.unique(global_species)
      print("a total of", nframes, "frames, with elements: ", global_species)
      rep, charge = repr_wrapper(frame,global_species,periodic,nRs2=nRs2, nRs3=nRs3, nFourier=nFourier,
                                                  eta2=eta2, eta3=eta3, zeta=zeta, 
                                                  rcut=rcut, acut=acut,
                                                  two_body_decay=two_body_decay, three_body_decay=three_body_decay,
                                                  three_body_weight=three_body_weight, pad = max_len)
      np_rep = np.empty((len(frames),rep.shape[0]))
      charge_list = []
      print('generating np_rep')
      for i, frame in enumerate(frames):
          #print(i,frame)
          #print(frame.get_positions())
          rep, charge = repr_wrapper(frame,global_species,periodic,nRs2=nRs2, nRs3=nRs3, nFourier=nFourier,
                                                  eta2=eta2, eta3=eta3, zeta=zeta, 
                                                  rcut=rcut, acut=acut,
                                                  two_body_decay=two_body_decay, three_body_decay=three_body_decay,
                                                  three_body_weight=three_body_weight, pad = max_len)
          np_rep[i]=rep
          charge_list.append(charge)
          #print(rep.shape)
      pca = PCA(n_comp)
      np_rep = pca.fit_transform(np_rep)
      np.save('results/FCHL/'+task+'.npy', np_rep)
      #np_rep = rep_list[0]
      #for rep in rep_list:
      #    print(rep)
      #    np_rep = np.vstack((np_rep,rep))                              
      #np_rep = np.asarray(rep_list)
      print(np_rep.shape)
      print('generating kernel')
      #for i in range(len(rep_list)):
      #    for j in range(len(rep_list)):
      #        print(get_local_kernels(rep_list[i], rep_list[j]))
      #sigmas = [2.5, 5.0, 10.0]
      #if kernel=='local':
      #   K = get_local_kernels(np_rep, np_rep, charge_list, charge_list, SIGMAS=sigmas)
      #elif kernel=='global':
      #   K = get_global_kernel(np_rep, np_rep, charge_list, charge_list, SIGMA=2.5)
      #print(K)
      #print(K.shape)
      #np.save('/rds-d2/user/wjm41/hpc-work/kernels/FCHL/'+task+'_'+kernel+'.npy',K)
code_tokens: def main ( task = TASK_NAME , prefix = False , output = False , peratom = False , nRs2 = 24 , nRs3 = 20 , nFourier = 1 , eta2 = 0.32 , eta3 = 2.7 , zeta = np . pi , rcut = 8.0 , acut = 8.0 , two_body_decay = 1.8 , three_body_decay = 0.57 , three_body_weight = 13.4 , periodic = False , kernel = 'global' , n_comp = 128 ) : peratom = bool ( peratom ) frames = [ ] if task != 'none' : fxyz = 'data/' + task + '/' + task + '.xyz' frames = read ( fxyz , ':' ) nframes = len ( frames ) print ( "read xyz file:" , fxyz , ", a total of" , nframes , "frames" ) global_species = [ ] max_len = 0 for frame in frames : max_len = max ( max_len , len ( frame . get_atomic_numbers ( ) ) ) global_species . extend ( frame . get_atomic_numbers ( ) ) if not periodic : frame . set_pbc ( [ False , False , False ] ) global_species = np . unique ( global_species ) print ( "a total of" , nframes , "frames, with elements: " , global_species ) rep , charge = repr_wrapper ( frame , global_species , periodic , nRs2 = nRs2 , nRs3 = nRs3 , nFourier = nFourier , eta2 = eta2 , eta3 = eta3 , zeta = zeta , rcut = rcut , acut = acut , two_body_decay = two_body_decay , three_body_decay = three_body_decay , three_body_weight = three_body_weight , pad = max_len ) np_rep = np . empty ( ( len ( frames ) , rep . shape [ 0 ] ) ) charge_list = [ ] print ( 'generating np_rep' ) for i , frame in enumerate ( frames ) : rep , charge = repr_wrapper ( frame , global_species , periodic , nRs2 = nRs2 , nRs3 = nRs3 , nFourier = nFourier , eta2 = eta2 , eta3 = eta3 , zeta = zeta , rcut = rcut , acut = acut , two_body_decay = two_body_decay , three_body_decay = three_body_decay , three_body_weight = three_body_weight , pad = max_len ) np_rep [ i ] = rep charge_list . append ( charge ) pca = PCA ( n_comp ) np_rep = pca . fit_transform ( np_rep ) np . save ( 'results/FCHL/' + task + '.npy' , np_rep ) print ( np_rep . shape ) print ( 'generating kernel' )
short_docstring: Generate the FCHL19 representation (https://doi.org/10.1063/1.5126701).
short_docstring_tokens: Generate the FCHL19 representation ( https : // doi . org / 10 . 1063 / 1 . 5126701 ) .
comment: """
      Generate the FCHL19 representation (https://doi.org/10.1063/1.5126701).
      Requires the developer version of the QML package, see
      https://www.qmlcode.org/installation.html for installation instructions.
      Parameters
      ----------
      fxyz: string giving location of xyz file
      fdictxyz: string giving location of xyz file that is used as a dictionary
      prefix: string giving the filename prefix
      output: [xyz]: append the FCHL19 representation to extended xyz file; [mat] output as a standlone matrix
      :param nRs2: Number of gaussian basis functions in the two-body terms
      :type nRs2: integer
      :param nRs3: Number of gaussian basis functions in the three-body radial part
      :type nRs3: integer
      :param nFourier: Order of Fourier expansion
      :type nFourier: integer
      :param eta2: Precision in the gaussian basis functions in the two-body terms
      :type eta2: float
      :param eta3: Precision in the gaussian basis functions in the three-body radial part
      :type eta3: float
      :param zeta: Precision parameter of basis functions in the three-body angular part
      :type zeta: float
      :param two_body_decay: exponential decay for the two body function
      :type two_body_decay: float
      :param three_body_decay: exponential decay for the three body function
      :type three_body_decay: float
      :param three_body_weight: relative weight of the three body function
      :type three_body_weight: float
      :is_periodic: Boolean determining Whether the system is periodic.
      :type Boolean:
      """$SEP$# read frames$SEP$#print(i,frame)$SEP$#print(frame.get_positions())$SEP$#print(rep.shape)$SEP$#np_rep = rep_list[0]$SEP$#for rep in rep_list:$SEP$#    print(rep)$SEP$#    np_rep = np.vstack((np_rep,rep))                              $SEP$#np_rep = np.asarray(rep_list)$SEP$#for i in range(len(rep_list)):$SEP$#    for j in range(len(rep_list)):$SEP$#        print(get_local_kernels(rep_list[i], rep_list[j]))$SEP$#sigmas = [2.5, 5.0, 10.0]$SEP$#if kernel=='local':$SEP$#   K = get_local_kernels(np_rep, np_rep, charge_list, charge_list, SIGMAS=sigmas)$SEP$#elif kernel=='global':$SEP$#   K = get_global_kernel(np_rep, np_rep, charge_list, charge_list, SIGMA=2.5)$SEP$#print(K)$SEP$#print(K.shape)$SEP$#np.save('/rds-d2/user/wjm41/hpc-work/kernels/FCHL/'+task+'_'+kernel+'.npy',K)