Previous Thread
Next Thread
Print Thread
Write forces in single file
#38029 08/12/20 06:58 AM
Joined: Oct 2017
Posts: 42
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 42
Hello everyone,

Below is the script I am using for force calculation. I have the following questions.

1. I want to write the forces of all frames into a single file? How do I do it append does not work?
2. Both "TEST FIRST" and "COOR FORCE COMP" gives the same values but later is faster so which would you recommend?
3. Should I use UPDATe keyword in the loop before "COOR FORCE COMP"?

Code
 NBOND CUTNB @ctl CUTIM @ctl CTOFnb @rc CTONnb @ci -
       atom vatom vdistance                        -
       VSWITCH  SHIFT  CDIE eps 1.0  e14fac 1.0  wmin 1.5

 ! ENERGY

!================================================================                         
!Set up for reading coordinate sets from the trajectory and writing data                      
!================================================================      
OPEN READ UNIT 51 FILE NAME ./prod/diala_recen.dcd
TRAJECTORY QUERY UNIT 51
OPEN UNIT 12 WRITE CARD NAME ./anal/forces/all_forces.dat

calc nstop = ?NFILE             ! last step = number of frames * runs per frame * steps per run

TRAJECTORY FIRSTU 51 NUNIT 1 IREAD BEGIN 0 STOP ?NFILE

SET frame 0
LABEL TimeFrame

TRAJ READ
ENERGY

DEFINE FATOMS SELE SEGID PRT END
! TEST FIRST TOL 0.00000001 UNIT 12 CRYSTAL SELE FATOMS END

COOR FORCE COMP 
WRITE COOR CARD UNIT 12 COMP SELE FATOMS END
* title
*

! CLOSE UNIT 12
increment frame
if frame .LT. 10 GOTO TimeFrame         !!!! small run to check that script runs correctly
! if frame .LT. ?NFILE GOTO TimeFrame

STOP

Thank-you,
Regards,
Rohit

Re: Write forces in single file
Rohit #38030 08/12/20 08:34 AM
Joined: Sep 2003
Posts: 4,796
Likes: 2
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 4,796
Likes: 2
1. WRITE COOR cannot append to an existing file. You can use the CHARMM SYSTEM command to concatenate this file to an existing file, something like SYSTTEM "cat single_focec.dat >> all_forces.dat"
2. Use COOR FORCE COMP. TEST FIRST is a command for testing (and does more than just compute the force, so is slow).
3. The ENERGY command should do an update, which is necessary.


Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden
Re: Write forces in single file
Rohit #38048 08/18/20 05:46 AM
Joined: Oct 2017
Posts: 42
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 42
Thank you for the SYSTEM command suggestion. It's nice to have it in CHARMM.


Moderated by  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.007s Queries: 20 (0.004s) Memory: 0.9034 MB (Peak: 0.9765 MB) Data Comp: Off Server Time: 2020-10-24 03:33:15 UTC
Valid HTML 5 and Valid CSS