예제 #1
0
    def est_enthalpy(self):
        ref_list = [os.path.join(self.path, "Fe")]
        # FeNi3 = GibbsWithComp.from_dirc(os.path.join(self.path, 'Fe3Ni_L12'))
        ref_list.append(os.path.join(self.path, "Ni"))
        ref_list.append(os.path.join(self.path, "Si"))
        compounds = glob.glob(os.path.join(self.path, "*", "gibbs-temperature.dat"))
        compounds = [os.path.dirname(x) for x in compounds]
        print(compounds)
        refs = References.from_directories(ref_list)

        for compound in compounds:
            comp = MurnaghanWithComp.from_directory(compound)
            print(os.path.basename(compound))
            ent = Enthalpy(comp, refs)
            for p in range(0, 17, 2):
                ent["enthalpy"] = ent.enthalpy(p)
                print("{0}, {1}".format(p, ent.data[0]["enthalpy"]))

        print(ent.atT_with_comp(100, ["Fe", "Ni", "Si"]))
예제 #2
0
 def est_murnaghanwithcomp(self):
     mwc = MurnaghanWithComp.from_directory(os.path.join(self.path, "FeNi3"))
     print("FeNi3")
     mwc.murnaghan.alt_atP(10)
     print(mwc.murnaghan)
     print(mwc.GatT_with_comp(300, ["Fe", "Ni", "Si"]))
예제 #3
0
    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()