I am currently new to LAMMPS and I’m working through some of the tutorials on the website (very useful) but when working with my university’s computer some of the commands result in errors which I cannot figure out. From what I understand, I may not have all the different LAMMPS packages on the computer so this could be an inconsistency?
This is the script I am using:
boundary p p p
pair_style lj/cut/tip4p/long 1 2 1 1 0.1546 12.0
kspace_style pppm/tip4p 1.0e-4
# System definition
# Simulation settings
# Define groups
group gH2O type 1 2
group gNa type 3
group gCl type 4
group gliquid type 1 2 3 4
group gwall type 5
region rtop block INF INF INF INF 0 INF
region rbot block INF INF INF INF INF 0
group gtop region rtop
group gbot region rbot
group gwalltop intersect gwall gtop
group gwallbot intersect gwall gbot
dump mydmp all atom 1000 dump.lammpstrj
variable walltopz equal xcm(gwalltop,z)
variable wallbotz equal xcm(gwallbot,z)
variable deltaz equal v_walltopz-v_wallbotz
fix myat1 all ave/time 10 10 100 v_deltaz file interwall_distance.dat
# ^^ This line above is the one which fails
# vv None of the lines below have been run, so if there are some similar issues with this (with the fix command) please let me know, thanks
fix mynve all nve
compute tliq gliquid temp
fix myber1 gliquid temp/berendsen 300 300 100
fix_modify myber1 temp tliq
compute twall gwall temp
fix myber2 gwall temp/berendsen 300 300 100
fix_modify myber2 temp twall
fix myshk gH2O shake 1.0e-4 200 0 b 1 a 1
fix myrct all recenter NULL NULL INIT
timestep 1.0 run 20000
The error message reads:
ERROR: Variable name for fix ave/time does not exist (../fix_ave_time.cpp:215)
Last command: fix myat1 all ave/time 10 10 100 v_deltaz file interwall_distance.dat
Is there a way around using this? Could you please try to help me understand what is going wrong here? so I can know for the future.
Which version of LAMMPS are you using? Please always report it when inquiring about errors.
I do not get the error you are reporting with the current LAMMPS version 3 Nov 2022.
Thus please carefully check if the contents you copied to the forum are exactly as in your failing input. If there was an error with the current version of LAMMPS, it would report the name of the variable that was not found as additional information which can help to better identify the cause of the error.
Ahh thank you for the formatting change.
I am using an external CPU cluster currently, and I am unsure which specific version is installed, I will try and find out.
The command which I typed in is exactly this, it’s copied from the example on the website, just running it through the CPU doesn’t seem to work, with that exact error message. It has also given warnings about the fix command and shake?
I have used this command on my personal PC with the latest version of lammps, and it worked fine, as you previously mentioned this might be a version mismatch with the command. I will try to find the version of lammps I am using, thank you.
log.lammps file includes the LAMMPS version you are using.
That version has the same support for variables as argument than the current version.
The only major difference is that the current version of LAMMPS may transparently correct your input if there are some known non-ASCII characters while the older version does not and that may cause the kind of error you are seeing. Having non-ASCII characters for blanks is a common thing when using cut-n-paste from a website or a PDF file. Modern browser/viewer programs may substitute non-ASCII characters for a better looking output. You can use the command
env LC_ALL=C grep -n '[^ -~]' on your input file to see if there are any lines containing non-ASCII characters.
Thank you for your help, very useful!
I have sorted the problem now though and will close the topic
For the sake of others that will read this discussion later, please post what cause and solution you have found.
It was an inconsistency in my variable names, I think a non- ASCII character. But they match now and the computer completed the script. Thank you for your advice.