计算化学公社

标题: How to fix "Fortran runtime error attempt to deallocate unallocated" [打印本页]

作者
Author:
zako    时间: 2020-1-3 05:33
标题: How to fix "Fortran runtime error attempt to deallocate unallocated"
Hello everybody,I need your help about an error message when i run script. I don't know how to fix it.
"Fortran runtime error attempt to deallocate unallocated".

作者
Author:
sobereva    时间: 2020-1-3 10:15
That means your code has a bug. The code is employing deallocate( ) routine to deallocate an allocatable array, however it has not been allocated before.
It is best to add a conditional judgment statement before this line as: if (allocated(foo)) ...
作者
Author:
zako    时间: 2020-1-3 21:57
please to specify what i should add. I attached the screenshot of the message errorand the file concerned by this error.
(, 下载次数 Times of downloads: 36)

[attach] 23241 [/ attach]

作者
Author:
sobereva    时间: 2020-1-3 22:51
Replace line 41 with below content
  1. if (allocated(nat)) deallocate(nat)
  2. if (allocated(atom_name)) deallocate(atom_name)
  3. if (allocated(xat)) deallocate(xat)
  4. if (allocated(yat)) deallocate(yat)
  5. if (allocated(zat)) deallocate(zat)
复制代码





欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3