Open andrewsb8 opened 9 months ago
Some valgrind output indicating a stack overflow in recursivePairSearch
:
Command: valgrind --show-leak-kinds=all --log-file=villin-read-log --leak-check=full --track-origins=yes ./drop -f measureDihedrals -i examples/Villin-Headpiece/villin-unfolded-conect.pdb
==10026== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==10026==
==10026== Process terminating with default action of signal 11 (SIGSEGV)
==10026== Access not within mapped region at address 0x1FFE801FFC
==10026== Stack overflow in thread #1: can't grow stack to 0x1ffe801000
==10026== at 0x10CD45: recursivePairSearch (in /home/bandrews/projects/DROP/drop)
==10026== If you believe this happened as a result of a stack
==10026== overflow in your program's main thread (unlikely but
==10026== possible), you can try to increase the size of the
==10026== main thread stack using the --main-stacksize= flag.
==10026== The main thread stack size used in this run was 8388608.
Wonder if I could set recursion depth limit? Then if the program doesn't find the path just have a marker that says it's greater than x number of bonds away. This avoids a rewrite for an iterative solution or a complicated data structure to calculate a number whose value doesn't ultimately matter.
Or, just turn off calculating the covalentBondMatrix
calculation for modules which don't require it. For example, modules measureDihedral
, setDihedral
, and setDihedralList
do not in principle require this calculation to be done.
identifyDihedrals
still uses CONECT records so this could be changed to just detect from the ATOM listings in the pdb or other input structure file for flexibility. But, that is a different conversation/issue entirely.
Have officially confirmed that the seg fault is from recursion depth from counting covalent bonds between pairs of atoms. Instead of taking a short cut, I will implement an iterative solution. It could take the following form:
for(i = 0; i < number of atoms; i++)
{
int array[number of atoms - i];
for(j = i + 1; j < number of atoms; j++)
{
found = 0
while(found == 0)
{ search for connection in bonds struct }
}
}
The iterative list search will probably be backtracking in style but some details will have to be ironed out.
Seg fault, with no log outputs, is the result when using
-i examples/Villin-Headpiece/villin-unfolded-conect.pdb
as an input file. Can be a memory leak or need to test on system with more system memory.