Implementing a new command

Dear Mailing List,

I want to implement a new CommandStyle in Lammps.

It will be based on the CG and minimize command,
but will be dealing with forces with respect to the charge since my aim is to develop a simple charge equilibration method
(the ones implemented in Lammps already do not work for my system).

I have already deduced the flow chart of the files involved in the minimize command (that will be the ones to copy and modify).

I haven’t found that much on this at the page
http://lammps.sandia.gov/doc/Section_modify.html

Is there any step-by-step guide on how to do that ?

In particular I modified simply the names of the minimize.cpp and minimize.h into minimizeq.cpp and *.h
and modified the name of the class inside them, but when compiling I get as first errors:

…/minimizeq.cpp:28:1: error: ‘Minimizeq’ does not name a type
…/minimizeq.cpp:32:6: error: ‘Minimizeq’ has not been declared

Should I change something else ?

I deeply hope that for my purpose I don’t need to change the core of Lammps !

Thank you in advance for your suggestions.

Best regards,

Daniele Scopece

Dear Mailing List,

I want to implement a new CommandStyle in Lammps.
It will be based on the CG and minimize command,
but will be dealing with forces with respect to the charge since my aim is
to develop a simple charge equilibration method
(the ones implemented in Lammps already do not work for my system).

steve just yesterday released a new version with the QEQ package
written by ray shan, offering more generalized charge equilibration
options.

I have already deduced the flow chart of the files involved in the minimize
command (that will be the ones to copy and modify).

the minimize commands are meant to do geometry optimizations.

I haven't found that much on this at the page
http://lammps.sandia.gov/doc/Section_modify.html

Is there any step-by-step guide on how to do that ?

there is the developers guide and the tutorial presentations from
various workshops. yet, all that one needs to know - outside of being
sufficiently fluent in reading and writing C++ code - is effectively
in that section of the documentation.

In particular I modified simply the names of the minimize.cpp and minimize.h
into minimizeq.cpp and *.h
and modified the name of the class inside them, but when compiling I get as
first errors:
../minimizeq.cpp:28:1: error: ‘Minimizeq’ does not name a type
../minimizeq.cpp:32:6: error: ‘Minimizeq’ has not been declared

Should I change something else ?

have you checked that there is not typo? otherwise i would suspect
that your modifications are not 100% correct.

I deeply hope that for my purpose I don't need to change the core of Lammps

you are far too vague in what you want to do in order to give specific
advice. all existing QEQ schemes are implemented in the form of a fix,
which seems the logical step. so perhaps you first need to explain why
a new minimization command is needed.

axel.

> Dear Mailing List,
>
> I want to implement a new CommandStyle in Lammps.
> It will be based on the CG and minimize command,
> but will be dealing with forces with respect to the charge since my aim
is
> to develop a simple charge equilibration method

How "simple" are we talking about? The fix qeq/point variant is as simple
as it gets and it solves charges using a CG method. Please have a look at
it and it may be what you wanted. If not, it would be easier to modify it
than write a new minimizeq class.

Ray

Fixes can be applied during minimization if they provide
the proper “hooks” for the minimizer to call. They can even
define new minimization variables (e.g. charge in this case).

Ray, the doc page for the new fix qeq styles says they operated
during minimization. Does that mean they provide a gradient
term due to the change in charge assignments that corresponds
to the change in energy?

Steve

Dear Ray, Steve and Axel,

Thank you very much for your prompt replies.

I have studied in details the QEq implementation in Lammps and the papers quoted in the doc page.
It seems that the variant qeq/slater is the one I need.

Since I have to add some energetic terms to it, I would need to have some clarifications of a few points
I haven’t been able to understand.

If Ray could help me, that would be much appreciated and useful.

For Ray’s and the community’s convenience I have prepared a short presentation (attached)
where I resume the algorithm used (just to check)
and my questions.

I also send the pptx so that the answers can be edited directly there (if this is more comfortable).

Once I get the complete picture I can extend this presentation for the community’s use.

Thank you very much in advance for your help.

Best regards,

Daniele Scopece

PS: for Axel, you were right: there I made a misspelt, thank you.

01-Question-QEq-Lammps.v01.2014-09-15.pdf (230 KB)

01-Question-QEq-Lammps.v01.2014-09-15.pptx (324 KB)

Ans 1: from double counting i-j and j-i (eq 14.1) and in the compute_H function. By the way, your Eq. 14.1 is incomplete and incorrect.

Ans 2: Contribution from k-space is truncated, which results in inconsistency between energy and its first derivatives. So you have to be sure the cutoff (set by the cutoff keyword in fix qeq) is long enough so that truncated part is negligible.

Ans 3: woself is from the self integral, meaning when i=j in Eq. 14.2. K-space contributions are truncated.

Ans 4: calculate_H_wolf is used when the Streitz-Mintmire potential is used with Wolf sum instead of Ewald sum. It is not used at this point.

My Q for you: what is it that you want to add? What potential form? Is it published in any paper?

Ray

Dear Ray,

thank you for your answers.

  1. I need to add a term that is limiting the charge on an atom between a minimum and a maximum value, so to be sure that the charge is between the physically known valence values.

This term is described in

Lazic & Thijsse, Computational Materials Science 53, 483 (2012)

equation 19, first term (containing qmin and qmax).

  1. How should my eq.(14.1) be ? What is missing ?

I took this shape from Streitz, Mintmirne, Phys. Rev. B (1994),equation (7)

Thanks

Bests,
Daniele