示例#1
0
class PWInput(QEInput):
    def __init__(self, filename=None, config=None):
        QEInput.__init__(self, filename, config, type='pw')
        self.structure = QEStructure(self)
        self.kpoints = PWKpoints(self)

    def parse(self):
        """ Parses the configuration file and stores the values in qe dictionary
            Initializes structure as well"""
        (self.header, self.namelists, self.cards,
         self.attach) = self.parser.parse()
        self.structure.parseInput()
        self.kpoints.parse()

    def toString(self):
        s = ''
        namelistOrder = {
            0: 'control',
            1: 'system',
            2: 'electrons',
            3: 'ions',
            4: 'cell',
            5: 'phonon',
            6: 'ee'
        }

        cardOrder = {
            0: 'atomic_species',
            1: 'atomic_positions',
            2: 'k_points',
            3: 'cell_parameters',
            4: 'occupations',
            5: 'climbing_images',
            6: 'constraints',
            7: 'collective_vars'
        }
        for i in range(len(namelistOrder)):
            if namelistOrder[i] in self.namelists:
                s += self.namelists[namelistOrder[i]].toString()
                s += '\n'

        for i in range(len(cardOrder)):
            if cardOrder[i] in self.cards:
                s += self.cards[cardOrder[i]].toString()
                s += '\n'
        return s

    def outDir(self):
        self.parse()
        return self.namelist('control').param('outdir', quotes=False)
示例#2
0
class PWInput(QEInput):
    def __init__(self, filename=None, config=None):
        QEInput.__init__(self,filename, config, type='pw')
        self.structure = QEStructure(self)
        self.kpoints = PWKpoints(self)
    def parse(self):
        """ Parses the configuration file and stores the values in qe dictionary
            Initializes structure as well"""
        (self.namelists, self.cards, self.attach) = self.parser.parse()
        self.structure.parseInput()
        self.kpoints.parse()

    def toString(self):
        s = ''
        namelistOrder = {
        0 : 'control',
        1 : 'system',
        2 : 'electrons',
        3 : 'ions',
        4 : 'cell',
        5 : 'phonon',
        6 : 'ee'
        }

        cardOrder = {
        0 : 'atomic_species',
        1 : 'atomic_positions',
        2 : 'k_points',
        3 : 'cell_parameters',
        4:  'occupations',
        5 : 'climbing_images',
        6 : 'constraints',
        7 : 'collective_vars'
        }
        for i in range(len(namelistOrder)):
            if namelistOrder[i] in self.namelists:
                s += self.namelists[namelistOrder[i]].toString()
                s += '\n'

        for i in range(len(cardOrder)):
            if cardOrder[i] in self.cards:
                s += self.cards[cardOrder[i]].toString()
                s += '\n'
        return s

    def outDir(self):
        self.parse()
        return self.namelist('control').param('outdir')[1:-1]
示例#3
0
 def __init__(self, filename=None, config=None):
     QEInput.__init__(self, filename, config, type='pw')
     self.structure = QEStructure(self)
     self.kpoints = PWKpoints(self)
示例#4
0
 def __init__(self, filename=None, config=None):
     QEInput.__init__(self,filename, config, type='pw')
     self.structure = QEStructure(self)
     self.kpoints = PWKpoints(self)