[lammps-users] weird behavior when i reassign group during a run

Hi all,

I had some problems with my run so im trying to track down the problem. I did a simple npt run and i include the script below:

fix 1 mobile npt temp 600 800 2 aniso 0 0 2
run 200000 every 10000 &
“group lreservoir delete” &
“group rreservoir delete” &
“group lreservoir region left” &
“group rreservoir region right”
unfix 1

I am just reassigning groups to region left and right during the run, but i get weird fluctuation in temperatures.

59500 784.6865963
60000 794.575619
60500 767.3384651
61000 730.7249683
61500 703.5893825
62000 676.6990576
62500 664.4291946
63000 651.1449168
63500 641.5050986
64000 652.0923857
64500 664.4219089
65000 677.5145534
65500 695.1612939

You can see the temperature is climbing up and dropping down like a spring, even though it suppose to behave linearly and climb linearly from 600 to 800.
The temperature drops right after the group setting is applied.

I dont know what is wrong, is it because of my sample, or my Tdamp?

Thanks very much

Hi all,
I had some problems with my run so im trying to track down the problem. I
did a simple npt run and i include the script below:
fix 1 mobile npt temp 600 800 2 aniso 0 0 2
run 200000 every 10000 &
"group lreservoir delete" &
"group rreservoir delete" &
"group lreservoir region left" &
"group rreservoir region right"
unfix 1
I am just reassigning groups to region left and right during the run, but i
get weird fluctuation in temperatures.
59500 784.6865963
60000 794.575619
60500 767.3384651
61000 730.7249683
61500 703.5893825
62000 676.6990576
62500 664.4291946
63000 651.1449168
63500 641.5050986
64000 652.0923857
64500 664.4219089
65000 677.5145534
65500 695.1612939
You can see the temperature is climbing up and dropping down like a spring,
even though it suppose to behave linearly and climb linearly from 600 to
800.
The temperature drops right after the group setting is applied.
I dont know what is wrong, is it because of my sample, or my Tdamp?

what about the many other lines of your input that you are
not showing? why can't the cause be somewhere in there?

axel.

Hi Axel,

ok ill attach the whole input script, but its very very simple so i dont think the problem lies in anywhere else.
I copied my input script below, ive done many runs with this sample so i dont think the sample is bad. I havnt been trying to figure out why it is doing this weird spring behavior for a while now. I think the problem lies in the “every” command or it could be something to do with reassign group.
Any insights would be helpful!
Thanks!!

read_restart 2004-AlNi-sample

EAM potentials

pair_style eam/alloy
pair_coeff * * NiAl.eam.alloy Al Ni

define groups

region move block 0 52.91520 0 52.91520 4.07040 77.88032 units box
group mobile region move
region left block 0 52.91520 0 52.91520 4.07040 8.14080 units box
region right block 0 52.91520 0 52.91520 74.35264 77.88032 units box
group lreservoir region left
group rreservoir region right

#define variables
variable s equal step
variable t equal temp
variable v equal vol
variable p equal press

reset_timestep 0

initial velocities

timestep 0.003
thermo_style custom step temp pe etotal press vol
thermo 5000

dump mydump all custom 500 Al-Ni-NPH.dumpfeb26-11 id type x y z

fix 9 all print 500 "$s $t $v $p " file tempvol-feb26-11.txt title “feb26-11 tim
estep=0.003 run-set both-run same type”

fix 0 mobile npt temp 300 600 2 aniso 0 0 2
run 30000
unfix 0

fix 1 mobile npt temp 600 800 2 aniso 0 0 2
run 200000 every 10000 &
“group lreservoir delete” &
“group rreservoir delete” &
“group lreservoir region left” &
“group rreservoir region right”
unfix 1
unfix 9

the reason i think there is something wrong with “every” command is because if i break up the run into many short "fix"s, and just insert the commands between "fix"s, the temperature does not show the spring behvior.

You probably need to use compute_modify dynamic yes for
any T you are computing with a changing group. See the
compute_modify doc page. This includes any compute temp
that is part of a thermostat or barostat.

Steve

Hi Steve,

So do i need to include computer_modify myTemp dynamic yes in all my fixs or just include it once in the inout script?

Also I’d like to point out when im not reassigning group but just “change atom type without reassigning group”, the spring behavior also occurs.

Ill try the compute_modify first.

Thanks,
Yixin

Hi Steve,
So do i need to include computer_modify myTemp dynamic yes in all my fixs or
just include it once in the inout script?
Also I'd like to point out when im not reassigning group but just "change
atom type without reassigning group", the spring behavior also occurs.
Ill try the compute_modify first.

as i wrote before, you need to back up your statements with
_complete_ inputs, i.e. something that people can take and
run on their local machine to try reproduce it.

what you posted before is useless as it reads in a restart
that nobody but you has (and keep in mind that restarts
may not be portable between platforms or versions of lammps)

without proof nobody can debug it.

axel.

Hi Axel and Steve,

Here is my complete input.

read_restart 2004-AlNi-sample

EAM potentials

pair_style eam/alloy
pair_coeff * * NiAl.eam.alloy Al Ni

define groups

region move block 0 52.91520 0 52.91520 4.07040 77.88032 units box
group mobile region move
region left block 0 52.91520 0 52.91520 4.07040 8.14080 units box
region right block 0 52.91520 0 52.91520 74.35264 77.88032 units box
group lreservoir region left
group rreservoir region right

#define variables
variable s equal step
variable t equal temp
variable v equal vol
variable p equal press

reset_timestep 0

initial velocities

timestep 0.003
thermo_style custom step temp pe etotal press vol
thermo 5000

compute_modify t dynamic yes
dump mydump all custom 500 Al-Ni-NPH.dumpfeb26-16 id type x y z

fix 9 all print 500 "$s $t $v $p " file tempvol-feb26-16.txt title “feb26-16 timestep
=0.003 run-set both-run same type”

fix 0 mobile npt temp 300 600 2 aniso 0 0 2
run 30000
unfix 0

fix 1 mobile npt temp 600 800 2 aniso 0 0 2
run 200000 every 10000 &
“group lreservoir delete” &
“group rreservoir delete” &
“group lreservoir region left” &
“set group lreservoir type 1” &
“group rreservoir region right” &

“set group rreservoir type 2”
unfix 1

unfix 9

Hi Axel and Steve,
Here is my complete input.
read_restart 2004-AlNi-sample

ARE YOU DEAF AND DUMB??

you are again only sending incomplete input.

nobody can run this and validate in person
what is happening and that makes it useless.
that is what i had already told you.

you can only find "obvious" mistakes by staring
at a list on input script commands. anything that
is less obvious requires to strip down the input
to the absolute minimum and then reenable different
features in steps to identify the actual causes and
then decide on whether the code is behaving correctly
and the input is wrong, or the other way around,
or anything in between.

as i have said many times before. if you want
somebody to help you, you need to make it
easy to help you.

axel.

Hi Axel,
Sorry i thought it would be too much trouble to include the sample file because i used a data file and created my sample based on the data file.

ill attach everything to this email, and im running the latest version of lammps.

The in.multilayer is how i created the sample from data file, data.multilayer is the data file, in.multilayerfeb26-16thrun is my input script for the simulation, and 2004-ALNI-sample is my generated sample.

Im sorry to trouble you but ive stuck on this problem for weeks. Due to my limited knowledge in lammps, i have only played around with the input file so far, the sample is actually provided by another PhD student in my lab. I hope to get any insights from you guys!

Thanks,
Yixin

data.multilayer (557 KB)

in.multilayer (842 Bytes)

NiAl.eam.alloy (1.8 MB)

in.multilayerfeb26-16thrun (2.58 KB)

2004-AlNi-sample (1.53 MB)

Hi Axel,
Sorry i thought it would be too much trouble to include the sample file

well, after just had explained why only the input script would be
useless, it was pretty upsetting to see exactly that.

because i used a data file and created my sample based on the data file.

a simple way to get around this would be to first build a much
simpler mockup using a simple potential, e.g. based on the melt
input example and see if the symptoms show up there as well.
if they do, you don't need to send a data file and it is much easier
to debug such a system than something complex and big that is
using a more expensive to compute potential.

this is in general a good strategy to resolve a problem: start
from something that is simple and can be easily reproduced
and then add complexity in steps. remember that you can
validate most functionality of a simulation program without
simulating a realistic or otherwise meaningful input.

cheers,
    axel.

ill attach everything to this email, and im running the latest version of
lammps.

p.s.: you can make those files much smaller by sending a compressed
tar or zip archive... :wink:

ok, after some experimentation i see where you problem is originating from.

the problem is not the group reassignment, but the fact that you use the
every keyword _and_ a temperature ramp.

when you use "every" in combination with run, this is not just one run,
but a shortcut notation for multiple run commands.

the consequence of that is that the thermostat will _rerun_ the
temperature ramp for each of those runs, i.e. start again at 600
and ramp up to 800 within 10000 steps after each "every" operation.

since this is the documented behavior, the lammps code does
indeed what it is supposed to do.

cheers,
    axel.

Thank you so much, my PhD mentor and my advisor have sit with me for countless times and havnt figure this out.

so is there another way to change atom type on the run periodically without using the “every” command?
I am looking at the “if” command and trying to see if it will do the trick, or maybe i have to just simply separate the run into many small interval and inset my “set type” statement after each small interval of run?

I guess this explains all the weird results ive been getting before. Thank you so much!

I am afraid ill have more questions to ask but ill try to research for a solution first.

Thanks again,
Yixin

Thank you so much, my PhD mentor and my advisor have sit with me for
countless times and havnt figure this out.
so is there another way to change atom type on the run periodically without
using the "every" command?

the question is why do you need to do that while you are running a
temperature ramp?

also, i would like to point out that your region definitions are oriented
towards the particle placement _before_ equilibration. when you run
and particularly with npt, this will all get out of whack.

I need to do that because eventually i want to heat the system up to 1750K and hope to establish a constant concentration gradient within the system. If i dont “reset the atom types of those atoms at the two boundaries periodically”, ill just get random Al-Ni mixing. I attached a figure to this email, it can probably help in explaining my goal.

Basically im “reassigning groups and resetting atom types” periodically to maintain a 100% boundary condition. I am try to use the “if” command to do this, and i wonder if “mod” works in “if”? Can i do something like “if “${steps} mod 10000”==0 then blah blah blah”?

As for the dimensions, i calculated the size of one Al atom layer and one Ni atom layer, i dont really understand what u mean by equillibration, but ill try to fix anything u point out.

So do you see what im trying to do with “resetting atom types” periodically now?

Thanks so much for your help!
Yixin

Untitled.jpg

ive read the run command again, and i think the “run start stop” command would do the trick, i am going to try that.

I need to do that because eventually i want to heat the system up to 1750K
and hope to establish a constant concentration gradient within the system.
If i dont "reset the atom types of those atoms at the two boundaries
periodically", ill just get random Al-Ni mixing. I attached a figure to this
email, it can probably help in explaining my goal.

if it is just about the concentration gradient, why don't you just
start from two wedges of both atom types and then modify
fix spring/self so that the restoring force is only applied in z-direction.
this way the concentration gradient is predefined by your initial
conditions and cannot change.

you'll have to explain what you need that gradient for.

Basically im "reassigning groups and resetting atom types" periodically to
maintain a 100% boundary condition. I am try to use the "if" command to do
this, and i wonder if "mod" works in "if"? Can i do something like "if
"${steps} mod 10000"==0 then blah blah blah"?

i don't know, but there a several serious concerns about that approach.
worst of all. you are changing atom types for elements that are very
different in size and mass. that will have two (unphysical) effects.
due to the difference in mass the individual kinetic energy of the
atoms will change by about a factor of two, i.e. ni atoms that were
al before, will suddenly be twice as "hot" and new al atoms only half.
second, due to the difference in size, you will be generating small
shock waves that will keep bouncing back and forth through your
system, the excess kinetic energy due to that will have to be
constantly removed by the thermostat. i cannot imagine that you
can compute any property of such a system without it being
significantly tainted by those effects.

As for the dimensions, i calculated the size of one Al atom layer and one Ni
atom layer, i dont really understand what u mean by equillibration, but ill
try to fix anything u point out.

you start from a perfect crystal and then run with nvt and then npt.
during the npt run, your system will change size and atoms may
move around. at least in x and y you can pick much larger dimensions
to make sure you catch all atoms. in z-direction you have to hope
that the system doesn't deform or drift too much.

also, i am not at all convinced that your scheme will actually
result in that kind of gradient that you are plotting (how did you
create that plot?).

So do you see what im trying to do with "resetting atom types" periodically
now?

you are putting yourself in great misery? :wink:

but seriously, you are only describing the immediate problem,
not the "big picture". if you explain what the purpose of building
that concentration gradient is supposed to be and what kind of
support you have that your method will be suitable to achieve it,
you may get better help.

axel.

Thanks for the long reply:)

ok so the big picture comes from the idea presented in the paper “suppression of crystal nucleation in amorphous layers with sharp concentration gradients” by Desre and Yavari in 1990.
Please look at the graph i attached to this email. Basically the paper stated that nucleation will only occur if the tangent construction of the concentration gradients touch the “tips” of critical nucleus of intermetallic phase in an amorphous layer.

So if i can find a way to establish constant concentration gradient in a system using LAMMPS, then i can find a way to change the slope of the concentration gradient and eventually find the critical concentration gradient or the critical nucleus or the critical radius that nucleation will occur.

Ive found a way to ramp up my temperature correctly now using the “run 10000 start 0 stop 200000” lines.

I am trying to see if i can get a constant concentration gradient today. I wrote a program to count the number of Al and Ni atoms in each layer and thats how i generate the concentration gradient graphs.

Thanks for much for your help, Axel! ill keep in mind of the issues about dimensions and excess energy generated during the run, i am really not an expert at physics so ill talk to my PhD mentor about it.

Sorry for my poor explaining, Ive struggled with materials science for four years and I am trying to finish my last project and not touch materials science forever after i graduate:)

Thanks,
Yixin

aa.jpg

Thanks for the long reply:)
ok so the big picture comes from the idea presented in the paper
"suppression of crystal nucleation in amorphous layers with sharp
concentration gradients" by Desre and Yavari in 1990.

is this a paper of an experimental, theoretical, or simulation study?

Please look at the graph i attached to this email. Basically the paper
stated that nucleation will only occur if the tangent construction of the
concentration gradients touch the "tips" of critical nucleus of
intermetallic phase in an amorphous layer.

nucleation in as small a sample as you have in classical
MD simulations is often difficult to model. you usually
have a large hysteresis due to finite size effects.

So if i can find a way to establish constant concentration gradient in a
system using LAMMPS, then i can find a way to change the slope of the
concentration gradient and eventually find the critical concentration
gradient or the critical nucleus or the critical radius that nucleation will
occur.

as i wrote before, i would favor the method of z-dependent position restraints
for simply constructing a gradient. that would be much less disruptive
and easier to model, and the modifications to fix spring/self are easy to do.

the best thing is that you can define the slope/shape of the gradient
easily through your initial conditions and as soon as you have a properly
equilibrated restart at the desired temperature, you can lift the restraints
and see what happens...

Ive found a way to ramp up my temperature correctly now using the "run 10000
start 0 stop 200000" lines.
I am trying to see if i can get a constant concentration gradient today. I
wrote a program to count the number of Al and Ni atoms in each layer and
thats how i generate the concentration gradient graphs.

have you looked into using fix ave/spatial ?

Thanks for much for your help, Axel! ill keep in mind of the issues about
dimensions and excess energy generated during the run, i am really not an
expert at physics so ill talk to my PhD mentor about it.

good! that is what advisors are for. :wink:

Sorry for my poor explaining, Ive struggled with materials science for four
years and I am trying to finish my last project and not touch materials
science forever after i graduate:)

....and let all the good stuff that you've learned go to waste??? :-))

axel.

hi again,

to illustrate my suggestion i just went ahead and quickly implemented
the modified fix spring/self variant.
you can download the files from here:

http://git.icms.temple.edu/git/?p=lammps-icms.git;a=blob_plain;f=src/fix_spring_self.cpp;hb=e1b106ebdca0ad924d10edcfd002819b2c6f002c
http://git.icms.temple.edu/git/?p=lammps-icms.git;a=blob_plain;f=src/fix_spring_self.h;hb=e1b106ebdca0ad924d10edcfd002819b2c6f002c

also find attached a simple input, based on the LJ melt example
that shows how this would be working and some VMD snapshot
images that show the state at the beginning and the end of the run.
i think that is a pretty convincing concentration gradient. :wink:

by changing the box and wedge parameters, you could easily
adjust the concentration gradient. one can pretty well estimate
what to get from the initial conditions.

enjoy,
    axel.

gradient-start.jpg

gradient-equilib.jpg

in.gradient (1.2 KB)