Previous Thread
Next Thread
Print Thread
printing array to file
#37531 06/19/19 04:56 PM
Joined: Oct 2017
Posts: 42
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 42
Hi,

I was trying to save the interaction energies in array and dump them in the file at the end of the loop completion.

I tried things mentioned in miscom.doc but still I get this error I might not have understood the miscom.doc completely.

Below is the snippet and error which I encounter.

snippet
Code:
OPEN UNIT 28 WRITE FORM NAME dummyfile.dat

SET frame 0
LABEL TimeFrameTernary
TRAJ READ

inter SELECT some1 END SELECT some2 END
set @wbvdw@@frame ?vdw
set @wbelec@@frame ?elec
set @wbtot@@frame ?ener

increment frame
if frame .LT. ?NFILE GOTO TimeFrameTernary
echu 28
echo @wbvdw @wbelec @wbtot 



Error

Code:
 CHARMM>    set @wbvdw@@frame ?vdw
 Parameter: FRAME -> "0"
  * WARNING * <PARSUB> Command ignored. Token not found: >WBVDW0<


Regards,
Rohit Modee

Re: printing array to file
Rohit #37532 06/19/19 06:01 PM
Joined: Sep 2003
Posts: 8,545
Likes: 3
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,545
Likes: 3
Multiple syntax errors. For setting the values, you do not use the initial @ or the double @@ e.g.

set wbvdw@frame ?vdw

To obtain the stored value, both are necessary

echo @wbvdw@@frame

Also, you cannot print the entire array via

echo @wbvdw

but must again loop over the indices.


It may be easier to write the data to a file as it being generated, e.g.

! OPEN FILE, SET ECHO UNIT
open unit 11 form write name intere.txt
echu 11
SET frame 0
LABEL TimeFrameTernary
TRAJ READ
inter SELECT some1 END SELECT some2 END
echo @FRAME ?VDW ?ELEC ?ENER
increment frame
if frame .LT. ?NFILE GOTO TimeFrameTernary


Rick Venable
computational chemist


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.012s Queries: 18 (0.005s) Memory: 0.8953 MB (Peak: 0.9603 MB) Data Comp: Off Server Time: 2021-05-06 15:43:25 UTC
Valid HTML 5 and Valid CSS