[molpro-user] Best way to implement a WHILE loop?

Andy May MayAJ1 at cardiff.ac.uk
Wed Aug 1 14:55:11 BST 2012


Seth,

Since one can actually modify the iterator variable (see note and 
warning in the manual), something like:

j=1
do i=1,2
j=j+1
if (j.lt.10) i=1
enddo

will work, effectively creating an infinite loop until a certain 
condition is met.

Best wishes,

Andy

On 29/07/12 11:12, Seth Olsen wrote:
>
> Hi Molpro,
>
>  From the manual it is not clear how this should be done.  The apparent
> way, using GOTO commands to exit the loop, is contraindicated.  I can't
> find examples of DO loops where the DO loop is exited via an IF
> construct, so it's not clear to me what the best way is to do this.  Is
> there a better way than using GOTO to pop out of a DO loop?
>
> Cheers,
>
> Seth
> ---------------------------------------------------
> Seth Olsen
> ARC Australian Research Fellow
> 6-431 Physics Annexe
> School of Mathematics and Physics
> The University of Queensland
> Brisbane QLD 4072 Australia
> seth.olsen at uq.edu.au <mailto:seth.olsen at uq.edu.au>
> +61 7 3365 2816
> ---------------------------------------------------
> Unless stated otherwise, this e-mail represents only the views of the
> Sender and not the views of The University of Queensland
>
>
>
> _______________________________________________
> Molpro-user mailing list
> Molpro-user at molpro.net
> http://www.molpro.net/mailman/listinfo/molpro-user
>




More information about the Molpro-user mailing list