def crystal_plane(hkl): ''' return the geometric planes of the polyhedron, where the 32 point group is considered, and the lattice parameter is taken as 0.4nm. hkl: Miller indices of crystallographic planes. ''' b1 = basis.cubic(0.4) # unit: nm cc1 = CC.CrystalClass32() latt = CrystalLattice(b1, cc1) planes = [] number_planes = [] for index in hkl: pf = latt.geometric_plane_family(index) number_planes.append(len(pf)) planes.extend(pf) return planes, number_planes
print("Duplicate plane family found:", p) planes = [lattice.geometric_plane(p) for p in pf_int] # set params. This is the additional argument that will be passed on to # fmin_cobyla() params = (ratio, number_planes, planes, volume_ref) f = fmin_cobyla(_shape_f, distance_initial, args=params, cons=[], rhobeg=1.0e-1) return f # testing and debugging (not exhaustive) if __name__=="__main__" : import crystal_class as CC import basis from crystal_lattice import CrystalLattice b1 = basis.cubic(0.4) # unit: nm cc1 = CC.CrystalClass28() latt = CrystalLattice(b1, cc1) planes1 = [] number_planes1 = [] for index in [[1,2,3], [1,1,0], [2,1,0], [3,3,1], [1,0,0], [1,1,1]]: pf = latt.geometric_plane_family(index) number_planes1.append(len(pf)) planes1.extend(pf) #set distances of the planes ps_setd_mingled(number_planes1, planes1, [2.0, 2.0, 2.0, 2.0, 2.0, 2.0]) diameter = 10.0 # unit: nm volume = 4.0/3.0*np.pi* (diameter*0.5)**3
else: # h!=0, k!=0, l!=0 return plane3d.through_3points(a1 / h, a2 / k, a3 / l) def geometric_plane_family(self, hkl): """ Returns a list of geometry planes in a crystal plane family. hkl cannot be [0,0,0], otherwise a ValueError is raised.""" planes = [] for i in self.crystal_class.plane_family(hkl): planes.append(self.geometric_plane(i)) return planes # Test and debug if __name__ == "__main__": cubic_cell = basis.cubic(3.0) cc1 = crystal_class.CrystalClass30() lattice1 = CrystalLattice(cubic_cell, cc1) for index in [ [1, 0, 0], [1, 1, 0], [1, 1, 1], [2, 1, 0], [3, 1, 1], [3, 2, 1], ]: family = lattice1.geometric_plane_family(index) print index, "has", len(family), "faces, and they are:" for f in family: print f