AiiDA-LAMMPS: how to get vectorial property/atom?

Hello,
I just started using aiida-lammps and LAMMPS, so total beginner! I would be interested in getting forces on each atom, but I don’t understand how to do so.

The following input parameters don’t work:

parameters = Dict({
    "control": {
        "units": "metal",
        "newton": "off",
        "timestep": 1e-5
    },
    "compute":{
        "pe/atom": [{"type": [{"keyword": " ", "value": " "}], "group": "all"}],
        "ke/atom": [{"type": [{"keyword": " ", "value": " "}], "group": "all"}],
        "property/atom": [{"type": [{"keyword": " ", "value": "fx"}, {"keyword": " ", "value": "fy"}], "group": "all"}],
    },

    "structure":{"atom_style": "atomic"},
    "thermo":{
        "printing_rate": 1,
        "thermo_printing": {
            "step": True,
            "pe": True,
            "ke": True,
        },
    },
    "dump":{
        "dump_rate": 1,
    },
    "minimize":{
        "style": "cg",
        "energy_tolerance": 1e-6,
        "force_tolerance": 1e-6,
        "max_iterations": 1000,
        "max_evaluations": 1000,
    },
})

I can’t really get how to set the compute part. This input leads to the following error:

03/01/2024 02:25:19 PM <2279478> aiida.parser.LammpsBaseParser: [ERROR] LAMMPS emitted the error {'message': 'ERROR: Dump custom compute property_atom_all_aiida does not calculate per-atom vector (src/dump_custom.cpp:1472)', 'command': 'Last command: dump aiida all custom 1 aiida_lammps.trajectory.dump id type element x y z c_ke_atom_all_aiida c_pe_atom_all_aiida c_property_atom_all_aiida'}
03/01/2024 02:25:19 PM <2279478> aiida.orm.nodes.process.calculation.calcjob.CalcJobNode: [WARNING] output parser returned exit code<309>: The parser detected the lammps error :{'message': 'ERROR: Dump custom compute property_atom_all_aiida does not calculate per-atom vector (src/dump_custom.cpp:1472)', 'command': 'Last command: dump aiida all custom 1 aiida_lammps.trajectory.dump id type element x y z c_ke_atom_all_aiida c_pe_atom_all_aiida c_property_atom_all_aiida'}

Any help is greatly appreciated!

Hi,
This clearly seems to be an error raised by lammps,
I don’t see your full script, but it seems you are trying to append a property to dump custom command, which is not vector based --it’s not a property per atom. For more questions about lammps you can refer to their own mailing list.

If you are beginner both in lammps and aiida, I suggest for easier debugging, first try to write your simulation lammps script, “naked”, and run it for a few short steps. Only when that is successful, then for the next step convert it to aiida-lammps.

Please note, even if you keep using it the way you do, aiida-lammps still correctly reports all errors from lammps. My suggestion is only for your personal convenience.

Thanks for the help!
Indeed it is a LAMMPS error, but because it is expecting something like

dump aiida all custom 1 aiida_lammps.trajectory.dump id type element x y z c_ke_atom_all_aiida c_pe_atom_all_aiida c_property_atom_all_aiida[1] c_property_atom_all_aiida[2] c_property_atom_all_aiida[3]

Instead aiida-lammps is writing:

dump aiida all custom 1 aiida_lammps.trajectory.dump id type element x y z c_ke_atom_all_aiida c_pe_atom_all_aiida c_property_atom_all_aiida

But I don’t understand how to obtain via the plugin the input that LAMMPS is expecting.

Hello @bastonero !

I’ll try to see if I can reproduce the issue that you are rising, I did not try this specific combination when I wrote the plugin, so maybe I missed something. Working with vectorial quantities might be messing something up.

Just in case you are not married to the idea of using the traditional approach of using Dict and StructureData nodes as inputs, the aiida-lammps plugin also has the LammpsRawCalculation which simply takes a complete LAMMPS input script as a SinglefileData.

1 Like

Hello @bastonero !
I think I know what the problem is, so most quantities from lammps in the computes have defined how many entries they are going to be. For example in the stress per atom you know that you will have 6 entries per atom. This is something that we take into consideration when writing the dump.

The problem is that the property/atom is different, as depending on what entries you have there it can change how many entries that vector has, i.e. if you write fx, fy it will have 2 entries, if you have fx,fy,fz it will have 3.
This is something that we did not take into consideration, as I honestly just never used this compute.

If you can open an issue I can try to fix it in the coming days. I might put a special case for this one compute and then handle the other ones as we have been doing.

In case you need to run now, as @sphuber you can always use the LammpsRawCalculation and just pass the entire script.

1 Like