Amber-MD / cpptraj

Biomolecular simulation trajectory/data analysis.
Other
138 stars 64 forks source link

"reference" after "clear all" causes segmentation fault #1039

Closed gaborb91 closed 1 year ago

gaborb91 commented 1 year ago

In the AmberTools23 version of cpptraj, use of the "reference" command after "clear all" can lead to a segmentation fault. Example script:

parm struct1.pdb reference struct1.pdb trajin traj1.nc 1 last 10 rms reference :1-200@CA trajout traj1_fit.nc run

clear all parm struct2.pdb reference struct2.pdb trajin traj2.nc 1 last 10 rms reference :1-200@CA trajout traj2_fit.nc run exit

Maybe this is not the most elegant solution for aligning two trajectories in a single script, but it should not cause a crash. Bug seems to be preseint in multiple versions of cpptraj from AmberTools17 to AmberTools23 and on multiple Linux versions..

drroe commented 1 year ago

Maybe this is not the most elegant solution for aligning two trajectories in a single script, but it should not cause a crash.

Agreed - a segfault is never "correct" behavior. I'll look into it. Thanks for the report!

drroe commented 1 year ago

Should be fixed once #1041 is merged in.

drroe commented 1 year ago

@gaborb91 when you get a chance, can you confirm that #1041 (Version 6.20.1) fixes the issue? Thanks.

gaborb91 commented 1 year ago

I have compiled the most recent version on a local workstation computer and I can confirm that your PR fixes the bug. Thank you!

drroe commented 1 year ago

Great to hear - thanks again for the report!