mcodev31 / libmsym

molecular point group symmetry lib
MIT License
73 stars 33 forks source link

Align molecule to the xz plane. #13

Closed rfkspada closed 6 years ago

rfkspada commented 6 years ago

Dear developer,

Can I determine to which plane the molecule must be aligned? For example, the xyz to water:

3

O   0.000000000000  -0.075791838099  0.000000000000
H   0.866811766181   0.601435735706  0.000000000000
H  -0.866811766181   0.601435735706  0.000000000000

The example aligns it to the xz plane.

3

O  0.000000000  0.000000000 -0.075247508
H  0.866811766 -0.000000000  0.601980066
H -0.866811766  0.000000000  0.601980066

However, for the benzene molecule, if I provide the xyz like:

12

C        0.0000    0.0000    1.3868
H        0.0000    0.0000    2.4691
C        0.0000    1.2010    0.6934
H        0.0000    2.1383    1.2345
C        0.0000    1.2010   -0.6934
H        0.0000    2.1383   -1.2345
C        0.0000    0.0000   -1.3868
H        0.0000    0.0000   -2.4691
C        0.0000   -1.2010   -0.6934
H        0.0000   -2.1383   -1.2345
C        0.0000   -1.2010    0.6934
H        0.0000   -2.1383    1.2345

It is aligned to the xy plane like:

12

C  1.386797673 -0.000000000  0.000000000
H  2.469081414 -0.000000000  0.000000000
C  0.693398837 -1.201002015  0.000000000
H  1.234540707 -2.138287228  0.000000000
C -0.693398837 -1.201002015 -0.000000000
H -1.234540707 -2.138287228 -0.000000000
C -1.386797673  0.000000000 -0.000000000
H -2.469081414  0.000000000 -0.000000000
C -0.693398837  1.201002015 -0.000000000
H -1.234540707  2.138287228 -0.000000000
C  0.693398837  1.201002015  0.000000000
H  1.234540707  2.138287228  0.000000000

I see that it uses a function called msymAlignAxes to do this reorientation, but I could not find a way to set to which plane it must be reoriented.

I see that there are the msymSetAlignmentAxes and msymSetAlignmentTransform functions, but I am not sure how they work or if they are intended to do this.

Is there any other function to set this?

mcodev31 commented 6 years ago

Hi

The molecule is always aligned with the primary axis of the point group in the z axis (this is convention), and (if present) a secondary symmetry element to the x axis.

In the case of benzene the primary axis is the C6 (and therefore the molecule is in the xy plane), whereas for water it is the C2 axis.

The secondary symmetry element is a C2 axis where applicable (Dn, Dnh etc.) and a mirror plane for Cnv (more specific rules apply for triply degenerate groups).

Technically the choice for secondary axis doesn't differentiate between the 2 mirror planes of C2v (the choice is arbitrary at that point since the molecule isn't always planar, see e.g. cyclohexane) but since the detection is based on the moments of inertia, this will select the secondary axis so that the alignment will be the xz plane.

To align water with the xy plane you'd need to use either msymSetAlignmentAxes (or msymSetAlignmentTransform, they do the same thing vector vs matrix). You'd need to set the primary axis to x (or y, your choice), the secondary is dependant on your first choice.

E.g.

double x[3] = {1,0,0}, y[3] = {0,1,0};
msymSetAlignmentAxes(ctx,x,y);
rfkspada commented 6 years ago

Thank you very much.