Example #1
0
 def showVAF(self):
     if self.file1.isGoodFile():
         try:
             x = linspace(self.ni, self.nf, len(self.vacf))
             self.GraphVAF = Graph.graphic(x,
                                           self.vacf,
                                           'step',
                                           "VACF",
                                           average=False,
                                           name=self.file1.getNameFile() +
                                           " VACF")
             self.GraphVAF.show()
         except:
             self.vacf = Analysis.Correlation(
                 self.file1.getVel()).getCorrelationFunction(normalize=True)
             x = linspace(self.ni, self.nf, len(self.vacf))
             self.GraphVAF = Graph.graphic(x,
                                           self.vacf,
                                           'step',
                                           "VACF",
                                           average=False,
                                           name=self.file1.getNameFile() +
                                           " VACF")
             self.GraphVAF.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #2
0
    def displayGraph(self):
        res = self.sbres.value()
        pdos = Analysis.DOS(self.VACF, res, self.dtion)

        y = pdos.getDOS()
        x = pdos.getFrequencies()

        try:
            self.GraphDOS.update(x,
                                 y,
                                 'E (meV)',
                                 "Phonons DOS (1/meV)",
                                 name=self.name,
                                 adjust=True)
        except:
            self.GraphDOS = Graph.graphic(x,
                                          y,
                                          'E (meV)',
                                          "Phonons DOS (1/meV)",
                                          average=False,
                                          adjust=True,
                                          name=self.name)
            self.connect(self.GraphDOS, QtCore.SIGNAL("myCustomizedSignal()"),
                         self.close)
            self.GraphDOS.show()

        if self.checkbox.isChecked():
            self.addSprectum()
Example #3
0
    def GraphOutput(self):
        #The purpose of this fonction is to create or update
        #the graph of the output file
        if self.checkbox1.isChecked():

            boxData = self.getBoxData()
            xlbl = boxData[0]
            ylbl = boxData[1]
            x = boxData[2]
            y = boxData[3]
            if (len(x) != len(y) or (len(x) == 0 or len(y) == 0)):
                return

            try:
                self.graph.update(x,
                                  y,
                                  xlbl,
                                  ylbl,
                                  name=str(self.file2.getNameFile()) + ' ' +
                                  ylbl)
            except:
                self.graph = Graph.graphic(x,
                                           y,
                                           xlbl,
                                           ylbl,
                                           average=False,
                                           name=str(self.file2.getNameFile()) +
                                           ' ' + ylbl)
                self.connect(self.graph, QtCore.SIGNAL("myCustomizedSignal()"),
                             self.closeGraph)
                self.graph.show()
            if self.birchCheckbox.isChecked():
                self.showBirch()
        else:
            self.closeGraph()
Example #4
0
    def displayGraph(self):

        atom = self.CBox1.currentIndex() + 1

        self.MeanSquaredDeplacement = Analysis.MSD(self.file, atom)

        x = self.MeanSquaredDeplacement.getX()
        y = self.MeanSquaredDeplacement.getMSD()

        try:
            self.graphMSD.update(x,
                                 y,
                                 'step',
                                 "Mean squared deplacement",
                                 name=self.name)
            self.graphMSD.addPlot(x, linspace(1, 1, len(x)))
            self.graphMSD.show()
        except:
            self.graphMSD = Graph.graphic(x,
                                          y,
                                          'step',
                                          "Mean squared deplacement",
                                          average=False,
                                          name=self.name)
            self.connect(self.graphMSD, QtCore.SIGNAL("myCustomizedSignal()"),
                         self.close)
            self.graphMSD.show()
Example #5
0
 def showVolume(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)
         vol = self.file1.getVol() * self.units['Volume'][1]
         self.GraphVolume = Graph.graphic(x,vol,'Step',"Volume ("+str(self.units['Volume'][0])+")",\
                                                name = self.file1.getNameFile() +" Volume")
         self.GraphVolume.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #6
0
    def showStress(self):        
        if self.file1.isGoodFile():
            x = linspace(self.ni,self.nf-1,self.nf-self.ni)# Temporarily !!!
            st =self.file1.getStress()

            self.GraphStress= Graph.graphic(x,st * self.units['Pressure'][1],'Step', "Stress ("+str(self.units['Pressure'][0])+")",\
                                                average=False,name = self.file1.getNameFile() +" Stress")
            self.GraphStress.addLegend([r'$\sigma_1$',r'$\sigma_2$',r'$\sigma_3$',r'$\sigma_4$',r'$\sigma_5$',r'$\sigma_6$'])
            self.GraphStress.show()
Example #7
0
 def showPressure(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)# Temporarily !!!
         pressure = self.file1.getPress() * self.units['Pressure'][1]
         self.GraphPressure = Graph.graphic(x,pressure,'Step',"Pressure ("+str(self.units['Pressure'][0])+")",\
                                                name = self.file1.getNameFile() +" Pressure")
         self.GraphPressure.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #8
0
 def showTemperature(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)# Temporarily !!!
         temp = self.file1.getTemp() - self.units['Temperature'][1]
         self.GraphTemperature = Graph.graphic(x,temp,'Step',"Temperature ("+str(self.units['Temperature'][0])+")",\
                                                   name = self.file1.getNameFile() +" Temperature")
         self.GraphTemperature.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #9
0
 def showKineticEnergy(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)# Temporarily !!!
         eKin = self.file1.getE_kin()  * self.units['Energy'][1]
         self.GraphKineticEnergy = Graph.graphic(x,eKin,'Step',"Kinetic Energy ("+str(self.units['Energy'][0])+")",\
                                                     name = self.file1.getNameFile() +" kinetic Energy")
         self.GraphKineticEnergy.show()
     else:
         self.showError("Your NetCDF file is not correct") 
Example #10
0
 def showAngles(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)
         angles = self.file1.getAngles() * self.units['Angle'][1]
         self.GraphAngles = Graph.graphic(x,angles,'Step',"Angles ("+str(self.units['Angle'][0])+")",\
                                                average=False,name = self.file1.getNameFile() +" Angles")
         self.GraphAngles.addLegend([r'$\alpha$',r'$\beta$',r'$\gamma$'])
         self.GraphAngles.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #11
0
 def showAcell(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)
         acell = self.file1.getAcell() * self.units['Distance'][1]
         self.GraphAcell = Graph.graphic(x,acell,'Step',"Acell ("+str(self.units['Distance'][0])+")",\
                                                average=False,name = self.file1.getNameFile() +" Distance")
         self.GraphAcell.addLegend([r'$a$',r'$b$',r'$c$'])
         self.GraphAcell.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #12
0
 def showPotentialEnergy(self):
     if self.file1.isGoodFile():
         x = linspace(self.ni,self.nf-1,self.nf-self.ni)# Temporarily !!!
         epot = self.file1.getE_pot() * self.units['Energy'][1]
         self.file1.getNameFile()
         self.GraphPotentialEnergy = Graph.graphic(x,epot,'Step',"Potential Energy ("+str(self.units['Energy'][0])+")",\
                                                       name = self.file1.getNameFile()+" Potential Energy")
         self.GraphPotentialEnergy.show()
     else:
         self.showError("Your NetCDF file is not correct")
Example #13
0
    def Graphics(self):

        mode1 = self.sbm.currentText()

        if mode1 == 'RDF':

            typat = self.file.getTypat()
            ntypat = max(typat)

            if ntypat == 1:

                atom1 = 1
                atom2 = 1

            elif ntypat >= 2:

                atom1 = self.CBox1.currentIndex()
                atom2 = self.CBox2.currentIndex()

            box = self.sbrm.value()
            dr = self.sbdr.value()
            step = self.sbStep.value()

            if self.sbdec.isChecked():

                self.RadialDistrib = Analysis.RDF(self.file, 1, atom1, atom2,
                                                  box, dr, step)

                data = self.RadialDistrib.getDATA()

                x = self.RadialDistrib.getR()

                for i in range(1, len(typat) - 1):

                    self.Deconvolution = Analysis.DEC(self.file, i, atom1,
                                                      atom2, data, box, dr,
                                                      step)

                    y = self.Deconvolution.getNEI()

                    try:
                        self.GraphDEC.addGraph(x, y, False)
                    except:
                        self.GraphDEC = Graph.graphic(x,
                                                      y,
                                                      'R (Bohr)',
                                                      "Radial Distribution",
                                                      average=False,
                                                      name=self.name)

                self.GraphDEC.show()

            else:

                self.RadialDistrib = Analysis.RDF(self.file, 0, atom1, atom2,
                                                  box, dr, step)

                x = self.RadialDistrib.getR()

                y = self.RadialDistrib.getRDF()

                try:
                    self.GraphRDF.update(x,
                                         y,
                                         'R (Bohr)',
                                         "Radial Distribution",
                                         name=self.name)
                    self.GraphRDF.addPlot(x, linspace(1, 1, len(x)))
                except:
                    self.GraphRDF = Graph.graphic(x,
                                                  y,
                                                  'R (Bohr)',
                                                  "Radial Distribution",
                                                  average=False,
                                                  name=self.name)
                    self.GraphRDF.addPlot(x, linspace(1, 1, len(x)))
            #self.connect(self.GraphRDF, QtCore.SIGNAL("myCustomizedSignal()"), self.close)
                self.GraphRDF.show()

                def close(self):
                    self.hide()
                    try:
                        del self.GraphRDF
                    except:
                        pass

                y = self.RadialDistrib.getINT()

                try:
                    self.GraphINT.update(x,
                                         y,
                                         'R (Bohr)',
                                         "Integral of the Radial Distribution",
                                         name=self.name)
                except:
                    self.GraphINT = Graph.graphic(
                        x,
                        y,
                        'R (Bohr)',
                        "Integral of the Radial Distribution",
                        average=False,
                        name=self.name)

            #self.connect(self.GraphRDF, QtCore.SIGNAL("myCustomizedSignal()"), self.close)
                self.GraphINT.show()

                def close(self):
                    self.hide()
                    try:
                        del self.GraphINT
                    except:
                        pass

        elif mode1 == 'ADF':

            neib = self.sbn.value()

            typat = self.file.getTypat()
            ntypat = max(typat)

            if ntypat == 1:

                atom1 = 1
                atom2 = 1

            elif ntypat >= 2:

                atom1 = self.CBox1.currentIndex()
                atom2 = self.CBox2.currentIndex()

            dtheta = self.sbdt.value()
            step = self.sbStep.value()

            self.AngularDistrib = Analysis.ADF(neib, self.file, atom1, atom2,
                                               dtheta, step)

            x = self.AngularDistrib.getTheta()

            y = self.AngularDistrib.getADF()

            try:
                self.GraphADF.update(x,
                                     y,
                                     'Theta (degres)',
                                     "Angular Distribution",
                                     name=self.name)
            except:
                self.GraphADF = Graph.graphic(x,
                                              y,
                                              'Theta (degres)',
                                              "Angular Distribution",
                                              average=False,
                                              name=self.name)
            #self.connect(self.GraphRDF, QtCore.SIGNAL("myCustomizedSignal()"), self.close)
            self.GraphADF.show()

            def close(self):
                self.hide()
                try:
                    del self.GraphADF
                except:
                    pass

        elif mode1 == 'NDF':

            neib = self.sbn.value()

            typat = self.file.getTypat()
            ntypat = max(typat)

            if ntypat == 1:

                atom1 = 1
                atom2 = 1

            elif ntypat >= 2:

                atom1 = self.CBox1.currentIndex()
                atom2 = self.CBox2.currentIndex()

            dr = self.sbdr.value()
            step = self.sbStep.value()

            self.NeighborDistrib = Analysis.NDF(neib, self.file, atom1, atom2,
                                                dr, step)

            x = self.NeighborDistrib.getR()

            y = self.NeighborDistrib.getNDF()

            try:
                self.GraphNDF.update(x,
                                     y,
                                     'R (Bohr)',
                                     "Neighbor distance",
                                     name=self.name)
            except:
                self.GraphNDF = Graph.graphic(x,
                                              y,
                                              'R (Bohr)',
                                              "Neighbor distance",
                                              average=False,
                                              name=self.name)
            #self.connect(self.GraphRDF, QtCore.SIGNAL("myCustomizedSignal()"), self.close)
            self.GraphNDF.show()

            def close(self):
                self.hide()
                try:
                    del self.GraphNDF
                except:
                    pass

        elif mode1 == 'Proba':

            neib = self.sbn.value()

            typat = self.file.getTypat()
            ntypat = max(typat)

            if ntypat == 1:

                atom1 = 1

            elif ntypat >= 2:

                atom1 = self.CBox1.currentIndex()

            self.Probability = Analysis.Proba(neib, self.file, atom1)

            x = self.Probability.getN()

            y = self.Probability.getProba()

            try:
                self.GraphProba.update(x,
                                       y,
                                       'Neighbor',
                                       "Probability",
                                       name=self.name)
            except:
                self.GraphProba = Graph.graphic(x,
                                                y,
                                                'Neighbor',
                                                "Probability",
                                                average=False,
                                                name=self.name)
            #self.connect(self.GraphRDF, QtCore.SIGNAL("myCustomizedSignal()"), self.close)
            self.GraphProba.show()
Example #14
0
    def changeMode(self):

        mode1 = self.sbm1.currentText()
        mode2 = self.sbm2.currentText()

        self.marker_size = 2  #Set maker_size to 2 (except average)
        self.markerscale = 5  #Set the relative size of legend marker vs original

        if self.sbrel.isChecked():
            reduced = True
            unit = 1  # No Conversion
            legend = ""
        else:
            reduced = False
            unit = self.units['Distance'][1]
            legend = " (" + str(self.units['Distance'][0]) + ")"
        option = 0

        if mode1 == 'Average':
            option = 1
            self.marker_size = 5  #set marker_size to 5 (better for visualization)
            self.markerscale = 2
        elif mode1 == 'PBC (cubic only)':
            option = 2

        for itype in range(1, self.ntypat + 1):

            indexAtom = array(
                [i for i, x in enumerate(self.typat) if x == itype], dtype=int)

            self.pos_conv = Atom.convert_position(self.file,
                                                  indexAtom,
                                                  option=option,
                                                  reduced=reduced)

            if mode2 == 'XY':
                self.x = self.pos_conv.getX()
                self.y = self.pos_conv.getY()
                self.legend_x = "x" + legend
                self.legend_y = "y" + legend

            elif mode2 == 'XZ':
                self.x = self.pos_conv.getX()
                self.y = self.pos_conv.getZ()
                self.legend_x = "x" + legend
                self.legend_y = "z" + legend

            else:
                self.x = self.pos_conv.getY()
                self.y = self.pos_conv.getZ()
                self.legend_x = "y" + legend
                self.legend_y = "z " + legend

            if itype == 1:
                try:
                    self.graphPosition.updatePos(self.x*unit,self.y*unit,\
                                                     self.legend_x,\
                                                     self.legend_y,\
                                                     marker_size=self.marker_size, name = self.name)
                except:
                    self.graphPosition = Graph.graphic(self.x*unit,self.y*unit,\
                                                           self.legend_x,\
                                                           self.legend_y,\
                                                           average=False,point = True,marker='.',\
                                                           marker_size=self.marker_size,name = self.name)
            else:
                self.graphPosition.addPlot(self.x*unit,self.y*unit,\
                                               point=True,marker_size=self.marker_size)

        self.legend = []
        for i in range(self.ntypat):
            self.legend.append(str(self.PTOE.getName(self.file.getZnucl()[i])))

        self.graphPosition.addLegend(self.legend, markerscale=self.markerscale)
        self.graphPosition.show()