Adding phonoy as a code

Hi developers,

I am trying to create a phonopy code through following code stored in phonopy_code.py

from aiida.orm import InstalledCode
import shutil

computer = load_computer('newhpc')
code = InstalledCode(
    label='phonopy',
    computer=computer,
    filepath_executable=shutil.which('phonopy'),
    default_calc_job_plugin='phonopy.phonopy',
).store()

I have already created a computer as newhpc. I created through verdi computer setup --config computer.yml where computer.yml looks following:

description: lanl_hpc
hostname: localhost 
transport: core.local
scheduler: core.slurm
work_dir: "/lustre/scratch5/rkarkee/Runaiida" 
mpirun_command: "srun -n {tot_num_mpiprocs}" 
mpiprocs_per_machine: 256 

Finally when I run verdi run phonopy_code.py, I got the following error.

/users/rkarkee/conda/envs/aiidaENV/lib/python3.11/site-packages/aiida/orm/nodes/data/code/legacy.py:42: AiidaDeprecationWarning: The `Code` class is deprecated. To create an instance, use the `aiida.orm.nodes.data.code.installed.InstalledCode` or `aiida.orm.nodes.data.code.portable.PortableCode` for a "remote" or "local" code, respectively. If you are using this class to compare type, e.g. in `isinstance`, use `aiida.orm.nodes.data.code.abstract.AbstractCode`. (this will be removed in v3)
  warn_deprecation(

How can I fix this?

Thanks a lot.

Best
RIjan

Hi, it’s just a warning for the old aiida-core version. I also think it should not pop out, as you are doing it correctly. So no worries, nothing is wrong, you can proceed with your calculations.