Esempio n. 1
0
        private void SaveDistances(String rfilename)
        {
            LabelingPosition l1, l2;

            LabelingPosition[] l1index = new LabelingPosition[dist.Count];
            LabelingPosition[] l2index = new LabelingPosition[dist.Count];
            Double             R;

            using (StreamWriter sw = new StreamWriter(rfilename + "_Rmp.txt", false))
            {
                sw.Write("Structure\tNumber");
                for (Int32 i = 0; i < dist.Count; i++)
                {
                    l1         = labelingpos.Find(dist[i].Position1);
                    l2         = labelingpos.Find(dist[i].Position2);
                    l1index[i] = l1;
                    l2index[i] = l2;
                    sw.Write('\t' + l1.Name + '_' + l2.Name);
                }
                sw.WriteLine();
                for (Int32 j = 0; j < _dataToSave.Length; j++)
                {
                    sw.Write(filenametextBox.Text + _dataToSave[j].InternalNumber.ToString() + '\t' + _dataToSave[j].InternalNumber.ToString());
                    for (Int32 i = 0; i < dist.Count; i++)
                    {
                        sw.Write('\t' + _dataToSave[j].ModelDistance(l1index[i], l2index[i]).ToString("F3"));
                    }
                    sw.WriteLine();
                }
                sw.Close();
            }

            // saving converted distances if requested
            if (dist.DataType != DistanceDataType.Rmp)
            {
                using (StreamWriter sw = new StreamWriter(rfilename + '_' + dist.DataType.ToString() + ".txt", false))
                {
                    sw.Write("Structure\tNumber");
                    for (Int32 i = 0; i < dist.Count; i++)
                    {
                        l1 = labelingpos.Find(dist[i].Position1);
                        l2 = labelingpos.Find(dist[i].Position2);
                        sw.Write('\t' + l1.Name + '_' + l2.Name);
                    }
                    sw.WriteLine();
                    for (Int32 j = 0; j < _dataToSave.Length; j++)
                    {
                        sw.Write(filenametextBox.Text + _dataToSave[j].InternalNumber.ToString() + '\t' + _dataToSave[j].InternalNumber.ToString());
                        for (Int32 i = 0; i < dist.Count; i++)
                        {
                            R = (l1index[i].Dye != DyeType.Unknown && l2index[i].Dye != DyeType.Unknown) ?
                                Distance.Convert(_dataToSave[j].ModelDistance(l1index[i], l2index[i]), _globalcf) : _dataToSave[j].ModelDistance(l1index[i], l2index[i]);
                            sw.Write('\t' + R.ToString("F3"));
                        }
                        sw.WriteLine();
                    }
                    sw.Close();
                }
            }
        }
Esempio n. 2
0
        public static LabelingPosition operator -(LabelingPosition l, Vector3 v)
        {
            LabelingPosition l1 = l;

            l1.X = l.X - v.X;
            l1.Y = l.Y - v.Y;
            l1.Z = l.Z - v.Z;
            return(l1);
        }
Esempio n. 3
0
 /// <summary>
 /// Calculates the accesible volume for a given labeling position.
 /// </summary>
 /// <param name="lp">Labeling position</param>
 public void Calculate(LabelingPosition lp)
 {
     if (lp.AVData.AVType == AVSimlationType.SingleDyeR)
     {
         this.Calculate1R(lp.AVData.L, lp.AVData.W, lp.AVData.R,
                          Array.BinarySearch <Int32>(this.mol.OriginalAtomID, lp.AVData.AtomID));
     }
     else if (lp.AVData.AVType == AVSimlationType.ThreeDyeR)
     {
         this.Calculate3R(lp.AVData.L, lp.AVData.W, lp.AVData.R1, lp.AVData.R2, lp.AVData.R3,
                          Array.BinarySearch <Int32>(this.mol.OriginalAtomID, lp.AVData.AtomID));
     }
     else
     {
         throw new ArgumentException("Cannot calculate AV for a labeling position of type " + lp.AVData.AVType.ToString());
     }
 }
Esempio n. 4
0
        private void addbutton_Click(object sender, EventArgs e)
        {
            if (_lastcalculated == null)
            {
                return;
            }
            LabelingPosition l = new LabelingPosition();

            l.Molecule       = _lastcalculated.Name;
            l.Name           = lpnametextBox.Text;
            l.X              = ave.Rmp.X; l.Y = ave.Rmp.Y; l.Z = ave.Rmp.Z;
            l.Dye            = this.DradioButton.Checked ? DyeType.Donor : DyeType.Acceptor;
            l.AVData.AVType  = (AVSimlationType)(simcombobox.SelectedIndex + 1);
            l.AVData.AVReady = true; l.AVData.AtomID = atomIDnumericBoxInt32.Value;
            l.AVData.L       = LnumericBoxDouble.Value; l.AVData.W = WnumericBoxDouble.Value;
            l.AVData.R       = R1numericBoxDouble.Value; l.AVData.R1 = R1numericBoxDouble.Value;
            l.AVData.R2      = R2numericBoxDouble.Value; l.AVData.R3 = R3numericBoxDouble.Value;
            _labelpos.Add(l);
        }
Esempio n. 5
0
        /// <summary>
        /// Model distance between labeling positions l1 and l2
        /// </summary>
        /// <param name="l1">position 1</param>
        /// <param name="l2">position 2</param>
        /// <returns>Model distance</returns>
        public Double ModelDistance(LabelingPosition l1, LabelingPosition l2)
        {
            Int32 im1 = this.Molecules.FindIndex(l1.Molecule);
            Int32 im2 = this.Molecules.FindIndex(l2.Molecule);
            // take refined LPs if available
            LabelingPosition lp1ref, lp2ref;

            if ((this.SimulationMethod & SimulationMethods.Refinement) != 0 && this.RefinedLabelingPositions != null)
            {
                lp1ref = this.RefinedLabelingPositions.Find(l1.Name);
                lp2ref = this.RefinedLabelingPositions.Find(l2.Name);
            }
            else
            {
                lp1ref = l1;
                lp2ref = l2;
            }
            Vector3 d = this.Rotation[im1] * (lp1ref - this.Molecules[im1].CM) + this.Molecules[im1].CM + this.Translation[im1]
                        - this.Rotation[im2] * (lp2ref - this.Molecules[im2].CM) - this.Molecules[im2].CM - this.Translation[im2];

            return(Vector3.Abs(d));
        }