Fix ave/spatial: using the bin number to access last element in f_ID[J] vectors

Dear mailing list members,

I’m doing simulations that stretch and break metal nanostructures (notched cylinders) in one dimension (z-axis). I do this by fixing a few layers at the top and bottom of a structure, moving those layers apart and then allowing the intermediate layers to stretch and move until breaking.

I also use fix ave/spatial to calculate the number of atoms in bins along the direction of stretching, as well as to look for the bin containing the least number of atoms (via the variable min() special function).

Now seeing as my structure is changing in size, the number of bins increase as the simulation proceeds. So I would like to know if there is a way to calculate or find the number of bins during the simulation. I would like to access the last element in the f_ID[J] vectors.

Thanks in advance for your help.

Regards

Wynand

Fix ave/spatial calculates that internally. You can use
the “units reduced”

option if you don’t want the bin count to change.

Otherwise I suppose you do the calculation of # of bins
yourself with a simple formula defined in a variable (see
the variable doc page) - e.g. lx/binsize.

Steve

Fix ave/spatial calculates that internally. You can use
the “units reduced”

option if you don’t want the bin count to change.

Otherwise I suppose you do the calculation of # of bins
yourself with a simple formula defined in a variable (see
the variable doc page) - e.g. lx/binsize.

Steve

Hi Steve,

Thanks for your prompt reply and the helpful suggestions.

I tried dividing lz by my bin delta, but sometimes when two bins were about to be added as a result of the structure being stretched, the first and last bins would not contain any atoms, and thus min(f_ID[2]) would not give the minimum number of atoms at the narrowest cross-section of my structure.

I would also not like to use units reduced because, if I understand things correctly, that would mean changing bin sizes since my structure is stretching. I’m basing the choice of my bin size (delta = distance between close-packed layers or 1/2<001> for a face-centered cubic lattice) on a method I read about in a paper.

In the end I decided to try my hand at adding a special function to variable.cpp. I added a length(x) special function in the appropriate places (value = nvec) and it seems to be working.

Thanks very much again

Regards

Wynand