Exemple #1
0
 def save(self, filename=None):
     if filename == None:
         if self._setting != None:
             self.filename = self._setting.get(self.type()+'Input')
         QEInput.save(self)
     else:
         QEInput.save(self, filename)
Exemple #2
0
 def save(self, filename=None):
     if filename == None:
         if self._setting != None:
             self.filename = self._setting.get(self.type() + 'Input')
         QEInput.save(self)
     else:
         QEInput.save(self, filename)
Exemple #3
0
    def test_qeinput_save(self):
        fname   = "temp.in"
        input   = QEInput(config=fixtures.textMain)
        input.save(fname)
        self.assertTrue(filecmp.cmp(fname, "ref.in"))

        try:
            os.remove(fname)
        except OSError:
            pass    # Doesn't exist
Exemple #4
0
    def test_qeinput_save(self):
        fname = "temp.in"
        input = QEInput(config=fixtures.textMain)
        input.save(fname)
        self.assertTrue(filecmp.cmp(fname, "ref.in"))

        try:
            os.remove(fname)
        except OSError:
            pass  # Doesn't exist
    def save(self, fname=None):
        """Writes/updates structure into PW config file,
           if the file does not exist, new one will be created"""
        if fname != None:
            filename = fname
            self.lattice.save(filename)
            qeConf = QEInput(fname)
            qeConf.parse()
        else:
            filename = self.filename
            self.lattice.save(filename)
            qeConf = self.qeConf
        self.updatePWInput(qeConf)

        qeConf.save(filename)
Exemple #6
0
    def save(self, fname=None):
        """Writes/updates structure into PW config file,
           if the file does not exist, new one will be created"""
        if fname != None:
            filename = fname
            self.lattice.save(filename)
            qeConf = QEInput(fname)
            qeConf.parse()
        else:
            filename = self.filename
            self.lattice.save(filename)
            qeConf = self.qeConf
        self.updatePWInput(qeConf)

        qeConf.save(filename)
 def save(self, fname = None):
     """Will save the lattice either into its own file or into supplied with fname.
        It will also create all relevant sections/cards"""
     from os.path import exists
     if fname != None:
         filename = fname
         if not exists(filename):
             f = open(filename, 'w')
         qeConf = QEInput(fname)
         qeConf.parse()
     else:
         qeConf = self.qeConf
         filename = qeConf.filename
     self.updatePWInput(qeConf)                      
     qeConf.save(filename)
Exemple #8
0
 def save(self, fname=None):
     """Will save the lattice either into its own file or into supplied with fname.
        It will also create all relevant sections/cards"""
     from os.path import exists
     if fname != None:
         filename = fname
         if not exists(filename):
             f = open(filename, 'w')
         qeConf = QEInput(fname)
         qeConf.parse()
     else:
         qeConf = self.qeConf
         filename = qeConf.filename
     self.updatePWInput(qeConf)
     qeConf.save(filename)
 def write(self, filename=None, format="pwinput"):
     """Save structure to file in the specified format
     format   -- structure formats
                 'pwinput' ( pw.x input, default), 'pwoutput' (pw.x output),
                 'bratoms', 'cif', 'discus', 'pdb', 'pdffit', 'rawxyz', 
                 'xcfg', 'xyz'        
     No return value.
     """
     if format == "pwinput":
         self._qeInput.update(forceUpdate=True)
         if filename == None:
             filename = self._qeInput.filename
         input = QEInput(config=self._qeInput.toString(), type='pw')
         input.save(filename=filename)
     else:
         self.matter().write(filename=filename, format=format)
     return
 def write(self, filename = None, format = "pwinput"):
     """Save structure to file in the specified format
     format   -- structure formats
                 'pwinput' ( pw.x input, default), 'pwoutput' (pw.x output),
                 'bratoms', 'cif', 'discus', 'pdb', 'pdffit', 'rawxyz', 
                 'xcfg', 'xyz'        
     No return value.
     """        
     if format == "pwinput":
         self._qeInput.update( forceUpdate = True )
         if filename == None:
             filename = self._qeInput.filename
         input = QEInput(config = self._qeInput.toString(), type='pw')
         input.save( filename = filename)
     else:
         self.matter().write( filename = filename, format = format )                        
     return