code: def write(self, outputfile='out.pdb', appended=False):
          
          # FIXME some cases don't work.
          matrix = self.get_matrix(**self.get_current_values())
  
          out = open(outputfile, 'w')
          atomid = 1
          if appended:
              for line in open(self.pdb1):
                  if not line.startswith('ATOM') or (line[21] != self.chain_1 and line[21] != ' '):
                      continue
                  out.write(line[:7])
                  out.write('{: >4}'.format(atomid))
                  atomid += 1
                  out.write(line[11:21])
                  out.write('A')
                  out.write(line[22:])
  
          for line in open(self.pdb2):
              if not line.startswith('ATOM') or (line[21] != self.chain_2 and line[21] != ' '):
                  continue
  
              x = float(line[32:38])
              y = float(line[39:46])
              z = float(line[48:54])
              vec = np.array([x, y, z, 1])
              x, y, z, _ = matrix.dot(vec)
  
              out.write(line[:7])
              out.write('{: >4}'.format(atomid))
              atomid += 1
              out.write(line[11:21])
              out.write('B')
              out.write(line[22:30])
              out.write('{:>8.3f}{:>8.3f}{:>8.3f}'.format(x, y, z))
              out.write(line[54:])
  
          out.close()
docs: Save the second PDB file aligned to the first.
  
          If appended is True, both are saved as different chains.