Customize molecular interaction with hash table

Hi,

I would like to know how could I customize the molecular interaction ( for example, a soft core reputation) by using hash table. Currently I want to define a soft core interaction with three ranges (r < a, a < r <b, r > b) with different corresponding potentials. Previously I got some suggestions that I could define my own pairwise interaction by using hash table but after I searched online, I still could not have an example in detail explaining how to realize it. It would be great if I could have some sample code to start with.

Thank you so much!

Best,

Wanyi

Hi,

I would like to know how could I customize the molecular interaction ( for
example, a soft core reputation) by using hash table. Currently I want to
define a soft core interaction with three ranges (r < a, a < r <b, r > b)
with different corresponding potentials. Previously I got some
suggestions that I could define my own pairwise interaction by using hash
table but after I searched online, I still could not have an example in
detail explaining how to realize it. It would be great if I could have some

sample code to start with.

there really isn't enough specific information here to provide any specific
advice. for the most part, your request reads like "please do my project
for me". so here are some questions that you should be addressing when you
reformulate and then repost your inquiry:

where exactly did you get the recommendation ​to use a hash table and in
which context?

what is the purpose of using a hash table with respect to your goal to have
a partwise defined potential function? i don't see where you need the
former to implement the latter.

where is it exactly that you have problems with? and what did you try to do
so far?

what sample code for what exactly are you looking for?

axel.

Hi Axel,

Sorry that my question was not formulated well. I am new to LAMMPS and currently I want to write a small sample code according to a paper using beads on string model to simulate polymer 3d structure. In the paper, I noticed that there are some repulsive interactions actually have different expression from the function provided in LAMMPS command. For example, for lj/cut, the paper has a similar function except that there is a constant term after the r^6 term. For the soft core repulsion interaction mentioned previously, the potential function defined in the paper could not be found in any pair_style command.

I got the suggestion from the author that I could use hash table to define my own interaction function. However, I didn’t find any examples using customized interaction function. I wonder if “using hash table” actually means I need to write a c++ script to define my own interaction function or is there any build-in command I missed during my research. I found pair_modify and pair_write command in LAMMPS, but according to their description, I don’t think either of them is related to my question. If the hash table is not necessary for defining an interaction function, it would be really nice if I could have some suggestions about how can I define my own interaction function.

Thank you so much for your help!

Sincerely,

Wanyi

Hi Axel,

Sorry that my question was not formulated well. I am new to LAMMPS and
currently I want to write a small sample code according to a paper using
beads on string model to simulate polymer 3d structure. In the paper, I
noticed that there are some repulsive interactions actually have different
expression from the function provided in LAMMPS command. For example, for
lj/cut, the paper has a similar function except that there is a constant
term after the r^6 term. For the soft core repulsion interaction mentioned
previously, the potential function defined in the paper could not be found
in any pair_style command.

I got the suggestion from the author that I could use hash table to define
my own interaction function. However, I didn't find any examples using

​this sounds like the person you contacted has given you bad information or
you are misinterpreting it.

you can easily build a piecewise defined potential function using
*tabulation*, but hash tables are something completely different.
Hash table - Wikipedia (technically you could use a hash
table to tabulate a potential, but there is no benefit from it and a simple
array will service just as well).

customized interaction function. I wonder if "using hash table" actually
means I need to write a c++ script to define my own interaction function or
is there any build-in command I missed during my research. I found
pair_modify and pair_write command in LAMMPS, but according to their
description, I don't think either of them is related to my question. If the
hash table is not necessary for defining an interaction function, it would
be really nice if I could have some suggestions about how can I define my
own interaction function.

​start by reading here:

LAMMPS Molecular Dynamics Simulator

​pair_write *is* related, as it is a way to output a table file in a format
suitable for use with pair style table. in fact, this is what i would
recommend you to do first: set up a simple/small test system with an
analytic potential, say lj/cut or morse and then replace the analytical
potential with the table pair style ​while making certain, that you retain
the output as closely as possible. doing tabulation can introduce
significant errors, when done wrong, so you should start with a setup,
where you can do an internal validation. for your piecewise potential, you
need to write a tool to generate the table. it doesn't have to be in C++,
python or perl or matlab typically are easier to apply for this.

​axel.​