Assigning charge of atom at input script

Hi Lammps users.

I am trying to calculate the total energy of binary ionic crystal in atom_style charge. Pair_style is buck/coul/cut (Buckingham potential and Coulombic interaction with cutoff).

I set the input script to bring the structure data(atom coordinates) via read_data. But my structure data has no information on charges of each atom. So when I start calculation, it shows an error: Incorrect atom format in data file.

Is there any method to assign the charge to each type of atom in the input script when using structure file via read_data?

I attempted to use ¡®set¡¯ command (e.g. set type 1 charge 4). But it did not seems to be effective.

Thanks for your help.


Woong Kee Kim

Once you define an atom_style, your data file has
to be consistent with it. In the case of “charge”, that
means each atom line has to assign a charge. It can
be 0.0 if you like, and then you can reset it from
the input script with the “set” command.


Incidentally, if you want to set the charge for individual atoms
(atom-ID) instead of for all atoms with the same atom-Type, you can do
that this way:

set atom 1 charge -0.8742
set atom 2 charge 0.4371
set atom 3 charge 0.4371
set atom 4 charge -0.8742
set atom 5 charge 0.4371
set atom 6 charge 0.4371

I don't know if this is relevant to the problem you were having.

Thank you all for kind response,
I want to assign charge to all atoms in lattice about ten thousands. So for my case, it seems to be laborious. but it is very good method for treating local charge.

Woongkee Kim.

2014. 1. 10. 오전 7:24 Andrew Jewett <[email protected]...> 작성:

The set command has several options to assign charge
to large numbers of atoms at a time.