def type_to_str(self): """ Changes the type to a string, matching XPLOR conventions. This can only be done if a type mapping has been loaded (i.e., if the type attribute is not None). If the type identifier is not already a string and no mapping is available, MissingParameter is raised. """ if isinstance(self.attype, str): return if self.type is None: raise MissingParameter('No type mapping loaded. Cannot change ' 'type identifier to string for %s' % self.attype) self.attype = self.type.name
def type_to_int(self): """ Changes the type to an integer, matching CHARMM conventions. This can only be done if a type mapping has been loaded (i.e., if the type attribute is not None). If the type identifier is not already an integer and no mapping is available, MissingParameter is raised. """ if isinstance(self.attype, int): return if self.type is None: raise MissingParameter('No type mapping loaded. Cannot change ' 'type identifier to integer for %s' % self.attype) self.attype = self.type.number