cpptraj
cpptraj copied to clipboard
SPAM throws error of 'std::bad_alloc'
I am using spam to calculate free energies for a mixed solvent MD simulation (protein is ABL kinase) My input file is as follows: parm /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_9pmemdcuda/3kfa_layer_ACN_H2O_5-95vv.prmtop trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_1-pmemdMPI/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_1-pmemdMPI/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_2pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_2pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_3pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_3pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_4pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_4pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_5pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_5pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_6pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_6pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_7pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_7pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_8pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_8pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_9pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_9pmemdcuda/New4H_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_10pmemdcuda/New4G_production.1.crd 1 50 1 trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/3kfa_md_10pmemdcuda/New4H_production.1.crd 1 50 1
#Center and process image ##center :1-286 mass origin ##image origin familiar com :1-286
autoimage ##Align trajectory to reference structure by minimizing RMSD reference /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/setup_solvbox/3kfa_layer_ACN_H2O_5-95vv.pdb strip :Cl-,Na+ rms reference mass out 3kfa_ACN_15-20ns_md_CA_rmsd.txt :1-286@CA spam 3kfa_ACN_peak.xyz solv C3N reorder cut 12 sphere site_size 6 dgbulk -30.3 dhbulk -22.2 info info.txt summary spam_summary.out out spam_energies.out
Error I get is:
Read 1000 frames and processed 1000 frames. TIME: Avg. throughput= 16.8114 frames / second.
ACTION OUTPUT: SPAM timing data: TIME: Residue c.o.m. calc: 0.0058 s ( 0.02%) TIME: Peak assignment : 0.0196 s ( 0.07%) TIME: Occupancy calc. : 0.0013 s ( 0.00%) TIME: Energy calc : 27.4013 s ( 99.89%) TIME: Residue reordering : 0.0040 s ( 0.01%) TIME: SPAM Action Total: 27.4324 s terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Aborted (core dumped)
I'll probably need files so I can reproduce the error. The topology and a few coordinate frames should suffice.
Sure Dan. I will send them to you asap. Thanks for replying
Thanks for the files. However, I wasn't able to reproduce the segfault (using version 4.12.1). Could you send me the peaks file you are using as well? Also the input you used to generate the peaks file (in particular, I would like to see the exact volmap
command you used). I'll paste the input I successfully used below.
Also, I noticed some issues with how you are currently doing your calculation. If you look at the output from the autoimage
command you'll notice that your C3N
residues are "fixed" to your anchor (which you probably do not want) because they are not considered solvent molecules by default. You should add the following before autoimage
:
solvent :WAT,C3N
My volmap
input:
parm 3kfa_layer_ACN_H2O_5-95vv.prmtop
trajin New4E_production.1.crd
solvent :C3N,WAT
autoimage
strip :Cl-,Na+
rms first mass out 3kfa_ACN_15-20ns_md_CA_rmsd.txt :1-286@CA
volmap :C3N centermask ^1 buffer 5.0 peakfile 3kfa_ACN_peak.xyz dx 1.0
My spam
input:
parm 3kfa_layer_ACN_H2O_5-95vv.prmtop
trajin New4E_production.1.crd
solvent :WAT,C3N
autoimage
strip :Cl-,Na+
rms first mass out 3kfa_ACN_15-20ns_md_CA_rmsd.txt :1-286@CA
spam 3kfa_ACN_peak.xyz solv C3N reorder cut 12 sphere site_size 6 \
dgbulk -30.3 dhbulk -22.2 info info.txt summary spam_summary.out \
out spam_energies.out
Hi, Sounds weird as to why I am getting the error! Attached is a peakfile input I used. I have also attached a file MixMD_energies.pdb , it contains the x,y,z coordinates followed by net free energy of binding at that hotspot. sample file looks like this ATOM 1 XX UNX A 1 -6.000 14.000 -2.500 0.00 -1.880542 ATOM 1 XX UNX A 2 -4.500 16.000 -7.000 0.00 -1.864117 ATOM 1 XX UNX A 3 0.000 0.500 12.000 0.00 -1.668812 ATOM 1 XX UNX A 4 1.000 -3.500 9.500 0.00 -1.621935 ATOM 1 XX UNX A 5 4.000 23.000 -3.500 0.00 -1.465110 ATOM 1 XX UNX A 6 0.000 22.000 20.500 0.00 -1.435783
I have a small script which converts this file to peakfile.xyz. When this failed, I got segfault errors, I used the volmap command to generate the peakfile My vomap command is " volmap volmap_C3N.xplor 0.5 0.5 0.5 :C3N@C2 name GRID size 200,200,200 peakcut 0.001 peakfile 3kfa_ACN_peak.xyz"
Even then the error files.zip persisted
Even with your peaks file, I can't reproduce the segfault. I checked with valgrind and there are no memory shenanigans going on. Can you post the output of cpptraj --internal-version
?
Can you try running with the input I provided (both for generating the peaks with volmap
and the spam
command) and see if you still get the segfault?
[3kfa_ACN_xplor_bind_energ_last5ns_10runs]$ cpptraj --version CPPTRAJ: Version V4.12.2 (GitHub) Its my bad luck that the error is not popping up today, maybe it was a bad day yesterday when I tried, let me try it once more and then shall get back to you. I did not mean to waste your valuable time over this. I am sorry!
No worries - code should never segfault so I'd like to get to the bottom of it. If you can still reproduce the segfault I may have you run valgrind to do a more in-depth memory check if you don't mind.
Absolutely! I am sitting with it today afternoon and shall get back to you with updates! Thanks for being so helpful Regards Debarati
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Daniel R. Roe [email protected] Sent: Thursday, May 2, 2019 10:22:49 AM To: Amber-MD/cpptraj Cc: DDGmichigan; Author Subject: Re: [Amber-MD/cpptraj] SPAM throws error of 'std::bad_alloc' (#710)
No worries - code should never segfault so I'd like to get to the bottom of it. If you can still reproduce the segfault I may have you run valgrind to do a more in-depth memory check if you don't mind.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Amber-MD/cpptraj/issues/710#issuecomment-488693188, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALP3CAL66CSCPOXH7NUIZX3PTL2LTANCNFSM4HI2GIIQ.
Hi Daniel, There is no segfault issues now with SPAM but I have some scientific queries.
When I look at hotspots and evaluate the free energies of binding of ACN molecules on those hotspots I get negative energies of binding! When I used the SPAM command to calculate the interaction energies, I get positive dG values which cannot be possible ideally, any clues as to what might be going on with the SPAM calculations. It would immensely help This is the output file named "SPAM_Summary.out" #Peak SPAM_00001[DG] SPAM_00001[DH] SPAM_00001[-TDS] 1.000 3.8280 3.3674 0.4606 5.000 3.8842 2.6350 1.2492 7.000 4.0662 3.2994 0.7668 11.000 2.0295 3.1875 -1.1581 14.000 1.8901 3.6465 -1.7564 15.000 5.3431 3.2239 2.1192 16.000 -0.2742 3.2231 -3.4974 20.000 4.5459 3.1734 1.3726 21.000 1.0247 3.2657 -2.2410 25.000 4.0410 3.0492 0.9917 ~
Also in the solvent command you added solvent :WAT,C3N
But I want to calculate the interaction energies of C3N molecules so why do I have to include WAT as my solvent?
Also, now in certain cases, I get this
ACTION OUTPUT: SPAM timing data: TIME: Residue c.o.m. calc: 0.2755 s ( 88.85%) TIME: Peak assignment : 0.0011 s ( 0.37%) TIME: Occupancy calc. : 0.0212 s ( 6.83%) TIME: Energy calc : 0.0012 s ( 0.40%) TIME: Residue reordering : 0.0012 s ( 0.39%) TIME: SPAM Action Total: 0.3100 s TIME: Analyses took 0.0000 seconds.
DATASETS (5 total): GRID "GRID" (float grid), size is 64000000 (256.000 MB) GRID[totalvol] "GRID[totalvol]" (double), size is 1 (0.008 kB) SPAM_00003[DG] "SPAM_00003[DG]" (X-Y mesh), size is 0 SPAM_00003[DH] "SPAM_00003[DH]" (X-Y mesh), size is 0 SPAM_00003[-TDS] "SPAM_00003[-TDS]" (X-Y mesh), size is 0 Total data set memory usage is at least 256.000 MB
DATAFILES (5 total): volmap_C3N.xplor (Xplor File): GRID spam_energies.out (Standard Data File): spam_summary.out (Standard Data File): SPAM_00003[DG] SPAM_00003[DH] SPAM_00003[-TDS] 3kfa_ACN_peak.xyz (Volmap Peaks) info.txt (SPAM info) Warning: File 'spam_energies.out' has no sets containing data. Warning: Set 'SPAM_00003[DG]' contains no data. Warning: Set 'SPAM_00003[DH]' contains no data. Warning: Set 'SPAM_00003[-TDS]' contains no data. Warning: File 'spam_summary.out' has no sets containing data.
RUN TIMING: TIME: Init : 0.0140 s ( 0.01%) TIME: Trajectory Process : 126.1016 s ( 99.99%) TIME: Action Post : 0.0002 s ( 0.00%) TIME: Analysis : 0.0000 s ( 0.00%) TIME: Data File Write : 0.0003 s ( 0.00%) TIME: Other : 0.0001 s ( 0.00%) TIME: Run Total 126.1161 s ---------- RUN END --------------------------------------------------- TIME: Total execution time: 2491.8533 seconds.
To cite CPPTRAJ use: Daniel R. Roe and Thomas E. Cheatham, III, "PTRAJ and CPPTRAJ: Software for Processing and Analysis of Molecular Dynamics Trajectory Data". J. Chem. Theory Comput., 2013, 9 (7), pp 3084-3095.
There is no data inside peakfile output and no output in spam_energies.out Any reason for this?
Without seeing the files it's hard to tell. It could be that the coordinates you used when you calculated your peaks (i.e. any centering/rotating/etc that you did) isn't corresponding to the coordinates you're using when running SPAM (i.e. you're not centering/rotating them the same way), so the peaks don't actually correspond to what SPAM expects. Again, I'd need some files to reproduce before I could say for certain.
Hi Daniel, I can send you the input files and relevant stuff so that you can reproduce the error. The issue I am facing has to do with the values. After having located the hotspots I have used the same x,y,z coordinates in my spam peakfile and the free energies I get is positive for the exact spot where MixMD, SILCS etc methods gave a negative value, even LIE. So I am confused as to what different things may be happening that I do not get favorable energies using SPAM analysis.
This contains the prmtop file, the 25 frames of my big traj file, the spam.in file, the MixmD_energies,pdb (these contain the coordinates of the occupancy maxima) i have a small python script which converts the Mixmd_energies.pdb file to a peakfile.xyz
All I am brainstorming on is how come the energies for the same hotspots become "unfavorable" in SPAM whereas they are favorable interactions when computing using xplor maxima
again segfault happening
spam_input file parm /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/RUNS/3kfa_md_9pmemdcuda/3kfa_layer_ACN_H2O_5-95vv.prmtop trajin /users/dicksmit/gphani/unsabi/users2/gphani/3_mixMD/ablkinase_3KFA/ACN_H2O_5-95vv_layered/RUNS/3kfa_md_1-pmemdMPI/3kfa_ACN_production4D.mdcrd 1 2500 1 solvent :C3N,WAT autoimage strip :Na+,Cl- volmap C3N_3kfa.xplor 0.5 0.5 0.5 :C3N@C2 name GRID size 200,200,200 center origin peakcut 0.001 peakfile 3kfa_ACN_peak.xyz run spam 3kfa_ACN_peak.xyz solv C3N reorder cut 10 sphere site_size 6 dgbulk -31.80 dhbulk -18.27 info info.txt summary spam_summary.out out spam_energies.out run
I really want to get to the bottom of this analysis, why does it segfault ? Any help from you will be super useful Thanks Debarati
After many tries I was finally able to reproduce the segfault. I'll look into it and get back to you ASAP.
Thanks so much Dan!
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Daniel R. Roe [email protected] Sent: Wednesday, May 29, 2019 12:00:57 PM To: Amber-MD/cpptraj Cc: DDGmichigan; Author Subject: Re: [Amber-MD/cpptraj] SPAM throws error of 'std::bad_alloc' (#710)
After many tries I was finally able to reproduce the segfault. I'll look into it and get back to you ASAP.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Amber-MD/cpptraj/issues/710?email_source=notifications&email_token=ALP3CAPNCOPYPUIBWHZ7VMDPX2SDTA5CNFSM4HI2GII2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWPZ4GA#issuecomment-496999960, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALP3CALCISOOMOGVATCUNQDPX2SDTANCNFSM4HI2GIIQ.
So the issue is that you have more peaks than residues, and the code wasn't written to handle that case when reordering molecules. I'll have to look at the code a bit more (and maybe consult with the original author) before a fix will be in, but for now try removing the reorder
keyword if you don't need it.
@swails it seems to me that reorder
should probably be disabled if you have more peaks than solvent residues. There's just no way to guarantee that the same peaks will be occupied any given frame. Am I thinking about this wrong?
@drroe : Even without the reorder cpptraj gets angry and spits out segfault! I am perplexed why is it giving seg faults when I try to use SPAM analysis!
@swails it seems to me that
reorder
should probably be disabled if you have more peaks than solvent residues. There's just no way to guarantee that the same peaks will be occupied any given frame. Am I thinking about this wrong?
If the number of water residues is less than the number of peaks (very weird!), then it's impossible to say whether reorder is even possible.
It's closing on 10 years since I wrote any of this code, but here's what I recall:
-
reorder
was added before cpptraj added support for PME energies - Even when there were far fewer peaks than water molecules, there was no guarantee a peak would be occupied every frame (and in fact, it often wasn't). In these instances, the water molecule in that position was simply left alone (unless it needed to swap into another peak later).
- energy analyses for 'unoccupied' frames were omitted
However, if you have 5 peaks and 3 residues, you obviously can't reorder any molecule into the 4th or 5th peaks. The energy calculations are still well-defined if you do them directly in cpptraj, but I'd be pretty skeptical of simulations where the number of peaks eclipsed the number of solvent molecules. Either you have very little solvent and your system lacks anything resembling 'bulk' behavior or your simulations are unconverged (and probably really unconverged, since solvent 'equilibrates' way faster than large solutes).
Even without the reorder cpptraj gets angry and spits out segfault! I am perplexed why is it giving seg faults when I try to use SPAM analysis!
@DDGmichigan OK, with the files you previously provided I can't reproduce the segfault if reorder
is off. Can you provide me the smallest possible test case that causes a segfault with reorder
off? If I can reproduce the error there's a chance I can fix it - otherwise I'm stumped.
@swails I'll go ahead and at some point soon disabled reorder when peaks > solvent residues. Thanks.
@swails Thanks for all your help and suggestions, Thanks to @drroe also for actually trying to help me out on this project. Well, I have just published this paper in May 2019 ' https://pubs.acs.org/doi/pdf/10.1021/acs.jcim.8b00925"
I need to set up SPAM analysis on the systems containing approx 1M acetonitrile+water boxes and get the energies for the hotspots reported in the paper. thats all that I have been trying to set up since last 2 months. Well, I will send the input files and test cases as well, but I still do not understand why I get seg-faults and also "positive energies" for the exact same locations wherein MixMD analysis, SILCS, LIE all generate favorable negative values of interactions
@swails I do not understand what peakcut should be optimum for my volmap command to generate peak locations as I have approx 450 ACN molecules in 5000 TIP3P waters and a ABL Kinase, no way the peaks could be >> 450 but I get 3000+ peaks if i use peakcut 0.003, how do you define the best possible choice of peakcut in cpptraj? Could I explain where I am getting confused?
also I am looking for peak locations of my ACN probe and not water peaks.