Exciting - sgroup on volume optimization

Greetings
I’m trying to rerun the optimization example of hexagonal Beryllium.
I managed to install the sgroup on the tools folder of the exciting.
But when I run the script: LATTICE-parameters.sh input.xml I don’t get:
[tmosuang@cnode0249 Be_OPT]$ …/exciting/tools/LATTICE-parameters.sh input.xml
ImportError: No module named site

 a          b          c          alpha      beta       gamma
 0.00000    0.00000    0.00000    0.00000    0.00000    0.00000

What could I be doing wrong?
Please help
Thuto

Dear Thuto,

the important statement in your output message is:

ImportError: No module named site

This usually happens if the python environment variable PYTHONHOME is not defined.
Please also check if the environment variable PYTHONPATH is defined and included in the PATH.

Yours sincerely,
Pasquale Pavone (exciting team)

Dear Pasquale

Thank you for the information.

In my bash shell I have set the environment variables as instructed in the exciting oxygen version:
#================================================================================================
#The following shell variables are required for executing scripts in the exciting project work

export EXCITINGROOT=/mnt/lustre/users/tmosuang/exciting
export EXCITINGTOOLS=$EXCITINGROOT/tools
#------------------------------------------------------------------------------------------------
export TIMEFORMAT=" Elapsed time = %0lR"
#------------------------------------------------------------------------------------------------
export WRITEMINMAX=“1”
#------------------------------------------------------------------------------------------------
export PYTHONPATH=$PYTHONPATH:$EXCITINGROOT/stm
export PATH=$PATH:$EXCITINGTOOLS:$EXCITINGROOT/bin:$EXCITINGTOOLS/stm
#================================================================================================

So how does one define the PYTHONHOME?

Sincerely
Thuto

Just to clarify, $PYTHONPATH does not go in the $PATH.

Looking at the script LATTICE-parameters.sh calls:

$EXCITINGTOOLS/exciting2sgroup.py input.xml sgroup.in 
sgroup sgroup.in 1>sgroup.out 2>sgroup.err

and

exciting2sgroup.py contains

from   lxml  import etree  as ET
from   numpy import linalg as NL
import numpy               as NU
import sys
import os

I had a quick look and I actually can’t see where sgroup is defined.
I also don’t see anything importing site.

@TMosuang could you please:
a) Point me towards sgroup
b) Try running these two commands manually:

$EXCITINGTOOLS/exciting2sgroup.py input.xml sgroup.in 
sgroup sgroup.in 1>sgroup.out 2>sgroup.err

You can switch $EXCITINGTOOLS for the explicit path. Also make sure you have input.xml in the same directory.
The directory containing sgroup will need to be in your $PATH or just copy sgroup.in to whatever directory sgroup is in.

Cheers,
Alex

Thank you Alex for the information.
I did managed to generate sgroup.in file with Be hexagonal lattice parameters.
I also managed to generate the sgroup.out and sgroup.err files.
But these are generated independent of the LATTICE-parameters.sh script.
And when you call the script: LATTICE-parameters.sh input.xml, they are all wiped out.
The challenge is I can’t proceed with the Be General lattice optimization tutorial if the LATTICE-parameters.sh script does not generate the Bravais lattice parameters.
If I move to the following sript: OPTIMIZE-lattice.py this what I get:

[tmosuang@login2 Be_OPT]$ …/exciting/tools/LATTICE-parameters.sh input.xml
ImportError: No module named site

 a          b          c          alpha      beta       gamma
 0.00000    0.00000    0.00000    0.00000    0.00000    0.00000

[tmosuang@login2 Be_OPT]$ python …/exciting/tools/OPTIMIZE-lattice.py

Please enter the exciting input file name: input.xml
ImportError: No module named site

 ... Oops error: degenerated basis

Now I’m just stucked, I can’t progress with the tutorial.

Any other ideas …?

Oh please
Thuto

Hi Thuto,

I talked to Pasquale. Turns out sgroup is an external program (which I wasn’t aware of). But regarding your specific problem:

Looking at the LATTICE-parameters.sh, the main calls in that script are:

$EXCITINGTOOLS/exciting2sgroup.py $IXML sgroup.in 
sgroup sgroup.in 1>sgroup.out 2>sgroup.err

where $IXML=input.xml. The rest of the script just extracts values from the sgroup.out file.

So if you’re able to get the above calls to work manually, there is no reason the script shouldn’t also work. Have you confirmed input.xml is in the same directory as LATTICE-parameters.sh (or you call as LATTICE-parameters.sh path/to/input.xml' and that sgroup.in` is written to the same directory, following the script execution?

Which script call gives the ImportError? I can’t find an attempt to import that library in our python scripts, which suggests it’s imported by sgroup. Have you tried pip installing the site package?

Cheers,
Alex

Hi Alex,

I need to mention that the sgroup.in file has the following inside:
P
4.3000000000 4.2999798768 6.4500000000 90.0000000000 90.0000000000 120.0001548077

2
0.666670000 0.333330000 0.750000000
Be.xml
0.333330000 0.666670000 0.250000000
Be.xml

But sgroup.out file is just empty (i…e “sgroup.out” 0L, 0C)
And sgroup.err file has “Error: the main conditions not satisfied

Any idea?

Thuto

Dear Thuto,

I think this problem has the same origin as the problem pointed out in another post.
In writing explicitly the components of the basis vectors (basevect) or the
coordinates of the atoms (in particular, is they are expressed in crystal coordinates),
one has to be sure that constants like 1/3, sqrt(2), sqrt(3), etc., are given with the correct
number of significant digits:

1/3 → 0.3333333333
sqrt(3) ->1.73205080757
sqrt(3)/2 → 0.86602540378

Doing this, one should get in your case (inside the file sgroup.in) something like:

P
4.3000000000 4.3000000000 6.4500000000 90.0000000000 90.0000000000 120.00000000

2
0.666666667 0.333333333 0.750000000
Be.xml
0.333333333 0.666666667 0.250000000
Be.xml

which should work fine as input of sgroup.

If you still have problems, please upload here your input file input.xml.

Pasquale Pavone (exciting team)

Dear Pasquale

Oh thank you, I managed to generate the Be hexagonal lattice parameters.
But when I proceed with OPTIMIZE-lattice.py I get the following:

[tmosuang@cnode0230 Be_OPT]$ LATTICE-parameters.sh input.xml
ImportError: No module named site

 Bravais lattice: Hexagonal
 a          b          c          alpha      beta       gamma
 4.30000    4.30000    6.45000   90.00000   90.00000  120.00000

[tmosuang@cnode0230 Be_OPT]$ python …/exciting/tools/OPTIMIZE-lattice.py

Please enter the exciting input file name: input.xml
ImportError: No module named site

 ... Oops error: degenerated basis

What could be problem now?

Thuto

Hi Thuto, could you post the content of the files sgroup.out and sgroup.err ?

After googling, ImportError: No module named site is a python package problem. I would try looking at some of the stack exchange answers

The sgroup.err is just an empty file with: “sgroup.err” 0L, 0C
Here are the fisrt lines of the sgroup.out:
Bravais lattice: Hexagonal

 a             b            c

4.30000000 4.29999999 6.45000000
alpha beta gamma
90.00000000 90.00000000 120.00000011

===== Decomposition of new basis vectors over input basis =====
1.000000 0.000000 0.000000 <— 1
0.000000 1.000000 0.000000 <— 2
0.000000 0.000000 1.000000 <— 3

==== Number of atoms in cell: 2
==== Atom positions:

0.66666667 0.33333333 0.75000000
Be
0.33333333 0.66666667 0.25000000
Be

==== Nonequivalent atoms, point group for each sort: ====

Sort number: 1
Names of point group: -6m2 -6m2 D3h
New basis vectors for this point group:
1.0000 0.0000 0.0000 <— 1
0.0000 1.0000 0.0000 <— 2
0.0000 0.0000 1.0000 <— 3

Thuto

Greetings

Still on the volume optimization example:
In directory: ~/Be_OPT/VOL/
I’m trying to extract the equilibrium parameters using OPTIMIZE-lattice.py
This what I get:
python …/…/exciting/tools/OPTIMIZE-lattice.py
Traceback (most recent call last):
File “/mnt/lustre/users/tmosuang/exciting/tools/OPTIMIZE-analyze.py”, line 29, in
from lxml import etree as ET
ImportError: No module named lxml

Please assist
Thuto

Dear Thuto,

please check the link here.

Best,
Pasquale Pavone (exciting team)

Greetings once more

Still on the hexagonal crystal optimization,I am trying to extract the equilibrium parameters using the script: OPTIMIZE-lattice.py
But the script generates the output files: BM_eos.out; BM-optimized.xml, and energy-vs-volume.
The plot output files BM_eos.png and BM_eos.eps are not generated.
What could be the problem?
Here is the situation:
[tmosuang@cnode0220 VOL]$ OPTIMIZE-lattice.py

Murnaghan or Birch-Murnaghan EOS: [M/B] B

=====================================================================
Fit accuracy:
Log(Final residue in [Ha]): -5.43

Final parameters:
E_min = -29.3609624 [Ha]
V_min = 106.5756 [Bohr^3]
B_0 = 123.041 [GPa]
B’ = 3.436

Optimized lattice parameter saved into the file: “BM-optimized.xml”.

This application failed to start because it could not find or load the Qt platform plugin “xcb”
in “”.

Reinstalling the application may fix this problem.
[tmosuang@cnode0220 VOL]$

Dear Thuto,

please check the link here. It could contain some hints for solving your problem.

Best,
Pasquale Pavone (exciting team)

Hi Alex,

I was trying to use OPTIMIZE-lattice.py on my system (Ubuntu 20.04.1) with exciting-oxygen and I got the following error

… Oops sh: 1: sgroup: not found

So I tried to go on the exciting website to download sgroup, however the link doesn’t seem to work.

Kind regards,
Luigi

Hi Luigo,

I can’t find any reference to downloading sgroup and its name is too generic to google for.
Perhaps @PasqualePavone can give specifics.

Clearly this dependency should be dropped, although I am not sure it will occur in time for the next release.

Cheers,
Alex

Hi Luigi,

where did you try to download sgroup on the exciting website? Try at the link:
[http://exciting.wdfiles.com/local--files/oxygen-elastic/adon_v1_0.tar.gz](download sgroup).

Best regards,
Pasquale Pavone

Hi Pasquale and Alex,

I don’t remember how I got to the link that didn’t work and I can’t really find it anymore.
Regarding sgroup itself: I downloaded it and ran the makefile. Now when I run OPTIMIZE-lattice.py sgroup works fine and correctly identifies the spacegroup of 2H MoS2. However, now when I run OPTIMIZE-lattice.py I get the following message

File “/home/Documents/EXCITING/exciting/tools/OPTIMIZE-setup.py”, line 400, in
OUTOBJ.write(ET.tostring(root, method =‘xml’,
TypeError: write() argument must be str, not bytes

I ran the script 2to3:
“2to3 -w OPTIMIZE-setup.py”

So I’m not sure what happened.

Thanks for the help above,
Kind regards,
Luigi