Skip to content

Crash when dovdwscan enabled #87

@adrmalin

Description

@adrmalin

Hi,
I am experimenting with various poltype2 options and I've encountered a bug with vdw parameters optimization (by the way, it seems there is an error in the readme in the description of various options - 'dovdwscan' is described as preventing vdw params refinement when set to True, but it's name and the content of poltype.py file seems to suggest the opposite is true).

The bug is, when setting dovdwscan = true in the .ini file, poltype run ends in an exception (sanitized here for usernames) at the start of van der Waals params refinement:

Traceback (most recent call last):
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/poltype.py", line 4569, in RunPoltype
    poltype.main()
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/poltype.py", line 2165, in main
    params= self.GenerateParameters()
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/poltype.py", line 3588, in GenerateParameters
    vdwfit.VanDerWaalsOptimization(self,missingvdwatomindices)
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/vdwfit.py", line 2340, in VanDerWaalsOptimization
    dimerfiles,probeindices,moleculeindices,numberprobeatoms=GenerateInitialProbeStructures(poltype,missingvdwatomindices)
                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/vdwfit.py", line 1665, in GenerateInitialProbeStructures
    atoms2,coords2=readXYZ(poltype,prob)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/vdwfit.py", line 1593, in readXYZ
    coords = np.loadtxt(xyz, usecols=(1,2,3), dtype='float', unpack=False, skiprows=2)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/users/kdm/username/.conda/envs/mypoltype2/lib/python3.12/site-packages/numpy/lib/npyio.py", line 1373, in loadtxt
    arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/users/kdm/username/.conda/envs/mypoltype2/lib/python3.12/site-packages/numpy/lib/npyio.py", line 1016, in _read
    arr = _load_from_filelike(
          ^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string 'H' to float64 at row 0, column 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/poltype.py", line 4581, in <module>
    RunPoltype()
  File "/users/project1/pt00997/software/poltype2/PoltypeModules/poltype.py", line 4580, in RunPoltype
    raise ValueError('Houston, we have a problem. Buy a developer some coffee!')
ValueError: Houston, we have a problem. Buy a developer some coffee!

After digging inside vdwfit.py file, it seems that expected coordinate file in the ./Temp/vdw/ subdirectory is to be in 'conventional' XYZ file format, but code copies files in Tinker XYZ file format. Then the readXYZ() function reads wrong columns and crashes resulting in above exception. I've tried to replace it with readTXYZ() function (I've thought maybe readXYZ in vdwfit.py line 1593 was a typo), but then it crashes, as readTXYZ() returns more data than necessary. I didn't dig deeper into the code in search of an error to not break anything, but it seems like wrong file is copied to vdw subdir after geometry optimization in QM software (Tinker-formatted .xyz instead of 'conventional' .xyz).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions