[ase-users] trajectory format error during structure optimization

David Willock WillockDJ at cardiff.ac.uk
Mon Jul 8 14:28:42 CEST 2024


Dear Aldo,

>From the error message it looks like you are trying to read back the trajectory file that the optimisers write? The trajectory file is a list of the structures visited during the optimisation so should be treated like a list of structures. The ASE site gives details at:

Trajectory files — ASE documentation (dtu.dk)<https://wiki.fysik.dtu.dk/ase/ase/io/trajectory.html>

Best Wishes
David

________________________________
From: ase-users <ase-users-bounces at listserv.fysik.dtu.dk> on behalf of Aldo Ugolotti via ase-users <ase-users at listserv.fysik.dtu.dk>
Sent: 08 July 2024 13:10
To: ase-users at listserv.fysik.dtu.dk <ase-users at listserv.fysik.dtu.dk>
Subject: [ase-users] trajectory format error during structure optimization

External email to Cardiff University - Take care when replying/opening attachments or links.
Nid ebost mewnol o Brifysgol Caerdydd yw hwn - Cymerwch ofal wrth ateb/agor atodiadau neu ddolenni.



Dear users,

I am optimizing a structure via different optimizers, e.g. FIRE or BFGS,
through a calculator, however I have issues in reading the trajectory
file that is produced.

When I try to open it, I get the following error messages:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/io/formats.py",
line 800, in read
     return next(_iread(filename, slice(index, None), format, io,
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/parallel.py",
line 302, in new_generator
     for result in generator(*args, **kwargs):
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/io/formats.py",
line 866, in _iread
     for dct in io.read(fd, *args, **kwargs):
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/io/trajectory.py",
line 423, in read_traj
     yield trj[i]
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/io/trajectory.py",
line 278, in __getitem__
     atoms = read_atoms(b, traj=self)
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/io/trajectory.py",
line 359, in read_atoms
     return read_atoms(backend, header, traj, False)
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/io/trajectory.py",
line 379, in read_atoms
     atoms = Atoms(positions=b.positions,
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/atoms.py",
line 231, in __init__
     self.new_array('positions', positions, float, (3,))
   File
"/home_most1/software/python_virtual_env/enviro_01/lib/python3.10/site-packages/ase/atoms.py",
line 491, in new_array
     raise ValueError('Array "%s" has wrong length: %d != %d.' %
ValueError: Array "positions" has wrong length: 23 != 20.

The structure is usually the following (in a POSCAR file):

Ga O
  1.0000000000000000
      3.0437424088662963    0.0000000000000000 0.0000000000000000
      0.0000031622422840   14.7017269524877570 0.0000000000000000
      0.0000009260717257    3.4260834604639068 4.7082612932516961
  Ga  O
    8  12
Cartesian
   1.5218723357039710 15.8188718574327893  2.9079613676911555
   0.0000059327733076 13.1052255051097770  2.8745980271043003
  -0.0000107921034274 14.7011495642250427  0.0085871970445676
   1.5219166606336012 10.7968514552615158  1.0658204805351676
   3.0437429809987315  8.4679781419058902  2.9078954397593910
   1.5218700428854757  5.7544245018196456  2.8745176343712169
   1.5218699118892460  7.3501954535310761  0.0085254000378572
   3.0437414219421695  3.4459684229877086  1.0657976752349458
   0.0000120138472444  9.9397499435454684  1.6461898751266788
   1.5218574348726146  4.2809758546542236  4.1343011562496468
   3.0437402313938988 14.8510944838742400  1.8739821734909685
   1.5218703192113834 14.0724457821694671  3.9088746953136773
   1.5218709568204642 12.4588634753633229  1.8487030038014953
   3.0437437766782129 16.4641054642267406  3.9360811195554040
   1.5218728276782361  2.5889021769267080  1.6461839979364055
   3.0437389902045822 11.6318087791170388  4.1343355926457086
   1.5218694913323356  7.5002250144759159  1.8739212272855050
   3.0437401536740056  6.7215584472524945  3.9088410244254468
   3.0437392898354014  5.1079805611873921  1.8486885018616095
   1.5218736571575349  9.1131861654179929  3.9359949123592188


Can anyone give me an hint about solving this issue?

Thank you in advance,

--
Aldo Ugolotti, Ph.D.

Post-doc fellow
Materials Science Dept. U5,
Università degli Studi di Milano-Bicocca
via Cozzi 55,
20125 Milano (MI)
Italy
e-mail: aldo.ugolotti at unimib.it

_______________________________________________
ase-users mailing list
ase-users at listserv.fysik.dtu.dk
https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users<https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20240708/b042dcff/attachment-0001.htm>


More information about the ase-users mailing list