# Aiida-vibroscopy: Is it possible to access vibration modes?

**URL:** <https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346>\
**Category:** New to AiiDA\
**Created:** [March 25, 2024, 4:49pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346 "2024-03-25T16:49:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [March 25, 2024, 4:49pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/1 "2024-03-25T16:49:33Z")

</div>

Hi @bastonero

Is it possible to access the vibrational modes from vibroscopy, like we do in ph.x (.axsf file)?

Rijan

---

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [March 25, 2024, 5:07pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/2 "2024-03-25T17:07:07Z")

</div>

I don’t know this format. What do you mean? You can use one of the scripts I shared, and use the `Phonopy` class to post-process further.

---

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [March 25, 2024, 6:51pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/3 "2024-03-25T18:51:04Z")

</div>

Hi @bastonero  
I am talking about how atoms vibrates in each mode (that also includes in Raman active modes) kind of display. I havent used phonopy a lot, but can something like this (eigenvectors in each modes) be extracted from calculation completed in IRamanSpectraWorkChain?

![Capture](https://global.discourse-cdn.com/free1/uploads/aiida/original/1X/7b3a41b324804759cbcbe5dcfd4662c2df203b0a.png)

---

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [March 25, 2024, 7:11pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/4 "2024-03-25T19:11:15Z")

</div>

Unfortunately there is no direct way to get such thing yet. Since the entire aiida-vibroscopy is built on top of Phonopy, you should look into it to get these.

So for instace, via aiida-phonopy:

```python
from aiida_phonopy.calculations.phonopy import PhonopyCalculation

inputs = {
  'parameters': Dict('anime_type': 'jmol', 'anime': [0,0,0]), # phonons at Gamma
  'force_constants': vibrational_data_node, # here a vibrational data node that you want to use
  'code': load_code('phonopy@localhost'), # change here
  'settings': Dict('keep_animation_files': True).
}

calc = submit(PhonopyCalculation, **inputs)

print(f'Launched calculation with PK = {calc.pk}')

```

Then you can find these files in `calc.outputs.retrieved` (or just do `load_node(PK).outputs.retrieved`). This is a `FolderData`, and then via python you can simply get the file and dump it wherever you want.  
If you want other options look here: [Setting tags — Phonopy v.2.22.0](https://phonopy.github.io/phonopy/setting-tags.html#create-animation-file)  
You can use any of such setting tags to postprocess your data.

For instance:

```auto
node = load_node(PK)
folder = node.outputs.retrieved

print(folder.list_object_names())

```

You can see how to use FolderData here: [Data types — AiiDA 2.5.1.post0 documentation](https://aiida.readthedocs.io/projects/aiida-core/en/latest/topics/data_types.html#topics-data-types-core-folder)

Bare with me if some typos are in the scripts, just wrote them on the fly. But you should have got the gist.

---

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [March 25, 2024, 7:55pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/5 "2024-03-25T19:55:08Z")

</div>

Hi Lorenzo,  
Is this a separate independent run or dependent on previous IRamanSpectraWorkChain?  
Based on this input, how will phonopy know what structure/material I am talking about?

> [@bastonero](#):
>
> ```auto
> from aiida_phonopy.calculations.phonopy import PhonopyCalculation
> 
> inputs = {
> 'parameters': Dict('anime_type': 'jmol', 'anime': [0,0,0]), # phonons at Gamma
> 'force_constants': vibrational_data_node, # here a vibrational data node that you want to use
> 'code': load_code('phonopy@localhost'), # change here
> 'settings': Dict('keep_animation_files': True).
> }
> 
> calc = submit(PhonopyCalculation, **inputs)
> 
> print(f'Launched calculation with PK = {calc.pk}')
> 
> ```

---

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [March 25, 2024, 8:08pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/6 "2024-03-25T20:08:03Z")

</div>

You need to provide the `force_constants` input. The `VibrationalData` contains such information. So just put such a node which is an output of the IRamanSpectraWorkChain.  
E.g.

```auto
...
'force_constants': load_node(PK).outputs.vibrational_data.numerical_accuracy_2, 
...

```

where PK is of the IRamanSpectraWorkChain finished correctly

---

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [March 25, 2024, 8:53pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/7 "2024-03-25T20:53:20Z")

</div>

Understood.

I am trying to create code for phonopy so that I could load code in the inputs above. Below is the code.yaml file but I am not sure what would be the default\_calc\_job\_plugin: ?

```auto
label: 'phonopy'
description: 'Phonopy'
default_calc_job_plugin: ' '
filepath_executable: '/users/rkarkee/phonopy'
computer: 'newhpc'

```

---

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [March 27, 2024, 9:51am UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/8 "2024-03-27T09:51:03Z")

</div>

you can also use your local version of phonopy, as it is a simple post-process. for instructions: [Get started — aiida-phonopy 1.1.4 documentation](https://aiida-phonopy.readthedocs.io/en/latest/installation/index.html#code)

---

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [March 31, 2024, 12:09am UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/9 "2024-03-31T00:09:53Z")

</div>

> [@bastonero](#):
>
> `load_node(PK).outputs.vibrational_data.numerical_accuracy_2`

In this part, I got this syntax error:

```auto
(aiidaENV) rkarkee@ch-fe2:~> python displacement.py
  File "/users/rkarkee/displacement.py", line 12
    'settings': orm.Dict('keep_animation_files': True)
                                               ^
SyntaxError: invalid syntax

```

My displacement.py is:

```auto
from aiida_phonopy.calculations.phonopy import PhonopyCalculation
from aiida import load_profile, orm
from aiida.engine import submit

code = orm.load_code('phonopy@newhpc')
parameters={'anime_type': 'jmol', 'anime': [0,0,0]}

inputs = {
  'code': code,
  'parameters': orm.Dict(parameters),
  'force_constants': load_node(2418).outputs.vibrational_data.numerical_accuracy_4, # here a vibrational data node that you want to use
  'settings': orm.Dict('keep_animation_files': True)
}

calc = submit(PhonopyCalculation, **inputs)

print(f'Launched calculation with PK = {calc.pk}')

```

---

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [March 31, 2024, 6:42pm UTC](https://aiida.discourse.group/t/aiida-vibroscopy-is-it-possible-to-access-vibration-modes/346/10 "2024-03-31T18:42:15Z")

</div>

Hello, you simply missed to insert {…}.
