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: Julien Guénolé <julien.guenole@...4839...>
Date: Tue, 14 Nov 2017 11:32:07 +0100

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.


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:

  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,


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,!

lammps-users mailing list

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@...4839...
Twitter        @nanouayeur