LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Unable to assign scalar value of compute to a variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] Unable to assign scalar value of compute to a variable


From: Axel Kohlmeyer <akohlmey@...24...>
Date: Tue, 14 Nov 2017 09:16:13 -0500



On Tue, Nov 14, 2017 at 9:09 AM, Chilakalapudi, Syamal Praneeth (INT) <syamal.chilakalapudi@...1550...> wrote:

Thanks for your reply, Julien. Your solution worked. I take it that putting the compute in the thermo output counts as 'evaluating' the compute. Are there no other ways of doing this? Say, for instance, by using a print command?

​any command that references a compute *and* knows when the computed data is needed next​ will work. that includes all kinds of fixes. there are plenty of discussions on this subject in the mailing list archive. the reason for this is that it has to be known at the beginning of a time step whether data from a compute is needed, since some computed depend on data that needs to be collected during the time step and that collection is not done for efficiency reasons by default. thus the print command does not qualify, as it is instantaneous.

axel.

 

A word of advice to those who may be referring to this thread in the future: Since the compute is now being calculated by the thermo_style command, resetting the timestep at any point of the code will lead to the same error again. The variable will not be 'current' in between runs.

Thanks,
Praneeth


On 14.11.2017 11:32, Julien Guénolé wrote:
Put your c_g1 into your thermo output (thermo_style) before running the "run 0". That will force the calculation of the compute.
The variable should then be current in-between run.

Julien


On 14/11/17 09:17, Chilakalapudi, Syamal Praneeth (INT) wrote:

Dear All,

I am trying to assign the value of the radius of gyration compute to a variable, but I get this error:
Compute used in variable between runs is not current.

I have followed the instructions mentioned in the LAMMPS documentation and some responses from Steve on the archives.
(Referring to Variable Accuracy paragraph in Variable References section: http://lammps.sandia.gov/doc/variable.html)

  1. Even after giving a 0-timestep run to initialize the compute, I am still getting errors. Please see the following lines:

    <LAMMPS initialization and atomic setup>
    <Minimization, thermo info, fixes and dumps>

    compute        g1 all gyration
    run            0
    variable       Rg equal c_g1
    print          "Initial R of gyration is = ${Rg}"
    run            100000

    -----------------------------
    Part of the output (being shown verbatim):

    ERROR: Compute used in variable between runs is not current (../variable.cpp:1300)
    Last command: Initial R of gyration is = ${Rg

  2. I also need your help understanding these lines on the above mentioned webpage: "If it (a variable) contains references to a
    compute or fix, and these values were calculated on the last timestep of a preceding run, then they will be accessed and used
    by the variable and the result will be accurate."

    Will the compute automatically be evaluated at the last time step? Or should I write code to evaluate the compute at t = runtime-1?
    The quoted statement and the LAMMPS Docs solution presented in item #1 of this email contradict my understanding that
    merely defining a compute doesn't perform a computation.

Looking forward to hearing your suggestions and criticism,

Thanks,
Praneeth


--
Karlsruhe Institute of Technology (KIT),
Institute of Nanotechnology (INT)
 
Syamal Praneeth Chilakalapudi
 
Building 640, Campus North,
Hermann-von-Helmholtz-Platz 1,
76344 Eggenstein-Leopoldshafen, Germany
KIT is a research university in the Helmholtz Association


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
lammps-users mailing list
lammps-users@...396...sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lammps-users


-- 
*************************************************
Dr. Julien GUÉNOLÉ
Postdoctoral researcher
-----------------------
Department of Materials Science & Engineering
Institute 1: General Material Properties
Friedrich-Alexander-University Erlangen-Nürnberg
Martensstr. 5, 91058 Erlangen, Germany
-----------------------  Office 3.40
Phone [office] (+49) 91 31 85 27 486
Email          julien.guenole@...36.....4839...
Web            http://www.julien-guenole.fr
Twitter        @nanouayeur
************************************************* 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
lammps-users mailing list
lammps-users@...396...sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lammps-users

--
Karlsruhe Institute of Technology (KIT),
Institute of Nanotechnology (INT)
 
Syamal Praneeth Chilakalapudi
 
Building 640, Campus North,
Hermann-von-Helmholtz-Platz 1,
76344 Eggenstein-Leopoldshafen, Germany
KIT is a research university in the Helmholtz Association

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
lammps-users mailing list
lammps-users@...6297....sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lammps-users




--
Dr. Axel Kohlmeyer  akohlmey@...12...24...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.