how to define loop and if statement in plumed

471 views
Skip to first unread message

dixit....@gmail.com

unread,
Aug 20, 2016, 6:15:13 PM8/20/16
to PLUMED users
Dear All,
                I have given my plumed code. Please let me know what is the problem in this code.
==========================================================
sum:  constant value=0.0
sum0: constant value=118.5
sumN: constant value=128
k: constant value=1
j: constant value=134
for i in 1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128

do
first: COM ATOMS=1-17152
if i > 1:
k=k+134
j=j+134
last: COM ATOMS=k-j

comdist: DISTANCES ATOMS=first,last

ts: MATHEVAL ARG=comdist.x,comdist.y FUNC=tanh(sqrt(comdist.x**2+comdist.y**2)) PERIODIC=NO

  sum=sum+ts
done
eta: MATHEVAL ARG=sum,sum0,sumN VAR=t1,t2,t3 FUNC=((t1-t2)/(t3-t2)) PERIODIC=NO

restraint-eta: RESTRAINT ARG=eta KAPPA=50000.0 AT=$A
PRINT STRIDE=10 ARG=eta,restraint-eta.bias FILE=dist_COLVAR$A
ENDPLUMED

Giovanni Bussi

unread,
Aug 25, 2016, 6:57:29 AM8/25/16
to plumed...@googlegroups.com
There are no loops or ifs n plumed syntax. The thing that is closest to an if is the UPDATE_IF action.

To do what you want to do you need to write a plumed input where loops are unrolled. It should be easy to do it using a bash script

Giovanni


--
You received this message because you are subscribed to the Google Groups "PLUMED users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plumed-users+unsubscribe@googlegroups.com.
To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/plumed-users/f951663a-dd74-4614-a781-8d5c02194630%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mayank Dixit

unread,
Aug 25, 2016, 5:31:39 PM8/25/16
to plumed...@googlegroups.com
Dear Friend,
                     I am very grateful to you for your help.

I have added the if statement and loop in the plumed input file as suggested by you.

I wish to ask about plumed input which i wrote. The modified plumed input is given below.
============================================
#include <LoopUnroller.h>

sum:  constant value=0.0
sum0: constant value=118.5
sumN: constant value=128
k: constant value=1
j: constant value=134
m: constant value=134


LoopUnroller<128>:: add (double* sum,

first: COM ATOMS=1-17152
UPDATE_IF ARG=i MORE_THAN=0
combine label=k ARG=k,m powers=1,1 PERIODIC=NO
combine label=j ARG=j,m powers=1,1 PERIODIC=NO
UPDATE_IF ARG=i END

last: COM ATOMS=k-j

comdist: DISTANCES ATOMS=first,last

ts: MATHEVAL ARG=comdist.x,comdist.y FUNC=tanh(sqrt(comdist.x**2+comdist.y**2)) PERIODIC=NO
                  double* ts
                        )

eta: MATHEVAL ARG=sum,sum0,sumN VAR=t1,t2,t3 FUNC=((t1-t2)/(t3-t2)) PERIODIC=NO

restraint-eta: RESTRAINT ARG=eta KAPPA=50000.0 AT=$A
PRINT STRIDE=10 ARG=eta,restraint-eta.bias FILE=dist_COLVAR$A
ENDPLUMED
==========================================================
 Please let me know about this plumed file. Is it correct? if yes then I can proceed.

It will be great help for me from your side.

Thanks and kind regards
Mayank





Dr. Mayank  Dixit

Post-doctoral fellow
Department of Chemistry
The city college of New York
Marshak Science Building
160 convent avenue 138th street.
New York, NY-10031
Cell no: 13475368032

--
You received this message because you are subscribed to a topic in the Google Groups "PLUMED users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plumed-users/jJ0uLj6_67A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plumed-users+unsubscribe@googlegroups.com.

To post to this group, send email to plumed...@googlegroups.com.
Visit this group at https://groups.google.com/group/plumed-users.
Reply all
Reply to author
Forward
0 new messages