Previous Thread
Next Thread
Print Thread
c39b1 - Bug with REPDSTR + if statement
#34690 01/06/15 06:58 PM
Joined: Jan 2015
Posts: 5
F
Forum Member
OP Offline
Forum Member
F
Joined: Jan 2015
Posts: 5
When using the "if condition then command endif" form after a call to REPD, CHARMM crashes if condition is false, with the following message:

***** LEVEL -2 WARNING FROM *****
***** Unable to find ENDIF
******************************************

The input that I used is the following (with 2 CPUs):

if ?numnode .ne. 2 stop

set foo 1

if @foo .eq. 2 then
echo bar
endif

repd nrep 2 exch unit 20 freq 100 tham temp 300 temp 350

if @foo .eq. 1 echo foo
if @foo .eq. 2 echo bar

if @foo .eq. 1 then
echo foo
endif

if @foo .eq. 2 then
echo bar
endif

Only the last if statement generates an error (but the same command works before the call to repd).

The complete output is attached.

EDIT: I initially made a typo when writing the input script

Attached Files
bug-endif.txt (2.21 KB, 293 downloads)
Last edited by F.Villemot; 01/06/15 07:23 PM.
Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34691 01/06/15 07:12 PM
Joined: Sep 2003
Posts: 8,505
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,505
This appears to be a user script bug, not a CHARMM bug; there are two IF ... THEN statements, and only one ENDIF.


Rick Venable
computational chemist

Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34692 01/06/15 07:26 PM
Joined: Jan 2015
Posts: 5
F
Forum Member
OP Offline
Forum Member
F
Joined: Jan 2015
Posts: 5
I made a typo when I first wrote the script on the forum (an unfortunate one…).
I corrected my initial post, and still have the bug.

Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34693 01/06/15 08:11 PM
Joined: Sep 2003
Posts: 4,796
Likes: 2
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 4,796
Likes: 2
And it works if you comment out the REPD clause?
Is there a new line after the last endif?


Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden
Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34694 01/06/15 08:14 PM
Joined: Jan 2015
Posts: 5
F
Forum Member
OP Offline
Forum Member
F
Joined: Jan 2015
Posts: 5
Yes, if I comment out the REPD clause, the error disappears.
And there is a new line at the end.

Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34695 01/06/15 08:46 PM
Joined: Sep 2003
Posts: 8,505
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,505
I can confirm the failures; I also added a STOP command after the 2nd ENDIF, and the STOP is echoed to stdout, but the error still occurs.


Rick Venable
computational chemist

Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34696 01/06/15 09:09 PM
Joined: Oct 2004
Posts: 371
T
tim Offline
Administrator
Forum Member
Offline
Administrator
Forum Member
T
Joined: Oct 2004
Posts: 371
This is actually intended behavior that was introduced is fairly recent CHARMM releases (I want to say c38, but don't quote me on it). The issue is that when multiple replicas are trying to access the same input script unit, it is easy to introduce subtle parsing problems (one replica can consume a bunch of lines up to the ENDIF that are needed by another process, for example, if the if conditional includes ?myrep).

The solution is to put multi-line conditionals in stream files after the REPD command. If you want to avoid having one copy of the stream per replica, you can "REPD IOSET" and "REPD IORESET" (see repdstr.doc for details).

Edit: you also need to use stream files if you want to use any subcommand parsers such as BLOCK or MSCALE after the REPDstr command.

Last edited by tim; 01/06/15 09:10 PM.
Re: c39b1 - Bug with REPDSTR + if statement
F.Villemot #34697 01/06/15 09:33 PM
Joined: Jan 2015
Posts: 5
F
Forum Member
OP Offline
Forum Member
F
Joined: Jan 2015
Posts: 5
Thank you for the info. I will look into that.


Moderated by  BRBrooks, bucknerj, 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.014s Queries: 31 (0.007s) Memory: 0.9521 MB (Peak: 1.0703 MB) Data Comp: Off Server Time: 2020-10-26 12:46:28 UTC
Valid HTML 5 and Valid CSS