[ 0.0, 0.0, 0.0 ], [ 1.0, 0.0, 0.0 ], [ 2.0, 0.0, 0.0 ], [ 3.0, 0.0, 0.0 ], ] ); ''' atom_bas = [ [ 's', 'px', 'py', 'pz' ], [ 's' ], [ 's' ], [ 's', 'dz2' ], ] ''' atom_bas = MP.make_bas_list( [ len( atom_pos ) ] ) print "bas_list:", atom_bas atom_Rmin = np.array( [ 1.0, 1.0, 1.0, 1.0 ] ); atom_Rmax = np.array( [ 2.0, 2.0, 2.0, 2.0 ] ); atom_mask = np.array( [ True, True, True, False ] ); V = np.zeros( (50,50,50) ) cell = np.array([ [ 10.0, 0.0, 0.0 ], [ 0.0, 10.0, 0.0 ], [ 0.0, 0.0, 10.0 ] ]); MP.setGrid( V, cell );
atom_types, atom_pos = GU.getFromHead_PRIMCOORD( head) # load atoms from header of xsf file # set sample region around atom atom_Rmin, atom_Rmax spacies = PP.loadSpecies('./defaults/atomtypes.ini') R_type = spacies[:, 0] atom_Rmin, atom_Rmax = MP.make_Ratoms(atom_types, R_type) # mask atoms which should not to be included into the expansion natoms = len(atom_types) atom_mask = np.array([True] * natoms) atom_mask[2:] = False # set basiset for each atom atom_basis = MP.make_bas_list([len(atom_pos)], basis=[['s', 'px', 'py', 'pz']]) #print "atom_pos: ", atom_pos #print "atom_Rmin: ", atom_Rmin #print "atom_Rmax: ", atom_Rmax #print "atom_mask: ", atom_mask #print "atom_basis: ", atom_basis # ============== do the fitting coefs, basis_assignment = MP.fitMultipolesPotential(atom_pos, atom_basis, atom_Rmin, atom_Rmax, atom_mask=atom_mask, show_where=True)
atom_pos = np.array([ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [2.0, 0.0, 0.0], [3.0, 0.0, 0.0], ]) ''' atom_bas = [ [ 's', 'px', 'py', 'pz' ], [ 's' ], [ 's' ], [ 's', 'dz2' ], ] ''' atom_bas = MP.make_bas_list([len(atom_pos)]) print "bas_list:", atom_bas atom_Rmin = np.array([1.0, 1.0, 1.0, 1.0]) atom_Rmax = np.array([2.0, 2.0, 2.0, 2.0]) atom_mask = np.array([True, True, True, False]) V = np.zeros((50, 50, 50)) cell = np.array([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]) MP.setGrid(V, cell) sampled_val, sampled_pos = MP.sampleGridArroundAtoms(atom_pos, atom_Rmin, atom_Rmax, atom_mask) ''' X = sampled_pos[:,0]
# ============== prepare atoms atom_types,atom_pos = GU.getFromHead_PRIMCOORD( head ) # load atoms from header of xsf file # set sample region around atom atom_Rmin, atom_Rmax spacies = PP.loadSpecies( './defaults/atomtypes.ini' ) R_type = spacies[:,0] atom_Rmin, atom_Rmax = MP.make_Ratoms( atom_types, R_type ) # mask atoms which should not to be included into the expansion natoms = len( atom_types ) atom_mask = np.array( [ True ] * natoms ); atom_mask[ 2: ] = False # set basiset for each atom atom_basis = MP.make_bas_list( [ len( atom_pos ) ], basis=[ ['s','px','py','pz'] ] ) #print "atom_pos: ", atom_pos #print "atom_Rmin: ", atom_Rmin #print "atom_Rmax: ", atom_Rmax #print "atom_mask: ", atom_mask #print "atom_basis: ", atom_basis # ============== do the fitting coefs, basis_assignment = MP.fitMultipolesPotential( atom_pos, atom_basis, atom_Rmin, atom_Rmax, atom_mask=atom_mask, show_where=True ); # ============== output results for i in range( len( coefs ) ): print basis_assignment[i], coefs[i]