Specifying coefficients for pair_style Python from the input file?


I was wondering if is is possible to specify coefficients for pair_style Python from the input file.

Consider the example from the pair_style Python documentation for the harmonic/cut interaction. In this example, pair_style Python is used to define the following interaction:

units real
pair_style python 10.0
pair_coeff * * py_pot.Harmonic A B

which is equivalent to

units real
pair_style harmonic/cut
pair_coeff 1 1 0.2 9.0
pair_coeff 2 2 0.4 9.0

But in the former, the values for the harmonic potential coefficients for both atom types are hardcoded in the Python file, whereas in the latter they can be specified directly from the LAMMPS input file. If I wanted to change the coefficients, I don’t want to have to edit the Python code every time. Is it possible to setup pair_style Python so that the values of the coefficients can be passed into the Python code directly from the input file?

Thank you,

No. That would be quite complicated and would remove the generality of this interface.

What you can do is to program all different sets of parameters into different classes, e.g. py_pot.Harmonic1, py_pot.Harmonic2, and so on and then choose a different class in the input.