jewettaij / moltemplate

A general cross-platform tool for preparing simulations of molecules and complex molecular assemblies
http://www.moltemplate.org
MIT License
244 stars 95 forks source link

failure to read coordinates from XYZ files (and PDB files?) #53

Closed jewettaij closed 3 years ago

jewettaij commented 3 years ago

Here is a message posted on the LAMMPS mailing list from Daoud El Kadiri. I am posting it here because I was unable to reproduce the problem on my end, and I am hoping that Daoud or someone else can follow up.:

"I changed my ubuntu from 18.04 to 20.04, and downloaded the last version of moltemplate (before i was using 2020-12-02) and since then i have a problem running moltemplate

When i try to generate lammps input files through "moltemplate.sh -xyz system.xyz -vmd system.lt", the data file generated has all molecules placed on the same coordinates (which is not the case on the .xyz file).

I tried with the files already available in the moltemplate example directory (for example ethylene+benzene_PACKMOL) to be sure the problem wasn't in my own lt files and it still the same

I attached the .xyz file and the data file generated when i run the example "ethylene+benzene_PACKMOL" from the moltemplate examples

Thanks in advance for your help"

jewettaij commented 3 years ago

I installed ubuntu 20.04 and was finally able to reproduce the problem. It does appear to be due to a change in BASH versions. And it effects PDB files too.

It's getting late tonight. I will take another look at this tomorrow. Thanks again for the bug report! -Andrew

jewettaij commented 3 years ago

I retract my previous post. Using the most recent version of moltemplate, I am not able to reproduce this error in ubuntu 20.04. The newest version of moltemplate reads both XYZ and PDB files without issue in ubuntu 20.04.

By examining the "system.data" file that you (Daoud) posted on the LAMMPS mailing list, it looks like you are using an outdated version of moltemplate.

To anyone who runs into this problem, I suggest updating moltemplate.

(To do that, uninstall moltemplate, download the latest version of moltemplate, and install it. Alternatively, you can try "pip install --upgrade moltemplate", but the version of moltemplate that you get this way (from pypi.org, instead of github.com) might not be the most up-to-date version.)

(I must have been very tired last night when I posted my previous message. I think I confused the column for the charge, which does repeat. with the column for the X coordinate. So it looked to me like the coordinates were repeating, but it was really just the charge of the atoms. I'm surprised that I did not look at what I thought were the columns for Y and Z.)

I will leave this issue open for a short while in case someone else runs into this problem in the near future.

jewettaij commented 3 years ago

Response from Daoud El Kadiri:

"I initially used the moltemplate_2021-5-17.tar.gz available on the moltemplate website, adding the moltemplate directory to the $PATH in the bashrc file. After reading your email, i also tried by installing moltemplate with pip (removing the lines that were adding moltemplate to the PATH in my bashrc so i know it's the "pip moltemplate" that is used, not the one i downloaded previously) but no matter how i try, I always get the same error and i always have comments after each line in my Atom section.

Anyway, if you were not able to reproduce this problem on Ubuntu 20.04, then the problem comes from my side and if so, then there is no need to bother yourself more, thank you already for your time and your answers. So far, I just decided to run a moltemplate on a virtual machine using Ubuntu 18.04 because I didn't want to lose too much time. But if I ever find something relevant regarding this problem, I will let you know.

Thanks again for your help"

jewettaij commented 3 years ago

I guess I was wrong. It sounds like you were using a very recent version of moltemplate (2021-5-17). And I was also wrong about those comments in the "Atoms" section. Apparently, those comments are actually in the "ethylene.lt" and "benzene.lt" example files (and have nothing to do with which moltemplate version you are using). So this is not reassuring at all.

I've got some ideas you can try to debug the issue, but I'll send those to you by email.

I will leave this issue open.

jewettaij commented 3 years ago

It looks like this issue has been fixed in v2.19.12. Thanks again to Daoud El Kadiri for reporting, locating, and help with debugging!