Skip to content
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

fix: parse error for atomSymbol separate with one space #797

Closed
wants to merge 2 commits into from

Conversation

Rasic2
Copy link
Contributor

@Rasic2 Rasic2 commented Jul 20, 2024

If the atomSymbol in POSCAR or XDATCAR separated with only one space, like this:

Ce O  C  O

The atomSymbol will return ["CeO", "C", "O"], and raise the warning: "declaration of atomary species wrong:"

This PR fix this by replace the code below

  var atomSymbols = lines[5]
    .replace(/\s+/, "")
    .replace(/\s+$/, "")
    .split(/\s+/);

with this

  var atomSymbols = lines[5]
    .replace(/\s*/, "")
    .replace(/\s+$/, "")
    .split(/\s+/);

@Rasic2 Rasic2 marked this pull request as ready for review July 20, 2024 04:06
@dkoes
Copy link
Contributor

dkoes commented Jul 20, 2024

I am not familiar with these formats. Why is the this the right fix? Changing from \s+ to \s* will only remove space if it is at the very beginning. If this is what is intended, then why not use .trim to remove leading and trailing white space?

dkoes added a commit that referenced this pull request Sep 4, 2024
@dkoes
Copy link
Contributor

dkoes commented Sep 4, 2024

This is addressed in d9efe75

@dkoes dkoes closed this Sep 4, 2024
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