# periodic boundaries in non-ortogonal box

Hello,
I and some colleagues are creating a USER package for lammps to perform Parinello metadynamics, based on gaussian penalty functions applied to a system configuration.

Pretty much like a series of fix_spring_self, with a negative spring constant (repulsion from the original configuration).

Looking at fig_spring_self.cpp, the whole thing is clear for orthogonal boxes. Still, I can not see how the periodic boundary conditions are taken into account in the case of a triclinic box.
So I have two questions:
(1) Does fix_spring_self actually work for triclinic boxes?
(2) Is atom->x expressed in a projected orthogonal box (through an h matrix, I guess)?

If (2) is is the case, is the projection conserving the distances? Otherwise the spring constant should be modified accordingly. The same holds for fix_spring with tether.

I tried to figured this out myself but I got a bit lost.

Thanks,

PS: if, in addition, you could spend a couple of words or indicate me a reference to understand how lammps treats triclinic boxes in general (mainly the projection to the orthogonal box and the pbcs), that would be helpful too.

Hello,
I and some colleagues are creating a USER package for lammps to perform Parinello metadynamics, based on gaussian penalty functions applied to a system configuration.

are you aware of the PLUMED package?
perhaps the feature you are looking for is already
in there, or would be much easier to add.

Pretty much like a series of fix_spring_self, with a negative spring constant (repulsion from the original configuration).

Looking at fig_spring_self.cpp, the whole thing is clear for orthogonal boxes. Still, I can not see how the periodic boundary conditions are taken into account in the case of a triclinic box.
So I have two questions:
(1) Does fix_spring_self actually work for triclinic boxes?

why should it not?

(2) Is atom->x expressed in a projected orthogonal box (through an h matrix, I guess)?

no. determining the minimum image distance between two atoms
is done by computing the distance vector and then calling
domain->minimum_image(). that will take care of non-orthogonal
boxes transparently.

If (2) is is the case, is the projection conserving the distances? Otherwise the spring constant should be modified accordingly. The same holds for fix_spring with tether.

since coordinates are always absolute, this doesnâ€™t apply.

I tried to figured this out myself but I got a bit lost.

Thanks,

PS: if, in addition, you could spend a couple of words or indicate me a reference to understand how lammps treats triclinic boxes in general (mainly the projection to the orthogonal box and the pbcs), that would be helpful too.

have you studied the file domain.cpp (or is that too obvious?).

axel.

I will just add that tricilinic boxes in LAMMPS do
not affect the atom coords. They are still
stored as absolute x,y,z values (no h matrix applied)
so there is no correction applied to the distance between
2 atoms. The adjustment for triclinic is only
done when an atom passes thru boundaries.

I don't think that fix spring/self has any logic
for triclinic boxes to add offsets for periodic
images. This should be added.

Steve