ICAMS/calphy

pressure 2D list is converted to 1D when old inputstyle is autotranslated to the new one

Closed this issue · 2 comments

Hi Sarath,

calphy version: 1.3.7
pylammpsmpi version: 0.2.13

Thank you very much for your support. I need the barostat to control pressure anisotropically, aiming for 50 GPa. Following your suggestion and the calphy documentation, I used the keyword: pressure: [[500000,500000,500000]]

However, I encountered an error, which is attached below. Full versions of these files are also included as attachments
file.tar.gz.

(calphy) liang@xx30:~/xx/xx$ calphy -i input.yaml
/home/liang/deepmd-kit3.0.0/envs/calphy/lib/python3.11/site-packages/calphy-1.3.7-py3.11.egg/calphy/input.py:657: UserWarning: Old style input file calphy < v2 found. Converted input in new.input.yaml. Please check!
warnings.warn(f'Old style input file calphy < v2 found. Converted input in {outfile}. Please check!')
Traceback (most recent call last):
File "/home/liang/deepmd-kit3.0.0/envs/calphy/bin/calphy", line 33, in
sys.exit(load_entry_point('calphy==1.3.7', 'console_scripts', 'calphy')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/liang/deepmd-kit3.0.0/envs/calphy/lib/python3.11/site-packages/calphy-1.3.7-py3.11.egg/calphy/kernel.py", line 165, in main
run_jobs(args["input"])
File "/home/liang/deepmd-kit3.0.0/envs/calphy/lib/python3.11/site-packages/calphy-1.3.7-py3.11.egg/calphy/kernel.py", line 55, in run_jobs
calculations = read_inputfile(inputfile)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/liang/deepmd-kit3.0.0/envs/calphy/lib/python3.11/site-packages/calphy-1.3.7-py3.11.egg/calphy/input.py", line 551, in read_inputfile
calculations = _read_inputfile(outfile)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/liang/deepmd-kit3.0.0/envs/calphy/lib/python3.11/site-packages/calphy-1.3.7-py3.11.egg/calphy/input.py", line 561, in _read_inputfile
calculations.append(Calculation(**calc))
^^^^^^^^^^^^^^^^^^^
File "/home/liang/deepmd-kit3.0.0/envs/calphy/lib/python3.11/site-packages/pydantic/main.py", line 171, in init
self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 3 validation errors for Main input class
pressure.float
Input should be a valid number [type=float_type, input_value=[500000.0, 500000.0, 500000.0], input_type=list]
For further information visit https://errors.pydantic.dev/2.6/v/float_type
pressure.list[float]
List should have at most 2 items after validation, not 3 [type=too_long, input_value=[500000.0, 500000.0, 500000.0], input_type=list]
For further information visit https://errors.pydantic.dev/2.6/v/too_long
pressure.list[list[float]]
List should have at most 2 items after validation, not 3 [type=too_long, input_value=[500000.0, 500000.0, 500000.0], input_type=list]
For further information visit https://errors.pydantic.dev/2.6/v/too_long

Seems like you have the old style input file. Calphy automatically translates it, but this is a bug that happens during this process. For the moment, you can use the new style input file. See below, could you please give it a try and see if that works?

calculations:
- element: [O, Si]
  equilibration_control: nose-hoover
  lattice: conf.data
  lattice_constant: 0.0
  mass: [15.999, 28.085]
  md:
    barostat_damping: 0.1
    thermostat_damping: 0.1
    timestep: 0.001
  mode: ts
  n_equilibration_steps: 1000
  n_iterations: 1
  n_switching_steps:
  - 1000
  - 1000
  pair_coeff: '* * SiOx_potential.yace O Si'
  pair_style: pace
  pressure: [[500000.0, 500000.0, 500000.0]
  queue:
    cores: 4
  reference_phase: solid
  spring_constants: [2, 4]
  temperature: [300.0, 1500.0]

Closing this as input file format is changed in the new version.