예제 #1
0
        public virtual void bondAminoHydrogen(int indexDonor, Point3f hydrogenPoint, BitArray bsA, BitArray bsB)
        {
            AminoMonomer source              = (AminoMonomer)monomers[indexDonor];
            Point3f      sourceAlphaPoint    = source.LeadAtomPoint;
            Point3f      sourceNitrogenPoint = source.NitrogenAtomPoint;
            int          energyMin1          = 0;
            int          energyMin2          = 0;
            int          indexMin1           = -1;
            int          indexMin2           = -1;

            for (int i = monomerCount; --i >= 0;)
            {
                if ((i == indexDonor || (i + 1) == indexDonor) || (i - 1) == indexDonor)
                {
                    continue;
                }
                AminoMonomer target           = (AminoMonomer)monomers[i];
                Point3f      targetAlphaPoint = target.LeadAtomPoint;
                float        dist2            = sourceAlphaPoint.distanceSquared(targetAlphaPoint);
                if (dist2 > maxHbondAlphaDistance2)
                {
                    continue;
                }
                int energy = calcHbondEnergy(sourceNitrogenPoint, hydrogenPoint, target);
                if (debugHbonds)
                {
                    System.Console.Out.WriteLine("HbondEnergy=" + energy + " dist2=" + dist2 + " max^2=" + maxHbondAlphaDistance2);
                }
                if (energy < energyMin1)
                {
                    energyMin2 = energyMin1;
                    indexMin2  = indexMin1;
                    energyMin1 = energy;
                    indexMin1  = i;
                }
                else if (energy < energyMin2)
                {
                    energyMin2 = energy;
                    indexMin2  = i;
                }
            }
            if (indexMin1 >= 0)
            {
                mainchainHbondOffsets[indexDonor] = (short)(indexDonor - indexMin1);
                min1Indexes[indexDonor]           = (short)indexMin1;
                min1Energies[indexDonor]          = (short)energyMin1;
                createResidueHydrogenBond(indexDonor, indexMin1, bsA, bsB);
                if (indexMin2 >= 0)
                {
                    createResidueHydrogenBond(indexDonor, indexMin2, bsA, bsB);
                    min2Indexes[indexDonor]  = (short)indexMin2;
                    min2Energies[indexDonor] = (short)energyMin2;
                }
            }
        }
예제 #2
0
파일: Atom.cs 프로젝트: carlhuth/GenXSource
        // find the longest bond to discard
        // but return null if atomChallenger is longer than any
        // established bonds
        // note that this algorithm works when maximum valence == 0
        public Bond getLongestBondToDiscard(Atom atomChallenger)
        {
            float dist2Longest = point3f.distanceSquared(atomChallenger.point3f);
            Bond  bondLongest  = null;

            for (int i = bonds.Length; --i >= 0;)
            {
                Bond  bond      = bonds[i];
                Atom  atomOther = bond.atom1 != this?bond.atom1:bond.atom2;
                float dist2     = point3f.distanceSquared(atomOther.point3f);
                if (dist2 > dist2Longest)
                {
                    bondLongest  = bond;
                    dist2Longest = dist2;
                }
            }
            //    out.println("atom at " + point3f + " suggests discard of " +
            //                       bondLongest + " dist2=" + dist2Longest);
            return(bondLongest);
        }
예제 #3
0
        public virtual int calcHbondEnergy(Point3f nitrogenPoint, Point3f hydrogenPoint, AminoMonomer target)
        {
            Point3f targetOxygenPoint = target.CarbonylOxygenAtomPoint;

            float distON2 = targetOxygenPoint.distanceSquared(nitrogenPoint);

            if (distON2 < minimumHbondDistance2)
            {
                return(-9900);
            }

            //why would this not have been in here? RMH 03/8/06
            //   if (distON2 > hbondMax2)
            //      return 0;
            //nevermind! :)

            if (debugHbonds)
            {
                System.Console.Out.WriteLine("calchbondenergy: " + hydrogenPoint.x + "," + hydrogenPoint.y + "," + hydrogenPoint.z);
            }

            float distOH2 = targetOxygenPoint.distanceSquared(hydrogenPoint);

            if (distOH2 < minimumHbondDistance2)
            {
                return(-9900);
            }

            Point3f targetCarbonPoint = target.CarbonylCarbonAtomPoint;
            float   distCH2           = targetCarbonPoint.distanceSquared(hydrogenPoint);

            if (distCH2 < minimumHbondDistance2)
            {
                return(-9900);
            }

            float distCN2 = targetCarbonPoint.distanceSquared(nitrogenPoint);

            if (distCN2 < minimumHbondDistance2)
            {
                return(-9900);
            }

            double distOH = System.Math.Sqrt(distOH2);
            double distCH = System.Math.Sqrt(distCH2);
            double distCN = System.Math.Sqrt(distCN2);
            double distON = System.Math.Sqrt(distON2);

            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            int energy = (int)((QConst / distOH - QConst / distCH + QConst / distCN - QConst / distON));

            if (debugHbonds)
            {
                System.Console.Out.WriteLine(" distOH=" + distOH + " distCH=" + distCH + " distCN=" + distCN + " distON=" + distON + " energy=" + energy);
            }
            if (energy < -9900)
            {
                return(-9900);
            }
            if (energy > -500)
            {
                return(0);
            }
            return(energy);
        }