def _test_select_base(self): """ 桁数を揃えておかないと無限ループに陥る """ print("Test select bases") end_memb = [[0, 0, 0], [0, 1, 0], [1, 0, 0]] not_end = [[0.25, 0.75, -27.853794735939683], [0.25, 0.25, -41.16333894885379]] #not_end = [[0.3333333333, 0.3333333333, -11.6165778644]] bases = FindGS.collect_base_triangles(end_memb, not_end)
def _test_triangle(self): point1 = [0, 1, 2] point2 = [1, 2, 3] point3 = [1, 1, 1] point4 = [2, 3, 4] point5 = [1, 1, 1] point6 = [2, 4, 6] triangleA = [point1, point2, point3] triangleB = [point4, point5, point6] triangleC = [point1, point5, point4] #FindGS.resplit_triangle(triangleA, triangleB) tri1, tri2, judge = FindGS.resplit_triangle(triangleA, triangleC) print(tri1)
def test_convex(self): """ アニメーション """ base_list = [os.path.join(self.path, "Fe")] # FeNi3 = GibbsWithComp.from_dirc(os.path.join(self.path, 'Fe3Ni_L12')) base_list.append(os.path.join(self.path, "Ni")) base_list.append(os.path.join(self.path, "Si")) ref = References.from_directories(base_list) compounds = glob.glob(os.path.join(self.path, "*", "gibbs-temperature.dat")) compounds = [os.path.dirname(x) for x in compounds] fig = pylab.figure() ax = Axes3D(fig) i = 0 elems = ["Fe", "Ni", "Si"] pressure = 0 for i in [0, 2]: temp_list = [0, 1000, 0] temp = temp_list[i] pres_list = [0, 0, 10] pressure = pres_list[i] bases = [] for base in base_list: mwc = MurnaghanWithComp.from_directory(base) ent = Enthalpy(mwc, ref) ent["enthalpy"] = ent.enthalpy(pressure) bases.append(ent.atT_with_comp(temp, elems)) bases[-1][-1] *= 96.485344520851 not_bases = [] for compound in compounds: mwc = MurnaghanWithComp.from_directory(compound) ent = Enthalpy(mwc, ref) ent["enthalpy"] = ent.enthalpy(pressure) not_bases.append(ent.atT_with_comp(temp, elems)) not_bases[-1][-1] *= 96.485344520851 mwc = MurnaghanWithComp.from_directory(os.path.join(self.path, "Fe2NiSi_5to10")) ent = Enthalpy(mwc, ref) ent["enthalpy"] = ent.enthalpy(pressure) heusler = ent.atT_with_comp(temp, elems) heusler[-1] *= 96.485344520851 not_bases.remove(bases[0]) not_bases.remove(bases[1]) not_bases.remove(bases[2]) tri = FindGS.collect_base_triangles(bases, not_bases) fromgs = FindGS.fromGround(tri, [heusler]) print("{0} {1} {2}".format(temp, fromgs[0][2], heusler[-1])) color = ["blue", "magenta", "green"] convex_hull.draw_convex_hull(ax, bases, not_bases, ["Fe", "Ni", "Si"], [-80, 5], color=color[i]) i += 1 def animate(i): ax.view_init(30, 2 * i) fig.canvas.draw() FFwriter = animation.FFMpegWriter(fps=15, metadata=dict(artist="Me"), bitrate=1800) anim = animation.FuncAnimation(fig, animate, frames=180, interval=1, blit=False) anim.save("test.mp4", writer=FFwriter) pylab.show()