Esempio n. 1
0
 /// <summary>Sets the parameters attribute of the ForceFieldConfigurator object, default is mm2 force field</summary>
 public void SetMM2Parameters()
 {
     try
     {
         if (mm2 == null)
         {
             mm2 = new MM2BasedParameterSetReader();
         }
         mm2.ReadParameterSets();
     }
     catch (Exception ex1)
     {
         throw new CDKException("Problem within readParameterSets due to:" + ex1.ToString(), ex1);
     }
     parameterSet = mm2.GetParamterSet();
     atomTypes    = mm2.AtomTypes;
 }
Esempio n. 2
0
        /// <summary>
        ///Constructor for the ForceFieldConfigurator object
        /// </summary>
        /// <param name="ffname">name of the force field data file</param>
        public void SetForceFieldConfigurator(string ffname)
        {
            ffname = ffname.ToLowerInvariant();
            bool check = false;

            if (ffname == ffName && parameterSet != null)
            {
            }
            else
            {
                check  = this.CheckForceFieldType(ffname);
                ffName = ffname;
                if (string.Equals(ffName, "mm2", StringComparison.Ordinal))
                {
                    ins = ResourceLoader.GetAsStream("NCDK.Modelings.ForceField.Data.mm2.prm");
                    mm2 = new MM2BasedParameterSetReader();
                    mm2.SetInputStream(ins);
                    try
                    {
                        this.SetMM2Parameters();
                    }
                    catch (Exception ex1)
                    {
                        throw new CDKException("Problems with set MM2Parameters due to " + ex1.ToString(), ex1);
                    }
                }
                else if (ffName.Equals("mmff94", StringComparison.Ordinal) || !check)
                {
                    ins    = ResourceLoader.GetAsStream("NCDK.Modelings.ForceField.Data.mmff94.prm");
                    mmff94 = new MMFF94BasedParameterSetReader();

                    mmff94.SetInputStream(ins);
                    try
                    {
                        this.SetMMFF94Parameters();
                    }
                    catch (Exception ex2)
                    {
                        throw new CDKException("Problems with set MM2Parameters due to" + ex2.ToString(), ex2);
                    }
                }
            }
        }