Hello Liggghts Users,
i want to move my mesh between two points at a given frequency along the x-axis. I´m using the linear/variable command for this since i also have to add rotation around the x- and y- Axis later down the line at the same frequency. I used the wiggle command before instead of linear/variable but that has led to an unwanted overshoot.
My Problem now is the correct use of the linear/variable command.
The Error is:
ERROR: Invalid syntax in variable formula
I use the following command line:
fix movecad1 all move/mesh mesh cad1 linear/variable v_${vx} v_${vy} v_${vz}
The variables i´m using are the following:
variable rot equal 1 #rotations per second
variable vx equal sin(${rot}*2pi*step*${dt}) #linear x-movement
variable vy equal 0
variable vz equal 0
I don´t know if i´m using the syntax of the command for the movement wrong or if i have to initialize my variables differently and if so how it would be correct. I tried it with "${}" and without "${}", same error.
mschramm | Sat, 03/13/2021 - 20:08
drop the ${}
Hello,
When using variables in commands, you will need to drop the ${}.
${VID} simply replaces a variable to the current value while
v_VID tells liggghts to reevaluate the variable.
So you should just need to replace your fix with
fix movecad1 all move/mesh mesh cad1 linear/variable v_vx v_vy v_vz
You should also double check that your variable vx actually evaluates to something as you may be getting the error during the evaluation of vx and not movecad1.
I don't know if something funny will happen since vx, vy, vz are thermo atom style variables.
You may also need to rename them to something like my_move_vx, my_move_vy, and my_move_vz.
Grunkera | Sun, 03/14/2021 - 14:01
Thank you, problem solved.
Thank you, problem solved.
Removed the ${} and renamed the variables in advance and noticed that my pi was wrong as well.