def pairFeatureMatrix(self, elementList):
""" Construction of pair-distance matrices """
# Initiate
nSpecies = len(elementList)
# Get the molecular structure
pos = np.array(self.molecule.positions, dtype = float) # Atomic positions
elInd = np.array(self.molecule.elInd, dtype = np.intc) # Element indices matching to elementList
natoms = len(self.molecule.names) # Total number of atoms in the molecule
# Initiate the matrix
dim1 = natoms * (natoms -1)/2 # First dimension (pairwise distances)
dim2 = nSpecies * (nSpecies + 1)/2 # Number of possible pairs
featMat = np.zeros((dim1,dim2)) # To be passed to fun_pairFeatures (compiled C code)
# Call the C function to store the pairFeatures
pairFeatures.fun_pairFeatures(nSpecies, natoms, elInd, pos, featMat)
# Return featMat
return featMat
评论列表
文章目录