[ase-users] rotate atoms to minimize the surrounding cuboid volume

David Ollodart davidollodart at gmail.com
Sun Jan 26 01:13:53 CET 2020


Dear Geng,

If you know the principal axis, and you want to rotate it to the diagonal,
it is just a matter of defining the unit vector perpendicular to the two,
and rotating the principle axis to align with the diagonal. I think the
optimization problem, to find the orientation of a molecule in a box such
that the box volume is minimum provided each atom must be at least a
distance x away from each atom in other images, is not easy, even if you
consider only a cube. If you guess that the principal axis with greatest
moment of inertia should be perpendicular with the diagonal it just
requires calculating the principal axes if you don't know them.

Best,

David

<snippet>
import numpy as np
p = np.array((1,0,0))
d = np.ones(3)/np.sqrt(3)
v = np.cross(p,d)
v *= np.arcsin(np.linalg.norm(v))/np.linalg.norm(v) #magnitude = angle in
radians
from scipy.spatial.transform import Rotation
R = Rotation.from_rotvec(v)

from ase import Atoms
atoms = Atoms('H2', positions=((0,0,0),(0.54,0,0)))
cell = [(10,0,0),(0,10,0),(0,0,10)]
atoms.cell = cell
atoms.center()
COP = atoms.positions.mean(axis=0)
atoms.positions = R.apply(atoms.positions - COP) + COP

from ase.visualize import view
view(atoms)
</snippet>


On Sat, Jan 25, 2020 at 9:00 AM Ask Hjorth Larsen via ase-users <
ase-users at listserv.fysik.dtu.dk> wrote:

> Dear Geng,
>
> Am Sa., 25. Jan. 2020 um 16:41 Uhr schrieb GENG SUN via ase-users
> <ase-users at listserv.fysik.dtu.dk>:
> >
> > Dear ASE users,
> >
> > Is there a method in ase to rotate the atoms object to minimize the
> surrounding vacuum space?
> > Since the molecule is elongated in one principal axis, I hope I can
> orient this axis with the diagonal of the box to minimize the total volume.
> >
> > Thank you very much in advance.
>
> No, but it would be nice to have this if someone is willing to open a
> merge request.
>
> Best regards
> Ask
>
> >
> > Best,
> >
> > Geng
> > _______________________________________________
> > ase-users mailing list
> > ase-users at listserv.fysik.dtu.dk
> > https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200125/2986a787/attachment-0001.html>


More information about the ase-users mailing list