Previous Thread
Next Thread
Print Thread
speed up energy calculation in loop
#37477 04/25/19 09:00 AM
Joined: Oct 2017
Posts: 42
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 42
Hi
Below is script for interaction energy calculation. I call this script from bash script.
Code:
!================================================================
! Crystal definition and cutoffs
!================================================================
set ci  10.   ! inner switching cutoff
set rc  12.   ! cutoff
set ctl 14.   ! list-cutoff
set xo  14.   ! cutoff for crystal

!================================================================
!non bonded cut-offs
!================================================================
 NBOND CUTNB @ctl CUTIM @ctl CTOFnb @rc CTONnb @ci -
       atom vatom vdistance                        -
       VSWITCH  SHIFT  CDIE eps 1.0  e14fac 1.0  wmin 1.5

set res1 1

LABEL innerloop
!============================================================
! Write data to file
!============================================================
OPEN UNIT 28 WRITE FORM NAME ./solv_inter_ene/@i/inter_ene_solv_@res1.@i.dat

!============================================================
! Read TRAJ
!============================================================
OPEN READ UNIT 51 FILE NAME ./recen/@i/unfold_1le0.joball.@i.recen.dcd
! OPEN READ UNIT 51 FILE NAME ./extract/unfold_1le0.joball.@i.extract.dcd
TRAJECTORY QUERY UNIT 51
traj iread 51 nskip 1 begin 0 stop ?NSTEP skip 

SET frame 0
LABEL TimeFrame
TRAJ READ

!============================================================
! Example inter Select resid <residue_number> END Select resid <residue_number> show end
! interaction each residue w.r.t solution
!============================================================
inter SELECT resid @res1 END SELECT .NOT. segid PRT END

!==================================================
! writing output
!==================================================
write title unit 28
* @frame ?ener ?vdw ?elec
*

increment frame
!if frame .LT. 15 GOTO TimeFrame         !!!! small run to check that script runs correctly
if frame .LT. ?NFILE GOTO TimeFrame

close unit 28

increment res1
if res1 .LT. 13 GOTO innerloop
STOP


This calculation takes 20 mins for 1 Amino Acid with all solvent. I have 12 amino acids so it will take 240 mins for 1 trajectory. I have 96 trajectories.

Is there any better way (faster way) of doing this analysis. am i doing something wrong.

Re: speed up energy calculation in loop
Rohit #37478 04/25/19 12:13 PM
Joined: Sep 2003
Posts: 4,818
Likes: 2
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 4,818
Likes: 2
A couple of things that you can consider:
Reduce the number of time frames you analyze (ie, increase nskip)
Do the loop over amino acids inside the trajectory-reading loop (ie, read a frame and then analyze the interactions for all 12 aa before reading the next frame)
CONS FIX sele .not. segid prt end after you have read one frame
then CONS FIX sele none end before you read the next frame:
label tloop
cons fix sele none end
traj read
cons fix sele .not. segid prt end
intere ...
write title unit 101
intere ...
write title unit 102
.
.
intere ...
write title unit 112
goto tloop

And you can of course do all 96 trajectories at the same time if you have enough cores.

I would add ".and. segid PRT" to the first intere-selection, just in case there are solvent molecules with the same resid as one of the amino acids.

Last edited by lennart; 04/25/19 12:54 PM. Reason: Added CONS FIX

Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Moderated by  BRBrooks, lennart, rmv 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 5.6.33-0+deb8u1 Page Time: 0.008s Queries: 18 (0.004s) Memory: 0.8969 MB (Peak: 0.9626 MB) Data Comp: Off Server Time: 2021-05-06 16:15:18 UTC
Valid HTML 5 and Valid CSS