Technical Support Forum
Access ChemAxon scientists and developers here. For registration and login issues contact website support.

## Support Ticket System is replacing forum

This forum was converted into a searchable archive. You cannot add posts here any more. For support please use our new Ticket System.

Create your first ticket
 First Zagreb index with JChem or Excel Plugin To watch this topic for replies  Register (enables digests) or give email address:
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
Author Message
 Mikhail Joined: 21 May 2014 Posts: 3 Back to top
 Posted: Fri Aug 22, 2014 8:55 amPost subject: First Zagreb index with JChem or Excel Plugin Dear all, A newbie question: How do I calculate the First Zagreb index (the sum of vertex degrees' squares over all vertices of a molecular graph) for a collection of molecules in JChem or in Excel plugin? In fact, a simple function would be enough, which returns the degree of the i-th atom in a given molecule. Is there a standard API function (calculation) for this?  Regards, Mike
 László ChemAxon personnel Joined: 14 Jan 2011 Posts: 78 Back to top
 Posted: Wed Aug 27, 2014 2:50 pmPost subject: Dear Mike, Yes, there is: Molecule.getLigandCount(MolAtom)Could you share with us why you would like to calculate the Zagreb index? BR,Laszlo
 Mikhail Joined: 21 May 2014 Posts: 3 Back to top
 Posted: Tue Sep 02, 2014 2:33 pmPost subject: Dear Laszlo, Thanks a lot for the advice, I'll try. I used a simple custom code in Excel Addin as a workaround to calculate the second Zagreb Index and the ABC index. I post the code below, if someone's interested. It works rather solwly, but it solved my problem. I use degree-based indices as a branchieness metric in my regressions for boiling points and chromatography retention indices.   Public Function JCDegree(Mol As Range, Atom As Integer) n = JCHeavyAtomCount(Mol) If Atom < n Then d = 0 For i = 0 To n - 1 l = JCShortestPath(Mol, Atom, i) If l = 1 Then d = d + 1 End If Next JCDegree = d Else JCDegree = 0 End If End Function   Public Function JCSecondZagreb(Mol As Range) n = JCHeavyAtomCount(Mol) JCSecondZagreb = 0 Dim i As Integer Dim j As Integer   For i = 0 To n - 1 For j = 0 To n - 1 l = JCShortestPath(Mol, i, j) If l = 1 Then JCSecondZagreb = JCSecondZagreb + JCDegree(Mol, i) * JCDegree(Mol, j) End If Next Next End Function   Public Function JCABCIndex(Mol As Range)   n = JCHeavyAtomCount(Mol) JCABCIndex = 0 Dim i As Integer Dim j As Integer   For i = 0 To n - 1 For j = 0 To n - 1 l = JCShortestPath(Mol, i, j) If l = 1 Then d1 = JCDegree(Mol, i) d2 = JCDegree(Mol, j) JCABCIndex = JCABCIndex + Sqr((d1 + d2 - 2) / (d1 * d2)) End If Next Next End Function
 Mikhail Joined: 21 May 2014 Posts: 3 Back to top
 Posted: Tue Sep 02, 2014 4:33 pmPost subject: Laszlo,   calculated field with code def d=0 for (atom in Mol.getNative().getAtomIterator()) { d=d+Mol.getNative().getLigandCount(atom)**2; } return d;   works fine in ChemAxon, Thnx, Mike
 Page 1 of 1

 Jump to: Select a forum Support----------------Drawing & visualization: Marvin/Sketch /View /SpaceDrawing & visualization: Marvin JSStorage & search: JChem Base and JChem Oracle CartridgeStorage & search: JChem PostgreSQL CartridgeStructure representation: molecule handling and file formatsStorage & search: Instant JChemStorage & search: Markush search & enumerationStorage & search: JChem for Excel, OfficeStorage & search: JChem for SharePointStorage & search: Compound RegistrationPlexus SuiteChemCuratorNaming & Chemistry Text Mining SuiteMarkush EditorBiomolecule Editor: BioEddieStructure based predictions: Calculator Plugins & Chemical TermsStructure manipulation: Canonicalization / standardizationStructure manipulation: Reactor, MetabolizerLibrary profiling: Virtual screening, clustering & molecular descriptorsIntegration: JChem Web ServicesIntegration: .NETIntegration: KNIMEIntegration: Pipeline PilotIntegration: ChemAxon Clipboard and Data transferOther: Installation issuesOther: License issuesDeprecationchemicalize.org Contributions----------------SoftwareCourse works Implementations----------------Public implementationsOffline & not public implementations Academic Package----------------Application FormQ & ANewsListingAcademic Challenge Q&A User Group Meeting----------------2009 US User Group MeetingSan Diego 2009San Diego 2009 pixBudapest 2009Boston 2008Visegrad 2008Future eventsBudapest 2007Budapest 2006Budapest 2005 Site feedback---------------- Problems and missing pages/features with the new site
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum