Beispiel #1
0
 public Pdb GetTransformed(Trans3 trans)
 {
     Element[] nelements = new Element[elements.Length];
     for (int i = 0; i < elements.Length; i++)
     {
         if (typeof(Atom).IsInstanceOfType(elements[i]))
         {
             Atom   atom = (Atom)elements[i];
             Vector pt   = atom.coord;
             pt           = trans.DoTransform(pt);
             atom         = Atom.FromString(atom.GetUpdatedLine(pt));
             nelements[i] = atom;
         }
         else if (typeof(Hetatm).IsInstanceOfType(elements[i]))
         {
             Hetatm hetatm = (Hetatm)elements[i];
             Vector pt     = hetatm.coord;
             pt           = trans.DoTransform(pt);
             hetatm       = Hetatm.FromString(hetatm.GetUpdatedLine(pt));
             nelements[i] = hetatm;
         }
         else
         {
             nelements[i] = elements[i].UpdateElement();
         }
     }
     return(new Pdb(nelements));
 }
Beispiel #2
0
 public Pdb CloneUpdateCoord(Dictionary <IAtom, Vector> iatom2coord)
 {
     Element[] newelements = new Element[elements.Length];
     for (int i = 0; i < elements.Length; i++)
     {
         Element elem = elements[i];
         if (elem is IAtom)
         {
             if (iatom2coord.ContainsKey(elem as IAtom))
             {
                 Vector  coord = iatom2coord[elem as IAtom];
                 Element nelem = null;
                 if (elem is Atom)
                 {
                     if (nelem != null)
                     {
                         throw new HException("(nelem != null)");
                     }
                     Atom atom = elem as Atom;
                     nelem = Atom.FromString(atom.GetUpdatedLine(coord));
                 }
                 if (elem is Hetatm)
                 {
                     if (nelem != null)
                     {
                         throw new HException("(nelem != null)");
                     }
                     Hetatm hetatm = elem as Hetatm;
                     nelem = Hetatm.FromString(hetatm.GetUpdatedLine(coord));
                 }
                 if (nelem == null)
                 {
                     throw new NotImplementedException();
                 }
                 elem = nelem;
             }
         }
         newelements[i] = elem.UpdateElement();
     }
     return(new Pdb(newelements));
 }