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

[BUG] - CREST exits with 0 code when optimization fails #355

Open
coltonbh opened this issue Oct 1, 2024 · 1 comment
Open

[BUG] - CREST exits with 0 code when optimization fails #355

coltonbh opened this issue Oct 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@coltonbh
Copy link

coltonbh commented Oct 1, 2024

Describe the bug
When the optimization fails to converge, CREST still exits with process code 0. This makes it hard to manage the process using scripts/other packages (e.g., python wrappers) since the process exit code is 0 (success) even when a calculation fails. I'd expect failed calculations to exit with a non-0 code.

To Reproduce

input.toml:

threads = 16
input = "structure.xyz"
runtype = "optimize"

[calculation]
level = [
    { alpb = "ch2cl2", method = "gfn2", charge = 0, uhf = 0 },
]

structure.xyz:

57
qcio_charge=0 qcio_multiplicity=1 qcio__identifiers_smiles=[Na+].[S-]/C(=N\c1cc(C(F)(F)F)cc(C(F)(F)F)c1)NC(C)C.CO.C[C@@H]1OC(=O)[C@H](C)OC1=O qcio__identifiers_canonical_smiles=C[C@@H]1OC(=O)[C@@H](OC1=O)C.CC(N/C(=N/c1cc(cc(c1)C(F)(F)F)C(F)(F)F)/[S-])C.CO.[Na+] qcio__identifiers_canonical_smiles_program=openbabel
Na     1.51736   -0.16911    2.65810
S      3.52532    0.92320    1.78029
C      4.07773    0.14584    0.33944
N      3.91815   -1.14422    0.21587
C      3.24544   -2.05996    1.06409
C      3.62308   -2.41609    2.37298
C      2.92629   -3.41746    3.10053
C      3.41955   -3.92439    4.44309
F      4.72702   -4.29030    4.42197
F      3.28317   -3.00620    5.43653
F      2.73666   -5.02789    4.87131
C      1.79207   -4.01406    2.52780
C      1.41823   -3.70956    1.21683
C      0.22723   -4.39297    0.59032
F      0.45586   -5.67914    0.23386
F     -0.84396   -4.40881    1.43493
F     -0.22038   -3.74272   -0.51999
C      2.16916   -2.75870    0.49929
N      4.67774    0.91581   -0.64964
C      3.98995    1.82517   -1.57192
C      4.43717    3.29283   -1.54276
C      3.95847    1.39803   -3.04027
C     -1.68650   -2.50932   -5.10934
O     -0.85052   -3.49558   -4.53205
C      7.43570   -5.22583   -7.89088
C      6.77752   -3.91669   -8.36706
O      7.72786   -2.86142   -8.40719
C      7.93435   -2.25242   -7.21042
O      9.01543   -2.04942   -6.72126
C      6.68452   -1.70860   -6.61192
C      7.08475   -1.13259   -5.24694
O      5.65878   -2.69177   -6.53143
C      5.50511   -3.52543   -7.60577
O      4.41540   -4.02771   -7.85468
H      4.49147   -1.93138    2.82144
H      1.22067   -4.75851    3.08935
H      1.92461   -2.55111   -0.54210
H      5.66587    0.77873   -0.79112
H      2.96855    1.76412   -1.26320
H      5.40860    3.45324   -2.01181
H      3.71197    3.90324   -2.11041
H      4.49493    3.71479   -0.53708
H      3.62021    0.36872   -3.17243
H      3.24621    2.03815   -3.58813
H      4.92911    1.52596   -3.52727
H     -2.62165   -2.38496   -4.56660
H     -1.90042   -2.77907   -6.14854
H     -1.11480   -1.58822   -5.05378
H      0.37707   -3.25647   -4.71933
H      6.79242   -6.10022   -8.02186
H      7.72632   -5.17523   -6.83850
H      8.34950   -5.45223   -8.44963
H      6.47751   -4.08937   -9.40601
H      6.34426   -0.88796   -7.25137
H      7.89090   -0.39105   -5.36734
H      6.25399   -0.63963   -4.74331
H      7.47456   -1.91234   -4.57971

stdout (Note that the calculation fails yet the program still "terminated normally":

┌────────────────────────────────────────────────────────────────────────────┐
│                                 CYCLE  219                                 │
└────────────────────────────────────────────────────────────────────────────┘
 * total energy  :  -110.6353976 Eh     change ΔE    -0.2350447E-03 Eh
   gradient norm :     0.0055371 Eh/α   predicted    -0.1975044E-03 ( -15.97%)
   displ. norm   :     0.6142322 α      lambda       -0.3150866E-03
   maximum displ.:     0.3844039 α      in ANC's #3, #7, #6, ...
   converged δE/grad : False / False
 * RMSD in coord.:     1.9023198 α      energy gain  -0.1566916E-01 Eh

   *** FAILED TO CONVERGE GEOMETRY OPTIMIZATION IN 219 ITERATIONS ***

 geometry optimization FAILED!

==========================================
 TOTAL ENERGY        -110.6353976330 Eh
 GRADIENT NORM          0.0055380583 Eh/a0
==========================================
 WARNING: geometry optimization FAILED!

 -----------------
 Wall Time Summary
 -----------------
 CREST runtime (total)               0 d,  0 h,  8 min, 28.221 sec
 ------------------------------------------------------------------
 Geometry optimization      ...        8 min, 28.135 sec ( 99.983%)
 I/O and setup              ...        0 min,  0.086 sec (  0.017%)
 ------------------------------------------------------------------
 * wall-time:     0 d,  0 h,  8 min, 28.221 sec
 *  cpu-time:     0 d,  1 h, 28 min, 18.349 sec
 * ratio c/w:    10.425 speedup
 ------------------------------------------------------------------
 * Total number of energy+grad calls: 220

 CREST terminated normally.

Expected behavior
I'd expect failed calculations to exit with a non-0 process code.

Thanks so much!

@coltonbh coltonbh added the bug Something isn't working label Oct 1, 2024
@pprcht
Copy link
Contributor

pprcht commented Oct 4, 2024

ok, will do.

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

No branches or pull requests

2 participants