Esempio n. 1
0
 /// <summary>
 /// Main method which assigns MMFF94 partial charges
 /// </summary>
 /// <param name="ac">AtomContainer</param>
 /// <returns>AtomContainer with MMFF94 partial charges as atom properties</returns>
 public IAtomContainer AssignMMFF94PartialCharges(IAtomContainer ac)
 {
     if (!mmff.AssignAtomTypes(ac))
     {
         throw new CDKException("Molecule had an atom of unknown MMFF type");
     }
     mmff.PartialCharges(ac);
     mmff.ClearProps(ac);
     foreach (var atom in ac.Atoms)
     {
         atom.SetProperty(Key, atom.Charge);
     }
     return(ac);
 }
Esempio n. 2
0
        public PartialTChargeMMFF94Descriptor(IAtomContainer container)
        {
            foreach (var atom in container.Atoms)
            {
                if (atom.ImplicitHydrogenCount == null || atom.ImplicitHydrogenCount != 0)
                {
                    throw new CDKException("Hydrogens must be explicit for MMFF charge calculation");
                }
            }

            clonedContainer = (IAtomContainer)container.Clone();
            var mmff = new Mmff();

            if (!mmff.AssignAtomTypes(clonedContainer))
            {
                Trace.TraceWarning("One or more atoms could not be assigned an MMFF atom type");
            }
            mmff.PartialCharges(clonedContainer);
            mmff.ClearProps(clonedContainer);

            this.container = container;
        }