Skip to content

Commit

Permalink
fix(tddft): make tokenizer more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
felixscherz committed Mar 5, 2024
1 parent 730f70b commit 965a14f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/parsers/tddft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ fn line_to_token(line: &str) -> SOCMatrixToken {
}

fn tokenize_state(line: &str) -> SOCMatrixToken {
let mut parts = line.split_whitespace();
parts.next();
let state_no = parts.next().unwrap().replace(":", "");
let energy = parts.next().unwrap().to_string();
let mut parts = line.split(":");
let state_no = parts.next().unwrap().replace("STATE", "").trim().to_string();
let energy = parts.next().unwrap().trim().to_string();
SOCMatrixToken::State(state_no, energy)
}

Expand Down

0 comments on commit 965a14f

Please sign in to comment.