1 from _xml_parser
import XMLRepresentation
2 from _xml_parser
import XMLRestraint
3 from _xml_parser
import XMLOptimization
4 from _xml_parser
import XMLDisplay
8 self.representation =
None
10 self.optimization =
None
14 def add_representation(self, fname):
15 if self.representation:
16 raise Exception,
"Representation cannot be added twice!"
17 self.representation = XMLRepresentation(fname).run()
18 return self.representation
21 raise Exception,
"Restraint cannot be added twice!"
22 if not self.representation:
23 raise Exception,
"Please add Representation before Restraint!"
24 self.restraint = XMLRestraint(fname).run()
25 self.restraint.add_to_representation(self.representation)
27 def add_optimization(self, fname):
29 raise Exception,
"Optimization cannot be added twice!"
30 self.optimization = XMLOptimization(fname).run()
31 return self.optimization
32 def add_display(self, fname, logname=None):
34 raise Exception,
"Display cannot be added twice!"
35 self.display = XMLDisplay(fname).run()
36 self._logname = logname
39 def _create_log(self):
41 if self.display
and self.representation:
42 if not self.restraint:
43 self.representation.get_model()
45 logname = self._logname
47 logname =
'log%03d.py'
48 self.log = self.display.create_log(self.representation, logname)
49 self.log.set_was_used(
True)
52 if not self.representation:
53 raise Exception,
"Representation missing!"
57 self.optimization.run(self.restraint, self.log)
59 self.optimization.run(self.restraint,
None)
60 elif self.optimization:
61 raise Exception,
"Restraint missing!"
63 if self.representation:
64 return self.representation._model
66 raise Exception,
"Representation missing!"