[QE-users] Need a script that can convert primitive cell file file using conventional cell cif file

rekha sharma rekha1997jpr at gmail.com
Thu Jul 16 20:20:20 CEST 2020


Sir,
I am running it on Ubuntu18.04

steps I followed are:

git clone -b dev https://github.com/hungpham2017/mcu.git
cd mcu
sudo python3.7 setup.py  install

updated path in ~/.bashrc as

export PYTHONPATH=/home/rekha/mcu:$PYTHONPATH

source ~/.bashrc

cd ~/case


my mcu.py is

#!/usr/bin/env python
import mcu
work = mcu.CELL(cif='conventional.cif')
prim_cell = work.to_prim_cell()
work.write_cif(prim_cell, filename='primitive')

the ~/case directory is having a conventional.cif file.


Now I run
python3.7 mcu.py


I am getting  the same error what i get at the start:

Traceback (most recent call last):
  File "mcu.py", line 2, in <module>
    import mcu
  File "/home/rekha/case/mcu.py", line 3, in <module>
    work = mcu.CELL(cif='conventional.cif')
AttributeError: module 'mcu' has no attribute 'CELL'


On Thu, Jul 16, 2020 at 11:35 PM Hung Pham <phamx494 at umn.edu> wrote:

> It looks me like there is some problem with the Python interpreter in your
> environment, not the code itself.
> You can try to add this following line at the beginning of your python
> script and rerun it:
> #!/usr/bin/env python
> I found a similar problem here
> <https://answers.ros.org/question/164091/rosrun-of-a-working-python-script-fails/>
> :
> by the way, are you running it on a Window?
>
>
> On Thu, Jul 16, 2020 at 12:56 PM rekha sharma <rekha1997jpr at gmail.com>
> wrote:
>
>> Now I am getting
>> import-im6.q16: unable to grab mouse `': Resource temporarily unavailable
>> @ error/xwindow.c/XSelectWindow/9186.
>> when I do
>> import mcu
>>
>> On Thu, Jul 16, 2020 at 11:15 PM Hung Pham <phamx494 at umn.edu> wrote:
>>
>>> Hell Rekha,
>>>
>>> I guess you downloaded the master branch, I haven't had time to document
>>> the codes yet with many new functions.
>>> Hence, the latest code remains in the dev branch, please:
>>>
>>> git clone -b dev https://github.com/hungpham2017/mcu.git let me know if
>>> you have any other questions. Hung
>>>
>>> On Thu, Jul 16, 2020 at 12:40 PM rekha sharma <rekha1997jpr at gmail.com>
>>> wrote:
>>>
>>>> Dear Sir,
>>>> I have cloned it and then added the path to ~/.bashrc.
>>>>
>>>> But my import mcu is not working.
>>>>
>>>> My python path is:
>>>> export PYTHONPATH=/home/rekha/mcu:$PYTHONPATH
>>>>
>>>> I have created a file "mcu.py" in which I kept
>>>> import mcu
>>>> work = mcu.CELL(cif='conventional.cif')
>>>> prim_cell = work.to_prim_cell()
>>>> work.write_cif(prim_cell, filename='primitive')
>>>>
>>>> and then invoked
>>>>
>>>> python mcu.py
>>>>
>>>> this gives me error
>>>>
>>>> Traceback (most recent call last):
>>>>   File "mcu.py", line 1, in <module>
>>>>     import mcu
>>>>   File "/home/rekha/case/mcu.py", line 2, in <module>
>>>>     work = mcu.CELL(cif='conventional.cif')
>>>> AttributeError: module 'mcu' has no attribute 'CELL'
>>>>
>>>>
>>>> I am having my conventional.cif in "/home/rekha/case/" directory.
>>>>
>>>>
>>>> What should I do now?
>>>>
>>>>
>>>> On Thu, Jul 16, 2020 at 10:44 PM Hung Pham <phamx494 at umn.edu> wrote:
>>>>
>>>>> Sorry, there was a typo in the example script, it should be this:
>>>>>
>>>>> import mcu
>>>>> work = mcu.CELL(cif='conventional.cif')
>>>>> prim_cell = work.to_prim_cell()
>>>>> work.write_cif(prim_cell, filename='primitive')
>>>>>
>>>>> Hung Pham
>>>>>
>>>>> On Thu, Jul 16, 2020 at 12:12 PM Hung Pham <phamx494 at umn.edu> wrote:
>>>>>
>>>>>> Hello Rekha,
>>>>>>
>>>>>> Spglib library <https://spglib.github.io/spglib/index.html> is doing
>>>>>> what you are looking for. Spglib has a python interface and can be easily
>>>>>> installed via Pip or conda..
>>>>>> But you need to make a cell tuple (from CIF) which contains the
>>>>>> lattice information, this requires some minimal Python programming.
>>>>>> My MCU <https://github.com/hungpham2017/mcu/tree/dev> project
>>>>>> supports CIF file as well as the QE output files and it has cell analysis
>>>>>> functions using spglib. Within a few lines of code, you can get what you
>>>>>> want in the desired format. For example, in a Python interpreter or script:
>>>>>>
>>>>>> import mcu
>>>>>> work = mcu.CELL(cif='conventional.cif')
>>>>>> primitive = work.to_prim_cell()
>>>>>> work.write_cif(prim_cell, filename='primitive')
>>>>>>
>>>>>> If you are interested in this, I can assist further.
>>>>>> Hung Pham
>>>>>>
>>>>>>
>>>>>> On Thu, Jul 16, 2020 at 11:57 AM rekha sharma <rekha1997jpr at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Thank you very much sir,
>>>>>>>
>>>>>>> My materials are very new and not available in any database.
>>>>>>>
>>>>>>> On Thu, Jul 16, 2020, 22:24 Yuvam Bhateja <yuvamb16 at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hello Rekha
>>>>>>>>
>>>>>>>> You can check out "Material Project".
>>>>>>>> It's a database where researchers share their findings and results
>>>>>>>> of several different types of materials and of different applications.
>>>>>>>>
>>>>>>>> Every compound is available in primitive, conventional, computed
>>>>>>>> and symmetric unit cell, etc.
>>>>>>>> Hope you find this useful.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Yuvam Bhateja
>>>>>>>>
>>>>>>>> On Thu, 16 Jul 2020, 7:40 pm rekha sharma, <rekha1997jpr at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Dear Expert Users,
>>>>>>>>>
>>>>>>>>> It is possible that this question has been answered many times
>>>>>>>>> before but I could not find it on the forum.
>>>>>>>>>
>>>>>>>>> I have few complex structures and it is not possible to handle on
>>>>>>>>> my system in the conventional form.
>>>>>>>>>
>>>>>>>>> Can you please advise any tool that can help me to convert
>>>>>>>>> a conventional cell cif file to a primitive cell file?
>>>>>>>>>
>>>>>>>>> I have tried with VEST (niggli cell reduction) but it does not
>>>>>>>>> work for me.
>>>>>>>>>
>>>>>>>>> Thank you very much.
>>>>>>>>> Rekha
>>>>>>>>> _______________________________________________
>>>>>>>>> Quantum ESPRESSO is supported by MaX (
>>>>>>>>> www.max-centre.eu/quantum-espresso)
>>>>>>>>> users mailing list users at lists.quantum-espresso.org
>>>>>>>>> https://lists.quantum-espresso.org/mailman/listinfo/users
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Quantum ESPRESSO is supported by MaX (
>>>>>>>> www.max-centre.eu/quantum-espresso)
>>>>>>>> users mailing list users at lists.quantum-espresso.org
>>>>>>>> https://lists.quantum-espresso.org/mailman/listinfo/users
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Quantum ESPRESSO is supported by MaX (
>>>>>>> www.max-centre.eu/quantum-espresso)
>>>>>>> users mailing list users at lists.quantum-espresso.org
>>>>>>> https://lists.quantum-espresso.org/mailman/listinfo/users
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Hung Q. Pham
>>>>>> Gagliardi Group
>>>>>> Office: Smith 101
>>>>>> Email: phamx494 at umn.edu
>>>>>> Personal page: hungpham2017.github.io
>>>>>> Department of Chemistry
>>>>>> University of Minnesota - Twin Cities, Minneapolis, MN 55455
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Hung Q. Pham
>>>>> Gagliardi Group
>>>>> Office: Smith 101
>>>>> Email: phamx494 at umn.edu
>>>>> Personal page: hungpham2017.github.io
>>>>> Department of Chemistry
>>>>> University of Minnesota - Twin Cities, Minneapolis, MN 55455
>>>>> _______________________________________________
>>>>> Quantum ESPRESSO is supported by MaX (
>>>>> www.max-centre.eu/quantum-espresso)
>>>>> users mailing list users at lists.quantum-espresso.org
>>>>> https://lists.quantum-espresso.org/mailman/listinfo/users
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>>
>>>>
>>>> Best wishes
>>>>
>>>> Ms. Rekha
>>>> Teaching Assistant,
>>>> Department of Physics
>>>> RK college, Jaipur, India
>>>> Mob.: +11 90-95 790 71 697
>>>> Email: rekha1997jpr at gmail.com
>>>> _______________________________________________
>>>> Quantum ESPRESSO is supported by MaX (
>>>> www.max-centre.eu/quantum-espresso)
>>>> users mailing list users at lists.quantum-espresso.org
>>>> https://lists.quantum-espresso.org/mailman/listinfo/users
>>>
>>>
>>>
>>> --
>>>
>>> Hung Q. Pham
>>> Gagliardi Group
>>> Office: Smith 101
>>> Email: phamx494 at umn.edu
>>> Personal page: hungpham2017.github.io
>>> Department of Chemistry
>>> University of Minnesota - Twin Cities, Minneapolis, MN 55455
>>> _______________________________________________
>>> Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso
>>> )
>>> users mailing list users at lists.quantum-espresso.org
>>> https://lists.quantum-espresso.org/mailman/listinfo/users
>>
>>
>>
>> --
>>
>>
>>
>>
>> Best wishes
>>
>> Ms. Rekha
>> Teaching Assistant,
>> Department of Physics
>> RK college, Jaipur, India
>> Mob.: +11 90-95 790 71 697
>> Email: rekha1997jpr at gmail.com
>> _______________________________________________
>> Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso)
>> users mailing list users at lists.quantum-espresso.org
>> https://lists.quantum-espresso.org/mailman/listinfo/users
>
>
>
> --
>
> Hung Q. Pham
> Gagliardi Group
> Office: Smith 101
> Email: phamx494 at umn.edu
> Personal page: hungpham2017.github.io
> Department of Chemistry
> University of Minnesota - Twin Cities, Minneapolis, MN 55455
> _______________________________________________
> Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso)
> users mailing list users at lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/users



-- 




Best wishes

Ms. Rekha
Teaching Assistant,
Department of Physics
RK college, Jaipur, India
Mob.: +11 90-95 790 71 697
Email: rekha1997jpr at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20200716/02715e3a/attachment.html>


More information about the users mailing list