From c57a843db4f175cdfb2fbc1ccf3f3954f9766a43 Mon Sep 17 00:00:00 2001 From: Jaron Krogel Date: Mon, 6 Nov 2017 13:19:57 -0500 Subject: [PATCH] nexus: include changes in pwscf_postprocessors --- nexus/library/pwscf_postprocessors.py | 32 +++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/nexus/library/pwscf_postprocessors.py b/nexus/library/pwscf_postprocessors.py index 49e0659f9..9046f03fc 100644 --- a/nexus/library/pwscf_postprocessors.py +++ b/nexus/library/pwscf_postprocessors.py @@ -339,23 +339,21 @@ class NamelistInput(SimulationInput): def write_text(self,filepath=None): cls = self.__class__ text = '' - if len(cls.namelist_set)==0: - for name,namelist in self.iteritems(): - text += namelist.write_text()+'\n' - #end for - else: - for name,namelist in self.iteritems(): - if name in cls.namelist_set: - text += namelist.write_text()+'\n' - else: - msg = 'encountered invalid namelist during write\ninvalid namelist: {0}\nvalid namelists are: {1}'.format(name,cls.namelists) - if filepath!=None: - msg += '\nfilepath: {0}'.format(filepath) - #end if - self.error(msg) + for name,namelist in self.iteritems(): + if name not in cls.namelist_set: + msg = 'encountered invalid namelist during write\ninvalid namelist: {0}\nvalid namelists are: {1}'.format(name,cls.namelists) + if filepath!=None: + msg += '\nfilepath: {0}'.format(filepath) #end if - #end for - #end if + self.error(msg) + #end if + #end for + for name in cls.namelists: + if name in self: + namelist = self[name] + text += namelist.write_text()+'\n' + #end if + #end for return text #end def write_text #end class NamelistInput @@ -411,7 +409,7 @@ class PPPlotNamelist(Namelist): class PPInput(NamelistInput): - namelists = ['pp'] + namelists = ['inputpp','plot'] namelist_classes = obj( inputpp = PPInputppNamelist, plot = PPPlotNamelist,