[lammps-users] Adding more math functions to the 'compute' command

To the LAMMPS developers,

I wonder if it is possible to add cosine and sine to the list of math
operations allowed under the 'compute' command?

Regards,
Zhun-Yong

To the LAMMPS developers,

dear zhun-yong,

I wonder if it is possible to add cosine and sine to the list of math
operations allowed under the 'compute' command?

you mean "variable equal" not "compute", right?
please try out the attached patch and let us know
if it works for you (the change is very straightforward
so i only verified that it compiles...).

is there need from anybody else to add other
similar (portable!) math functions?
it would be simpler to add this in one go than
incrementally add over time whenever somebody
has a request...

cheers,
    axel.

var_sin_cos.diff.gz (1.22 KB)

Hi Axel,

Thanks for the prompt reply.

My bad. I really meant 'variable', not 'compute'. I actually did add
cos and sin (along with tan, acos, asin, atan and all other
single-argument C math functions) to the file variable.cpp. Is that
all that needs to be done to implement these functions? I've
recompiled the code and it works fine on my Ubuntu desktop.

Once again, thanks for the help.

Zhun-Yong

Hi Axel,

zhun-yong,

Thanks for the prompt reply.

My bad. I really meant 'variable', not 'compute'. I actually did add
cos and sin (along with tan, acos, asin, atan and all other
single-argument C math functions) to the file variable.cpp. Is that

i'm confused. if you already implemented them, why do
you ask to have them implemented in the first place?

all that needs to be done to implement these functions? I've

mostly, you have to adapt the documentation and send the resulting
file to steve so that the change can be included into the next
update, so that everybody benefits from your work and nobody
has to re-do it...

cheers,
   axel.

Axel,

Sorry for the confusion. I asked for the math functions to be
implemented because I wasn't sure if what I had implement was correct
or would screw up the rest of LAMMPS. Maybe that wasn't exactly the
best way of asking for a second opinion on how things should have be
done.

Zhun-Yong

Axel,

Sorry for the confusion. I asked for the math functions to be
implemented because I wasn't sure if what I had implement was correct
or would screw up the rest of LAMMPS. Maybe that wasn't exactly the
best way of asking for a second opinion on how things should have be
done.

right. you could have just posted your implementation,
explain your concern, and ask for comments.

let us for a moment assume that this was something more
complicated to implement (it took me more time to write
the e-mail than to modify the code so i don't care).

how would _you_ feel in a case if somebody had asked
you to implement that feature and then, after you have
done it, you get told, "thanks, i had done it before,
i just wanted to see somebody else do it, so i can see
if i have done it correctly"?

axel.

See the 15May08 patch.

Steve

2008/5/15 Zhun-Yong ONG <[email protected]...>: