Re: [lammps-users] Using compute in loops From: Vikas Varshney - 2010-04-30 13:08 ``` variable m equal c_Cmf/N shouldn't it be variable m equal c_Cmf/\$N I am not sure if this is source of error. Try this out. On Thu, Apr 29, 2010 at 1:41 PM, YiDong wrote: > Dear all, > > i have an another question about using compute in loops... > Now I tried to calculate a variable inside the loop using some computed > value. Following is the part of the input including the loop part > > I got error msg as /" Compute used in variable between runs is not > current "/ > > Could you suggest me how to resolve this ? > > Thanks a lot > > > Best > yi > > =============== input file ==================== > > # ########### > # Relax the system > > minimize 1e-10 0.0 1000 100000 > > > # ########### > # Start Loading ... > > > dump 2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat fx > fy fz > > displace_atoms g_uppf move 1.0 0.0 0.0 units box > > variable N equal count(g_free) > variable f atom sqrt(fx*fx+fy*fy+fz*fz) > compute Cmf g_free reduce sum v_f > variable m equal c_Cmf/N > > minimize 1.0e-12 1.0e-10 1000 100000 > > # do the quasidynamics relaxaton > > variable l loop 2 > label loop > run 20 > > print " mean_gradient_force = \$m at loop = \$l" > if \$m < 1e-10 then "jump in_test-shear_displace break" > next l > jump in_test-shear_displace loop > > label break > > ================= end of the input file =========================== > > > ------------------------------------------------------------------------------ > _______________________________________________ > lammps-users mailing list > lammps-users@... > https://lists.sourceforge.net/lists/listinfo/lammps-users > ```

[lammps-users] Using compute in loops YiDong <yidong80@gm...>
 Re: [lammps-users] Using compute in loops From: Vikas Varshney - 2010-04-30 13:08 Attachments: Message as HTML ```variable m equal c_Cmf/N shouldn't it be variable m equal c_Cmf/\$N I am not sure if this is source of error. Try this out. On Thu, Apr 29, 2010 at 1:41 PM, YiDong wrote: > Dear all, > > i have an another question about using compute in loops... > Now I tried to calculate a variable inside the loop using some computed > value. Following is the part of the input including the loop part > > I got error msg as /" Compute used in variable between runs is not > current "/ > > Could you suggest me how to resolve this ? > > Thanks a lot > > > Best > yi > > =============== input file ==================== > > # ########### > # Relax the system > > minimize 1e-10 0.0 1000 100000 > > > # ########### > # Start Loading ... > > > dump 2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat fx > fy fz > > displace_atoms g_uppf move 1.0 0.0 0.0 units box > > variable N equal count(g_free) > variable f atom sqrt(fx*fx+fy*fy+fz*fz) > compute Cmf g_free reduce sum v_f > variable m equal c_Cmf/N > > minimize 1.0e-12 1.0e-10 1000 100000 > > # do the quasidynamics relaxaton > > variable l loop 2 > label loop > run 20 > > print " mean_gradient_force = \$m at loop = \$l" > if \$m < 1e-10 then "jump in_test-shear_displace break" > next l > jump in_test-shear_displace loop > > label break > > ================= end of the input file =========================== > > > ------------------------------------------------------------------------------ > _______________________________________________ > lammps-users mailing list > lammps-users@... > https://lists.sourceforge.net/lists/listinfo/lammps-users > ```

 Re: [lammps-users] Using compute in loops From: YiDong - 2010-04-30 14:09 ```Hi, Vikas, Thanks for reply. But changing from " variable m equal c_Cmf/N" to "variable m equal c_Cmf/\$N" or "variable m equal c_Cmf/v_N" gives me the same error mag... Another issue, Does it matter that I put all these variable commends and compute commends either inside or outside the loop? I tried both, the result is same. Vikas Varshney wrote: > variable m equal c_Cmf/N > shouldn't it be > variable m equal c_Cmf/\$N > > I am not sure if this is source of error. Try this out. > On Thu, Apr 29, 2010 at 1:41 PM, YiDong > wrote: > > Dear all, > > i have an another question about using compute in loops... > Now I tried to calculate a variable inside the loop using some > computed > value. Following is the part of the input including the loop part > > I got error msg as /" Compute used in variable between runs is not > current "/ > > Could you suggest me how to resolve this ? > > Thanks a lot > > > Best > yi > > =============== input file ==================== > > # ########### > # Relax the system > > minimize 1e-10 0.0 1000 100000 > > > # ########### > # Start Loading ... > > > dump 2 all custom 1 dump_shear_* id type x y z c_CEpat > c_CNAat fx > fy fz > > displace_atoms g_uppf move 1.0 0.0 0.0 units box > > variable N equal count(g_free) > variable f atom sqrt(fx*fx+fy*fy+fz*fz) > compute Cmf g_free reduce sum v_f > variable m equal c_Cmf/N > > minimize 1.0e-12 1.0e-10 1000 100000 > > # do the quasidynamics relaxaton > > variable l loop 2 > label loop > run 20 > > print " mean_gradient_force = \$m at loop = \$l" > if \$m < 1e-10 then "jump in_test-shear_displace break" > next l > jump in_test-shear_displace loop > > label break > > ================= end of the input file =========================== > > ------------------------------------------------------------------------------ > _______________________________________________ > lammps-users mailing list > lammps-users@... > > https://lists.sourceforge.net/lists/listinfo/lammps-users > > ```

 Re: [lammps-users] Using compute in loops From: Steve Plimpton - 2010-04-30 14:26 ```The variable doc page discusses this, at the bottom, in the section on Variable Accuracy. Steve On Thu, Apr 29, 2010 at 11:41 AM, YiDong wrote: > Dear all, > > i have an another question about using compute in loops... > Now I tried to calculate a variable inside the loop using some computed > value.  Following is the part of the input including the loop part > > I got error msg as /" Compute used in variable between runs is not > current "/ > > Could you suggest me how to resolve this ? > > Thanks a lot > > > Best > yi > > =============== input file ==================== > > # ########### >  #  Relax the system > >  minimize    1e-10 0.0 1000 100000 > > > # ########### > #   Start Loading ... > > > dump        2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat fx > fy fz > >  displace_atoms    g_uppf move 1.0 0.0 0.0 units box > >  variable    N equal count(g_free) >  variable    f atom sqrt(fx*fx+fy*fy+fz*fz) >  compute    Cmf g_free reduce sum v_f >  variable    m equal c_Cmf/N > >  minimize    1.0e-12 1.0e-10 1000 100000 > >  # do the quasidynamics relaxaton > >     variable l loop 2 >             label loop >             run 20 > >            print " mean_gradient_force = \$m at loop = \$l" >             if \$m < 1e-10 then "jump in_test-shear_displace break" >             next l >    jump    in_test-shear_displace loop > >    label  break > > ================= end of the input file =========================== > > ------------------------------------------------------------------------------ > _______________________________________________ > lammps-users mailing list > lammps-users@... > https://lists.sourceforge.net/lists/listinfo/lammps-users > ```

 Re: [lammps-users] Using compute in loops From: YiDong - 2010-04-30 15:36 ```Hi, Steve, Suggested by the variable doc page, I've tried to put 'run 0' before using the variable, but still no luck with error msg "/Compute used in variable between runs is not current/". Maybe I misunderstood the doc page.... Could you please give me some advices? Attached is the input file where I introduced the variable and compute Thanks a lot! ================== displace_atoms g_uppf move \$s 0.0 0.0 units box minimize 1.0e-12 1.0e-10 1000 100000 compute Cmf g_free reduce sum v_c variable m equal c_Cmf/\$N variable l1 loop 2 label loop2 run 0 print " mean_gradient_force = \$m at loop = \$l1" run 10 if \$m < 1e-10 then "jump in_test-shear_displace break" next l1 jump in_test-shear_displace loop2 label break =================== Best yi Steve Plimpton wrote: > The variable doc page discusses this, at the bottom, > in the section on Variable Accuracy. > > Steve > > On Thu, Apr 29, 2010 at 11:41 AM, YiDong wrote: > >> Dear all, >> >> i have an another question about using compute in loops... >> Now I tried to calculate a variable inside the loop using some computed >> value. Following is the part of the input including the loop part >> >> I got error msg as /" Compute used in variable between runs is not >> current "/ >> >> Could you suggest me how to resolve this ? >> >> Thanks a lot >> >> >> Best >> yi >> >> =============== input file ==================== >> >> # ########### >> # Relax the system >> >> minimize 1e-10 0.0 1000 100000 >> >> >> # ########### >> # Start Loading ... >> >> >> dump 2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat fx >> fy fz >> >> displace_atoms g_uppf move 1.0 0.0 0.0 units box >> >> variable N equal count(g_free) >> variable f atom sqrt(fx*fx+fy*fy+fz*fz) >> compute Cmf g_free reduce sum v_f >> variable m equal c_Cmf/N >> >> minimize 1.0e-12 1.0e-10 1000 100000 >> >> # do the quasidynamics relaxaton >> >> variable l loop 2 >> label loop >> run 20 >> >> print " mean_gradient_force = \$m at loop = \$l" >> if \$m < 1e-10 then "jump in_test-shear_displace break" >> next l >> jump in_test-shear_displace loop >> >> label break >> >> ================= end of the input file =========================== >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> lammps-users mailing list >> lammps-users@... >> https://lists.sourceforge.net/lists/listinfo/lammps-users >> >> > > ```

 Re: [lammps-users] Using compute in loops From: Steve Plimpton - 2010-05-03 15:39 ```Your script doesn't define the variable "c". Please post as simple as possible a script which reproduces the problem. Steve On Fri, Apr 30, 2010 at 9:36 AM, YiDong wrote: > Hi, Steve, > >     Suggested by the variable doc page, I've tried to put 'run 0' before > using the variable, but still no luck with error msg "/Compute used in > variable between runs is not current/".   Maybe I misunderstood the doc > page.... Could you please give me some advices?  Attached is the input file > where I introduced the variable and compute > > Thanks a lot! > > > ================== > >    displace_atoms    g_uppf move \$s 0.0 0.0 units box >      minimize    1.0e-12 1.0e-10 1000 100000 > >    compute    Cmf g_free reduce sum v_c >    variable    m equal c_Cmf/\$N >         variable l1 loop 2 >          label loop2 >          run 0 >          print " mean_gradient_force = \$m at loop = \$l1" >          run 10 >          if \$m < 1e-10 then "jump in_test-shear_displace break" >          next l1 >             jump    in_test-shear_displace loop2 >    label  break > =================== > > Best > yi > > > > Steve Plimpton wrote: >> >> The variable doc page discusses this, at the bottom, >> in the section on Variable Accuracy. >> >> Steve >> >> On Thu, Apr 29, 2010 at 11:41 AM, YiDong wrote: >> >>> >>> Dear all, >>> >>> i have an another question about using compute in loops... >>> Now I tried to calculate a variable inside the loop using some computed >>> value.  Following is the part of the input including the loop part >>> >>> I got error msg as /" Compute used in variable between runs is not >>> current "/ >>> >>> Could you suggest me how to resolve this ? >>> >>> Thanks a lot >>> >>> >>> Best >>> yi >>> >>> =============== input file ==================== >>> >>> # ########### >>>  #  Relax the system >>> >>>  minimize    1e-10 0.0 1000 100000 >>> >>> >>> # ########### >>> #   Start Loading ... >>> >>> >>> dump        2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat fx >>> fy fz >>> >>>  displace_atoms    g_uppf move 1.0 0.0 0.0 units box >>> >>>  variable    N equal count(g_free) >>>  variable    f atom sqrt(fx*fx+fy*fy+fz*fz) >>>  compute    Cmf g_free reduce sum v_f >>>  variable    m equal c_Cmf/N >>> >>>  minimize    1.0e-12 1.0e-10 1000 100000 >>> >>>  # do the quasidynamics relaxaton >>> >>>    variable l loop 2 >>>            label loop >>>            run 20 >>> >>>           print " mean_gradient_force = \$m at loop = \$l" >>>            if \$m < 1e-10 then "jump in_test-shear_displace break" >>>            next l >>>   jump    in_test-shear_displace loop >>> >>>   label  break >>> >>> ================= end of the input file =========================== >>> >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> lammps-users mailing list >>> lammps-users@... >>> https://lists.sourceforge.net/lists/listinfo/lammps-users >>> >>> >> >> > > ```

 Re: [lammps-users] Using compute in loops From: YiDong - 2010-05-03 22:11 ```Sorry for the confusion, Here is the input script =============== dimension 3 boundary p p p atom_style atomic read_data Al_CLJ.dat mass * 26.982 pair_style eam/alloy pair_coeff * * /usr4/dong/Atomic_Junctions/potentials/Al-LEA.eam.alloy Al Al neighbor 0.3 bin neigh_modify delay 5 region r_uppf block INF INF INF INF 100 INF units box region r_lowf block INF INF INF INF INF -100 units box group g_uppf region r_uppf group g_lowf region r_lowf group g_fix union g_uppf g_lowf group g_free subtract all g_fix compute Ctemp all temp compute Cpress all pressure Ctemp compute CEpat all pe/atom compute CNAat all cna/atom 3.45689 compute Cpressfat g_free stress/atom compute Cpressf g_free reduce sum c_Cpressfat[5] variable Vsigmaxz equal -c_Cpressf/vol dump 1 all custom 50 dump_min id type x y z c_CEpat c_CNAat c_Cpressfat[1] c_Cpressfat[2] c_Cpressfat[3] c_Cpressfat[5] fx fy fz # ########### # Relax the system minimize 1e-10 0.0 1000 100000 undump 1 # ########### # Start Loading ... reset_timestep 0 fix hold g_fix setforce 0.0 0.0 0.0 velocity g_fix set 0.0 0.0 0.0 sum no units box fix 2 all nve timestep 0.01 dump 2 all custom 20000 dump_shear_* id type x y z c_CEpat c_CNAat fx fy fz variable s equal lz*5e-5 variable N equal count(g_free) variable c atom sqrt(fx*fx+fy*fy+fz*fz) compute Cmf g_free reduce sum v_c displace_atoms g_uppf move \$s 0.0 0.0 units box minimize 1.0e-12 1.0e-10 1000 100000 variable m equal c_Cmf/\$N ( or 'variable m equal c_Cmf/v_N', I tried both, doesn't work....) variable l1 loop 20 label loop2 run 0 print " mean_gradient_force = \$m at loop = \$l1" run 100 if \$m < 1e-10 then "jump in_test-shear_displace break" next l1 jump in_test-shear_displace loop2 label break ===================================== Thanks a lot! Best yi Steve Plimpton wrote: > Your script doesn't define the variable "c". Please > post as simple as possible a script which reproduces > the problem. > > Steve > > On Fri, Apr 30, 2010 at 9:36 AM, YiDong wrote: > >> Hi, Steve, >> >> Suggested by the variable doc page, I've tried to put 'run 0' before >> using the variable, but still no luck with error msg "/Compute used in >> variable between runs is not current/". Maybe I misunderstood the doc >> page.... Could you please give me some advices? Attached is the input file >> where I introduced the variable and compute >> >> Thanks a lot! >> >> >> ================== >> >> displace_atoms g_uppf move \$s 0.0 0.0 units box >> minimize 1.0e-12 1.0e-10 1000 100000 >> >> compute Cmf g_free reduce sum v_c >> variable m equal c_Cmf/\$N >> variable l1 loop 2 >> label loop2 >> run 0 >> print " mean_gradient_force = \$m at loop = \$l1" >> run 10 >> if \$m < 1e-10 then "jump in_test-shear_displace break" >> next l1 >> jump in_test-shear_displace loop2 >> label break >> =================== >> >> Best >> yi >> >> >> >> Steve Plimpton wrote: >> >>> The variable doc page discusses this, at the bottom, >>> in the section on Variable Accuracy. >>> >>> Steve >>> >>> On Thu, Apr 29, 2010 at 11:41 AM, YiDong wrote: >>> >>> >>>> Dear all, >>>> >>>> i have an another question about using compute in loops... >>>> Now I tried to calculate a variable inside the loop using some computed >>>> value. Following is the part of the input including the loop part >>>> >>>> I got error msg as /" Compute used in variable between runs is not >>>> current "/ >>>> >>>> Could you suggest me how to resolve this ? >>>> >>>> Thanks a lot >>>> >>>> >>>> Best >>>> yi >>>> >>>> =============== input file ==================== >>>> >>>> # ########### >>>> # Relax the system >>>> >>>> minimize 1e-10 0.0 1000 100000 >>>> >>>> >>>> # ########### >>>> # Start Loading ... >>>> >>>> >>>> dump 2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat fx >>>> fy fz >>>> >>>> displace_atoms g_uppf move 1.0 0.0 0.0 units box >>>> >>>> variable N equal count(g_free) >>>> variable f atom sqrt(fx*fx+fy*fy+fz*fz) >>>> compute Cmf g_free reduce sum v_f >>>> variable m equal c_Cmf/N >>>> >>>> minimize 1.0e-12 1.0e-10 1000 100000 >>>> >>>> # do the quasidynamics relaxaton >>>> >>>> variable l loop 2 >>>> label loop >>>> run 20 >>>> >>>> print " mean_gradient_force = \$m at loop = \$l" >>>> if \$m < 1e-10 then "jump in_test-shear_displace break" >>>> next l >>>> jump in_test-shear_displace loop >>>> >>>> label break >>>> >>>> ================= end of the input file =========================== >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> lammps-users mailing list >>>> lammps-users@... >>>> https://lists.sourceforge.net/lists/listinfo/lammps-users >>>> >>>> >>>> >>> >> > > ```

 Re: [lammps-users] Using compute in loops From: Steve Plimpton - 2010-05-04 23:24 ```Your script is long and complicated and requires a data file I don't have. I'm asking you to simplify it to something small and concise that illustrates where LAMMPS is having a problem, eliminating the extraneous stuff. Steve On Mon, May 3, 2010 at 4:11 PM, YiDong wrote: > Sorry for the confusion, > > Here is the input script > > =============== > > dimension    3 > boundary     p p p > atom_style    atomic > > read_data    Al_CLJ.dat > mass        * 26.982 > > pair_style    eam/alloy > pair_coeff    * * /usr4/dong/Atomic_Junctions/potentials/Al-LEA.eam.alloy Al > Al > > neighbor    0.3 bin > neigh_modify    delay 5 > > region        r_uppf block INF INF INF INF 100 INF units box > region        r_lowf block INF INF INF INF INF -100 units box > group        g_uppf region r_uppf > group        g_lowf region r_lowf > > group        g_fix union g_uppf g_lowf > group        g_free subtract all g_fix > > compute    Ctemp all temp > compute    Cpress all pressure Ctemp > compute    CEpat all pe/atom > compute    CNAat all cna/atom 3.45689 > > compute    Cpressfat g_free stress/atom > compute    Cpressf g_free reduce sum c_Cpressfat[5] >  variable    Vsigmaxz equal -c_Cpressf/vol > > dump        1 all custom 50 dump_min id type x y z c_CEpat c_CNAat > c_Cpressfat[1] c_Cpressfat[2] c_Cpressfat[3] c_Cpressfat[5] fx fy fz > > # ########### > #  Relax the system > > minimize    1e-10 0.0 1000 100000 > undump        1 > > > # ########### > #   Start Loading ... > > reset_timestep 0 > > > fix        hold g_fix setforce 0.0 0.0 0.0 > velocity    g_fix set 0.0 0.0 0.0 sum no units box > > fix        2 all nve > timestep    0.01 > > dump        2 all custom 20000 dump_shear_* id type x y z c_CEpat c_CNAat fx > fy fz > > > variable    s equal lz*5e-5 > variable    N equal count(g_free) > variable    c atom sqrt(fx*fx+fy*fy+fz*fz) > compute   Cmf g_free reduce sum v_c > > displace_atoms    g_uppf move \$s 0.0 0.0 units box > minimize    1.0e-12 1.0e-10 1000 100000 > variable    m equal c_Cmf/\$N   ( or  'variable m equal c_Cmf/v_N',   I tried > both, doesn't work....) > > variable l1 loop 20 >          label loop2 >          run 0 >          print " mean_gradient_force = \$m at loop = \$l1" >          run 100 >          if \$m < 1e-10 then "jump in_test-shear_displace break" >          next l1 > jump    in_test-shear_displace loop2 > label  break > > > ===================================== > > Thanks a lot! > > > Best > yi > > Steve Plimpton wrote: >> >> Your script doesn't define the variable "c".  Please >> post as simple as possible a script which reproduces >> the problem. >> >> Steve >> >> On Fri, Apr 30, 2010 at 9:36 AM, YiDong wrote: >> >>> >>> Hi, Steve, >>> >>>    Suggested by the variable doc page, I've tried to put 'run 0' before >>> using the variable, but still no luck with error msg "/Compute used in >>> variable between runs is not current/".   Maybe I misunderstood the doc >>> page.... Could you please give me some advices?  Attached is the input >>> file >>> where I introduced the variable and compute >>> >>> Thanks a lot! >>> >>> >>> ================== >>> >>>   displace_atoms    g_uppf move \$s 0.0 0.0 units box >>>     minimize    1.0e-12 1.0e-10 1000 100000 >>> >>>   compute    Cmf g_free reduce sum v_c >>>   variable    m equal c_Cmf/\$N >>>        variable l1 loop 2 >>>         label loop2 >>>         run 0 >>>         print " mean_gradient_force = \$m at loop = \$l1" >>>         run 10 >>>         if \$m < 1e-10 then "jump in_test-shear_displace break" >>>         next l1 >>>            jump    in_test-shear_displace loop2 >>>   label  break >>> =================== >>> >>> Best >>> yi >>> >>> >>> >>> Steve Plimpton wrote: >>> >>>> >>>> The variable doc page discusses this, at the bottom, >>>> in the section on Variable Accuracy. >>>> >>>> Steve >>>> >>>> On Thu, Apr 29, 2010 at 11:41 AM, YiDong wrote: >>>> >>>> >>>>> >>>>> Dear all, >>>>> >>>>> i have an another question about using compute in loops... >>>>> Now I tried to calculate a variable inside the loop using some computed >>>>> value.  Following is the part of the input including the loop part >>>>> >>>>> I got error msg as /" Compute used in variable between runs is not >>>>> current "/ >>>>> >>>>> Could you suggest me how to resolve this ? >>>>> >>>>> Thanks a lot >>>>> >>>>> >>>>> Best >>>>> yi >>>>> >>>>> =============== input file ==================== >>>>> >>>>> # ########### >>>>>  #  Relax the system >>>>> >>>>>  minimize    1e-10 0.0 1000 100000 >>>>> >>>>> >>>>> # ########### >>>>> #   Start Loading ... >>>>> >>>>> >>>>> dump        2 all custom 1 dump_shear_* id type x y z c_CEpat c_CNAat >>>>> fx >>>>> fy fz >>>>> >>>>>  displace_atoms    g_uppf move 1.0 0.0 0.0 units box >>>>> >>>>>  variable    N equal count(g_free) >>>>>  variable    f atom sqrt(fx*fx+fy*fy+fz*fz) >>>>>  compute    Cmf g_free reduce sum v_f >>>>>  variable    m equal c_Cmf/N >>>>> >>>>>  minimize    1.0e-12 1.0e-10 1000 100000 >>>>> >>>>>  # do the quasidynamics relaxaton >>>>> >>>>>   variable l loop 2 >>>>>           label loop >>>>>           run 20 >>>>> >>>>>          print " mean_gradient_force = \$m at loop = \$l" >>>>>           if \$m < 1e-10 then "jump in_test-shear_displace break" >>>>>           next l >>>>>  jump    in_test-shear_displace loop >>>>> >>>>>  label  break >>>>> >>>>> ================= end of the input file =========================== >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> _______________________________________________ >>>>> lammps-users mailing list >>>>> lammps-users@... >>>>> https://lists.sourceforge.net/lists/listinfo/lammps-users >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > ```