Skip to content

Drude psf where NUMANISO is zero #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2023
Merged

Conversation

florianjoerg
Copy link
Contributor

When writing a CHARMM PSF file which has Drude particles, I ran into an error if the NUMANISO section is zero, because the idx_section list is empty in this case. I attached a psf to reproduce the error.

idx_section = []

Traceback (most recent call last):
  File "/home/florian/software/ParmEd_fork/minimal_example/test.py", line 3, in <module>
    psf.write_psf("new.psf")
  File "/scratch/data/florian/anaconda3/envs/parmed/lib/python3.11/site-packages/parmed/formats/psf.py", line 345, in write
    if idx_section[-1] == "\n":
       ~~~~~~~~~~~^^^^
IndexError: list index out of range

My suggestion would be to execute lines 317 to 348 only if n_aniso != 0.

example.zip

@swails
Copy link
Contributor

swails commented Mar 23, 2023

Thanks!

@swails swails merged commit e1c647c into ParmEd:master Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants