Quantcast

Unity3D + OpenBabel Crashing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unity3D + OpenBabel Crashing

Brian Adams

Hi, 


I'm having some trouble with some code I'm using in Unity with C#.


Simply put, the code attempts to display a ligand and the surrounding protein residues within 5 angstroms.


Unfortunately, I'm getting very strange errors and inconsistent ones at that. When I take a gander at my debug log, the stack trace shows the last functions attempted before crash; either GetAtoms() or GetResidue(). Also, when I ran an assembly debug, the error was an access violation from openbabel_csharp at 0x........ 


The hex didn't indicate that it might have been a null pointer exception issue and I confirmed through some print statements that it really couldn't be possible. 


Below is the code:

/**********************************************************************************************************************/

        //ligandVec and proteinVec are lists of Vector3s taken during the main loop so I could do this analysis
 
        if (ligandVec.Count != 0 & proteinVec.Count != 0)// simple check for list size ensure no bound issues
        { 
           for (int i = 0; i < ligandVec.Count; i++)
            {
                for (int k = 0; k < proteinVec.Count; k++)
                {
                                        float dis = 5;
                                        if (Vector3.Distance (ligandVec [i], proteinVec [k]) <= dis & proteinResAt[k] == true) 
                                          {      
                                          //Add all atoms in residue to a tempList to be used later in the toggle section
                                                //This is where most of my issues show up where if I were to store the atoms from the residue like so:
                                                test = proteinAtom[k].GetResidue().GetAtoms(); //test being a VectorpAtom
                                                for(int j = 0; j < test.Count; j ++)
                                                     tempList.Add(test[j]);
}
                    }
              }
           }
 /*********************************************************************************************************************/

I apologize for my code formatting; Outlook hasn't been very accommodating for my code. :/

If anyone has any suggestions or possible solutions I would be very grateful. :) Also, if you have any further questions to explain a bit more feel free.

Brian Adams
B.A. in Computer Science
Duquesne University
Phone: 412-926-0430

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unity3D + OpenBabel Crashing

Stefano Forli
Brian,
not sure if related, but I had a similar issue a while ago, take a look here:

  https://sourceforge.net/p/openbabel/mailman/message/32893219/

Maybe it helps,

S

--

 Stefano Forli, PhD

 Assistant Professor of Integrative
 Structural and Computational Biology,
 Molecular Graphics Laboratory

 Dept. of Integrative Structural
  and Computational Biology, MB-112F
 The Scripps Research Institute
 10550  North Torrey Pines Road
 La Jolla,  CA 92037-1000,  USA.

    tel: +1 (858)784-2055
    fax: +1 (858)784-2860
    email: [hidden email]
    http://www.scripps.edu/~forli/
________________________________________
From: Brian Adams [[hidden email]]
Sent: Monday, June 13, 2016 2:45 PM
To: [hidden email]
Subject: [Open Babel] Unity3D + OpenBabel Crashing

Hi,


I'm having some trouble with some code I'm using in Unity with C#.


Simply put, the code attempts to display a ligand and the surrounding protein residues within 5 angstroms.


Unfortunately, I'm getting very strange errors and inconsistent ones at that. When I take a gander at my debug log, the stack trace shows the last functions attempted before crash; either GetAtoms() or GetResidue(). Also, when I ran an assembly debug, the error was an access violation from openbabel_csharp at 0x........


The hex didn't indicate that it might have been a null pointer exception issue and I confirmed through some print statements that it really couldn't be possible.


Below is the code:

/**********************************************************************************************************************/

        //ligandVec and proteinVec are lists of Vector3s taken during the main loop so I could do this analysis

        if (ligandVec.Count != 0 & proteinVec.Count != 0)// simple check for list size ensure no bound issues
        {
           for (int i = 0; i < ligandVec.Count; i++)
            {
                for (int k = 0; k < proteinVec.Count; k++)
                {
                                        float dis = 5;
                                        if (Vector3.Distance (ligandVec [i], proteinVec [k]) <= dis & proteinResAt[k] == true)
                                          {
                                          //Add all atoms in residue to a tempList to be used later in the toggle section
                                                //This is where most of my issues show up where if I were to store the atoms from the residue like so:
                                                test = proteinAtom[k].GetResidue().GetAtoms(); //test being a VectorpAtom
                                                for(int j = 0; j < test.Count; j ++)
                                                     tempList.Add(test[j]);
}
                    }
              }
           }
 /*********************************************************************************************************************/

I apologize for my code formatting; Outlook hasn't been very accommodating for my code. :/

If anyone has any suggestions or possible solutions I would be very grateful. :) Also, if you have any further questions to explain a bit more feel free.


Brian Adams
B.A. in Computer Science
Duquesne University
Phone: 412-926-0430
e-mail: [hidden email]
________________________________
NOTE: This message was trained as non-spam. If this is wrong, please correct the training as soon as possible.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unity3D + OpenBabel Crashing

Geoff Hutchison
In reply to this post by Brian Adams
I'm having some trouble with some code I'm using in Unity with C#.

While you may be using C#, the underlying code is still C++. It's quite clear that you have some atoms with NULL residues (i.e., they don't have residues set) and there are possibly some residues with NULL atoms. (Don't trust PDB files. Period.)

I'd do some "defensive programming" and make sure the GetResidue() returns a real pointer,etc.

Hope that helps,
-Geoff


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Loading...