Introduce particle parameter

Submitted by robin on Wed, 11/04/2015 - 12:14

Hi everyone!

So far, I've used custom interaction parameters (something like a rigidity) in my contact laws, adding them in the file global_properties.cpp.

Now, I'd like to introduce a particle parameter (something like a radius).
What I've tried so far is reproduce what's implemented for the radius in the following files :
- atom.h, atom.cpp : define the new parameter
- set.cpp : set it in the input script
- atom_vec_sphere.h, atom_vec_sphere.cpp : set the atom->parameter_flag to 1, manage memory (as far as I understand)

Is it a correct way to go? Am I missing something?
Could someone give me a few hints about the memory managment?
What I wrote compiles all right, but I'm getting seg fault when runing certain tests cases.
I'm wondering if I have to modify some values like size_data_atom line 85 in AtomVecSphere::AtomVecSphere in the file atom_vec_sphere.h, but from what I tried, it looks more related with reading an input file.

Any help or hints welcome!

Cheers,
Robin

ckloss's picture

ckloss | Thu, 12/10/2015 - 22:05

Hi Robin,

welcome to the forums! The way I would do this is to have a fix property/atom registered in the contact model framework, in the postSettings() function.
If you look for occurrences of the string "property/atom" in the code, you'll get a couple hints how to use it

Happy coding!

best wishes
Christoph

robin | Thu, 01/14/2016 - 11:54

Hello,

Thanks Christoph, indeed the easiest way to define a per-atom parameter is to use fix property/atom, in the input script.
This per-atom value can then be use and modified in a contact law. To do this, a good example seems to be what's implemented in cohesion_model_easo_capillary_viscous.h for the parameter surfaceLiquidContent.

The postSettings() function can be found in surface_model_default.h. I did'nt use it, but I suppose it would be usefull to use the new particle parameter in various interaction models.

Cheers,

Robin

ckloss's picture

ckloss | Mon, 02/08/2016 - 13:01

Hi Robin,

yes - typically you would not add the fix property/atom in the input script if it is mandatory for a contact model. LIGGGHTS typically automatically adds them when a contact model is created, e.g. in the connectToProperties() function

Best wishes
Christoph