Describe the bug
In BlockGeom the ts_active_atoms is of type Hybrid which inherits from GeomWrapper requiring a mode string input.
ts_active_atoms does not require a mode as it is simply a list of integers as can be seen in the following documentation
To Reproduce
The naive approach of simply using a list[int]
from opi.core import Calculator
from opi.input.blocks import BlockGeom
calc = Calculator("job")
calc.input.add_blocks(BlockGeom(ts_active_atoms=[1, 2, 3]))
calc.write_input()
Traceback (most recent call last):
File "opi_test.py", line 5, in <module>
calc.input.add_blocks(BlockGeom(ts_active_atoms=[1, 2, 3]))
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.14/site-packages/pydantic/main.py", line 263, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for BlockGeom
ts_active_atoms
Input should be a valid dictionary or instance of Hybrid [type=model_type, input_value=[1, 2, 3], input_type=list]
For further information visit https://errors.pydantic.dev/2.13/v/model_type
Correctly wrapping the types with Hybrid and NumList
from opi.core import Calculator
from opi.input.blocks import BlockGeom, Hybrid, NumList
calc = Calculator("job")
calc.input.add_blocks(BlockGeom(ts_active_atoms=Hybrid(list=NumList([1, 2, 3]))))
calc.write_input()
Traceback (most recent call last):
File "opi_test.py", line 5, in <module>
calc.input.add_blocks(BlockGeom(ts_active_atoms=Hybrid(list=NumList([1, 2, 3]))))
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "venv/lib/python3.14/site-packages/pydantic/main.py", line 263, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Hybrid
mode
Field required [type=missing, input_value={'list': NumList(numlist=[1, 2, 3])}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.13/v/missing
Workaround (setting mode="")
from opi.core import Calculator
from opi.input.blocks import BlockGeom, Hybrid, NumList
calc = Calculator("job")
calc.input.add_blocks(BlockGeom(ts_active_atoms=Hybrid(mode="", list=NumList([1, 2, 3]))))
calc.write_input()
Produces the following orca input:
%geom
ts_active_atoms { 1,2,3 } end
end
%output
jsonpropfile True
jsongbwfile True
end
Which will work but is not intuitive.
Expected behavior
I am thinking that ts_active_atoms should not use Hybrid not sure of the correct type but we essentially need something that wraps NumList without the mode attribute.
Not sure what other attributes will also need the same fix.
Describe the bug
In
BlockGeomthets_active_atomsis of typeHybridwhich inherits fromGeomWrapperrequiring amodestring input.ts_active_atomsdoes not require amodeas it is simply a list of integers as can be seen in the following documentationTo Reproduce
The naive approach of simply using a
list[int]Correctly wrapping the types with
HybridandNumListWorkaround (setting
mode="")Produces the following orca input:
Which will work but is not intuitive.
Expected behavior
I am thinking that
ts_active_atomsshould not useHybridnot sure of the correct type but we essentially need something that wrapsNumListwithout themodeattribute.Not sure what other attributes will also need the same fix.