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

Handle no vector print data #98

Merged
merged 5 commits into from
Mar 8, 2024
Merged

Conversation

kohei-noda-qcrg
Copy link
Member

Summary

  • .PRIVECのデータがないパターンの検知 #91 を解決
  • .MULPOPなどの.PRIVECとフォーマットが似ている出力があっても.MULPOPのデータ部分が始まる前にWarningを出しつつファイル読み込みを停止できるようにしました

Implementation

  • Vector printのセクションを検知したら、その後 Fermion ircop E1gのような行がくるはずだが、Fermion ircop E1gが来る前にすべての文字がスペースorアスタリスクor改行文字の行が来たら、.PRIVECのデータがないパターンの検知 #91 で問題になったパターンであることが分かるので、そこでWarningを出しつつファイル読み込みをやめる
    if self.stage == STAGE.VECTOR_PRINT and self.detect_next_titler(line_str):
    msg = "WARNING: The next title is detected before the end of reading coefficients.\n\
    In order to force DIRAC to print vector print, please add .ANALYZE and .PRIVEC option to the input file of DIRAC."
    print(msg)
    self.transition_stage(STAGE.END)
  • ただしVector printと書かれた行の直後にすべての文字がスペースorアスタリスクor改行文字の行が1行だけ来るので、その行だけは無視できるように、新たにSKIP_AFTER_VECTOR_PRINT_LINEというメンバを追加した
    SKIP_AFTER_VECTOR_PRINT_LINE = auto()

    elif self.stage == STAGE.SKIP_AFTER_VECTOR_PRINT_LINE:
    self.transition_stage(STAGE.VECTOR_PRINT)
    continue

    elif self.stage == STAGE.INIT:
    if self.check_start_vector_print(words):
    self.transition_stage(STAGE.SKIP_AFTER_VECTOR_PRINT_LINE)

@kohei-noda-qcrg kohei-noda-qcrg added the bug Something isn't working label Mar 8, 2024
@kohei-noda-qcrg
Copy link
Member Author

この変更により.PRIVECを指定したのにVector printのデータが出ないパターンで、かつ.MULPOPを指定したときに出てくる以下のエラー

$ sum_dirac_dfcoef -i Ar_Ar.out
Traceback (most recent call last):
  File "/home/noda/.pyenv/versions/3.9.15/bin/sum_dirac_dfcoef", line 8, in <module>
    sys.exit(main())
  File "/home/noda/develop/sum_dirac_dfcoef/src/sum_dirac_dfcoef/sum_dirac_dfcoef.py", line 24, in main
    privec_processor.read_privec_data_wrapper()
  File "/home/noda/develop/sum_dirac_dfcoef/src/sum_dirac_dfcoef/privec_reader.py", line 282, in read_privec_data_wrapper
    self.read_privec_data()
  File "/home/noda/develop/sum_dirac_dfcoef/src/sum_dirac_dfcoef/privec_reader.py", line 79, in read_privec_data
    self.start_mo_section(words)
  File "/home/noda/develop/sum_dirac_dfcoef/src/sum_dirac_dfcoef/privec_reader.py", line 173, in start_mo_section
    mo_energy = float(words[-1])
ValueError: could not convert string to float: '1/2'

についてエラーで止まらず、Warningだけ出せるようになった

$ sum_dirac_dfcoef -i Ar_Ar.out
WARNING: The next title is detected before the end of reading coefficients.
In order to force DIRAC to print vector print, please add .ANALYZE and .PRIVEC option to the input file of DIRAC.

@kohei-noda-qcrg kohei-noda-qcrg force-pushed the handle-no-vector-print-data branch from e792c01 to b3bcfa4 Compare March 8, 2024 14:26
@kohei-noda-qcrg kohei-noda-qcrg merged commit 80d2d49 into main Mar 8, 2024
6 checks passed
@kohei-noda-qcrg kohei-noda-qcrg deleted the handle-no-vector-print-data branch March 8, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant