From 6f1f4e26a107c8bb5fa2fe5d0fc91f6a3fcc7b5f Mon Sep 17 00:00:00 2001 From: Philip Loche Date: Wed, 13 Dec 2023 09:31:46 +0100 Subject: [PATCH] Addressed reviewers comments --- .gitignore | 1 + README.rst | 6 +- docs/src/getting-started/index.rst | 2 +- docs/src/getting-started/usage.rst | 21 +- docs/static/parameters.yaml | 17 +- examples/eval.sh | 21 - examples/output.xyz | 1201 --------------------- examples/train.sh | 12 - examples/usage.sh | 23 + src/metatensor/models/__main__.py | 61 +- src/metatensor/models/cli/eval_model.py | 11 +- src/metatensor/models/cli/export_model.py | 12 + src/metatensor/models/cli/train_model.py | 42 +- src/metatensor/models/soap_bpnn/train.py | 3 +- tests/cli/test_cli.py | 2 +- tests/cli/test_train_model.py | 3 +- tox.ini | 2 +- 17 files changed, 123 insertions(+), 1317 deletions(-) delete mode 100644 examples/eval.sh delete mode 100644 examples/output.xyz delete mode 100644 examples/train.sh create mode 100644 examples/usage.sh diff --git a/.gitignore b/.gitignore index 2addf5603..4a4923fbe 100644 --- a/.gitignore +++ b/.gitignore @@ -164,3 +164,4 @@ cython_debug/ # model output directories outputs/ +examples/*.xyz diff --git a/README.rst b/README.rst index 546639fc8..57e71cf71 100644 --- a/README.rst +++ b/README.rst @@ -61,10 +61,10 @@ Having problems or ideas? ------------------------- Having a problem with metatensor-models? Please let us know by `submitting an issue -`_. +`_. Submit new features or bug fixes through a `pull request -`_. +`_. .. marker-contributing @@ -73,7 +73,7 @@ Contributors Thanks goes to all people that make metatensor-models possible: -.. image:: https://contrib.rocks/image?repo=ceriottm/MeshLODE +.. image:: https://contrib.rocks/image?repo=metatensor-models :target: https://github.com/lab-cosmo/metatensor-models/graphs/contributors .. |tests| image:: https://github.com/lab-cosmo/metatensor-models/workflows/Tests/badge.svg diff --git a/docs/src/getting-started/index.rst b/docs/src/getting-started/index.rst index 0d5057721..e941c77e1 100644 --- a/docs/src/getting-started/index.rst +++ b/docs/src/getting-started/index.rst @@ -1,7 +1,7 @@ Getting started =============== -This sections describes, how to install the package, and its most basic commands. +This sections describes how to install the package, and its most basic commands. .. toctree:: :maxdepth: 1 diff --git a/docs/src/getting-started/usage.rst b/docs/src/getting-started/usage.rst index 74fad6fcf..c457689e7 100644 --- a/docs/src/getting-started/usage.rst +++ b/docs/src/getting-started/usage.rst @@ -6,7 +6,7 @@ general help of `metatensor-models` can be accessed using .. code-block:: bash - metatensor-models -h + metatensor-models --help We now demonstrate how to `train` and `evaluate` a model from the command line. For this example we use the :ref:`architecture-soap-bpnn` architecture and a subset of the `QM9 @@ -16,11 +16,14 @@ from our :download:`website <../../static/qm9_reduced_100.xyz>`. Training ######## -For performing a model training in `metatensor-models` uses the hydra framework. Hydra -allows to dynamical composition and override of config files and the command line and -has powerful tools to create multiple training runs with a single command. We will not -explain here how to use hydra in detail, as we only use a few functions ins this example -but rather refer to their good package documentation. +To train models, `metatensor-models` uses the hydra framework. Hydra is a framework +developed by Facebook AI for elegantly configuring complex applications. It's primarily +used for managing command-line arguments in Python applications, allowing for a +structured and dynamic approach to configuration. It allows to dynamical composition and +override of config files and the command line and has powerful tools to create multiple +training runs with a single command. We will not explain here how to use hydra in +detail, as we only use a few functions ins this example but rather refer to their good +package documentation. The sub-command to start a model training is @@ -47,8 +50,9 @@ created. By default, this output directory is used to store Hydra output for the behavior in the parameter file. To start the training using the ``parameters.yaml`` in the current directory type. -.. literalinclude:: ../../../examples/train.sh +.. literalinclude:: ../../../examples/usage.sh :language: bash + :lines: 3-8 Evaluation @@ -60,5 +64,6 @@ The sub-command to evaluate a already trained model is metatensor-models eval -.. literalinclude:: ../../../examples/eval.sh +.. literalinclude:: ../../../examples/usage.sh :language: bash + :lines: 9- diff --git a/docs/static/parameters.yaml b/docs/static/parameters.yaml index 5d7bf254a..8458de2b2 100644 --- a/docs/static/parameters.yaml +++ b/docs/static/parameters.yaml @@ -1,18 +1,9 @@ defaults: - - architecture: soap_bpnn # the architecture we will use to train a model + - _self_ # mandatory parameter to avoid hydra warnings + - architecture: soap_bpnn # architecture used to train the model -architecture: - # Optional section to override the default parameters of the architecture - soap: - cutoff: 7.5 - - # Optional section to override the default parameters of the trainer - training: - batch_size: 8 - num_epochs: 1 - -# Positional sectopn defining the parameters for structure and target data +# Section defining the parameters for structure and target data dataset: structure_path: "qm9_reduced_100.xyz" # file where the positions are stored targets_path: "qm9_reduced_100.xyz" # file with target values (i.e energies) - target_value: "U0" # the name of the target value in `targets_path` used for training + target_value: "U0" # name of the target value in `targets_path` diff --git a/examples/eval.sh b/examples/eval.sh deleted file mode 100644 index 7e3b11e0a..000000000 --- a/examples/eval.sh +++ /dev/null @@ -1,21 +0,0 @@ -# We first try to find a output of a prevouis training run - -OUTDIR=$(find outputs -type d -mindepth 2 | head -n 1) -echo $OUTDIR - -# And evaluate the model on the training dataset - -metatensor-models eval --model=$OUTDIR/model_final.pt \ - --structure=qm9_reduced_100.xyz \ - --output=output.xyz - -# The evaluation command predicts the property the model was trained against; here "U0". -# The predictions together with the structures have been written in a file named -# ``output.xyz`` in the current directory. The written file starts with the following -# lines - -head -n 20 output.xyz - -# All command line flags of the eval sub-command can be listed via - -metatensor-models eval --help diff --git a/examples/output.xyz b/examples/output.xyz deleted file mode 100644 index ec4967a40..000000000 --- a/examples/output.xyz +++ /dev/null @@ -1,1201 +0,0 @@ -5 -Properties=species:S:1:pos:R:3 energy=-40.42837398366376 pbc="F F F" -C -0.01269814 1.08580416 0.00800100 -H 0.00215042 -0.00603132 0.00197612 -H 1.01173084 1.46375116 0.00027657 -H -0.54081507 1.44752661 -0.87664372 -H -0.52381363 1.43793264 0.90639729 -4 -Properties=species:S:1:pos:R:3 energy=-56.59591294691739 pbc="F F F" -N -0.04042605 1.02410775 0.06256380 -H 0.01725746 0.01254521 -0.02737716 -H 0.91578937 1.35874519 -0.02875776 -H -0.52027774 1.34353213 -0.77554261 -3 -Properties=species:S:1:pos:R:3 energy=-76.42908911921836 pbc="F F F" -O -0.03436050 0.97753957 0.00760159 -H 0.06476649 0.02057220 0.00153463 -H 0.87179037 1.30079240 0.00069313 -4 -Properties=species:S:1:pos:R:3 energy=-77.34621438158375 pbc="F F F" -C 0.59953949 0.00000000 1.00000000 -C -0.59953949 0.00000000 1.00000000 -H -1.66163859 0.00000000 1.00000000 -H 1.66163859 0.00000000 1.00000000 -3 -Properties=species:S:1:pos:R:3 energy=-93.49910244686006 pbc="F F F" -C -0.01332393 1.13246572 0.00827589 -N 0.00231072 -0.01915859 0.00192873 -H -0.02780270 2.19894930 0.01415379 -4 -Properties=species:S:1:pos:R:3 energy=-114.50419517583174 pbc="F F F" -C -0.01397770 1.18021143 0.00775250 -O 0.00231399 -0.01966366 0.00216107 -H 0.91496029 1.78951117 0.00395656 -H -0.95910972 1.76401798 0.01718284 -8 -Properties=species:S:1:pos:R:3 energy=-79.69135158832796 pbc="F F F" -C -0.01870400 1.52558201 0.01043281 -C 0.00210374 -0.00388191 0.00199882 -H 0.99487275 1.93974324 0.00294120 -H -0.54207611 1.92361063 -0.86511735 -H -0.52524112 1.91417308 0.90002399 -H 0.52548654 -0.40190784 0.87754395 -H -1.01147651 -0.41803380 0.00950849 -H 0.50862619 -0.39247040 -0.88760117 -6 -Properties=species:S:1:pos:R:3 energy=-115.67804339230955 pbc="F F F" -C -0.00828817 1.39046978 -0.00560069 -O -0.00797038 -0.02504537 0.02030606 -H 1.00658338 1.81556366 0.00348335 -H -0.54657475 1.79916975 -0.87390126 -H -0.52288871 1.72555240 0.89907326 -H 0.44142019 -0.33354425 -0.77152059 -7 -Properties=species:S:1:pos:R:3 energy=-116.60180162341098 pbc="F F F" -C -0.01782102 1.46435788 0.01009397 -C 0.00208816 0.00950777 0.00201200 -C 0.01834085 -1.19180518 -0.00450508 -H 0.99782210 1.87425349 0.00260606 -H -0.54220434 1.85801178 -0.86721192 -H -0.52533306 1.84834356 0.90148138 -H 0.03231658 -2.25314823 -0.01025999 -6 -Properties=species:S:1:pos:R:3 energy=-132.75490219377338 pbc="F F F" -C -0.01788629 1.46712787 0.01011311 -C 0.00173819 0.01035260 0.00207588 -N 0.01765235 -1.14452926 -0.00420445 -H 1.00202941 1.86089927 0.00245401 -H -0.54398848 1.84479901 -0.87075460 -H -0.52707783 1.83518166 0.90486329 -7 -Properties=species:S:1:pos:R:3 energy=-153.761872135185 pbc="F F F" -C -0.00294482 1.50991366 0.00867278 -C 0.02608284 0.00327563 -0.03745912 -O 0.94228801 -0.65507035 -0.45682576 -H 0.92278802 1.92634242 -0.39146557 -H -0.86201540 1.87852481 -0.56479538 -H -0.15050638 1.84393383 1.04289100 -H -0.89443009 -0.48643408 0.35774865 -6 -Properties=species:S:1:pos:R:3 energy=-169.91940777609514 pbc="F F F" -N -0.02589986 1.34614561 0.00889391 -C 0.04646728 -0.01174341 0.00120425 -O 1.07183520 -0.65258782 -0.01113313 -H 0.82535497 1.88504948 0.00373769 -H -0.90837680 1.82679638 0.01891992 -H -0.96144100 -0.47500376 0.00807391 -11 -Properties=species:S:1:pos:R:3 energy=-118.95126837314545 pbc="F F F" -C -0.03113825 1.54081582 0.03192126 -C 0.01215347 0.01092235 -0.01603259 -C 0.72169129 -0.52583353 -1.26230570 -H 0.97955987 1.96459116 0.03098367 -H -0.55840223 1.94831192 -0.83816075 -H -0.54252252 1.90153531 0.93005671 -H 0.51522791 -0.36840234 0.88231134 -H -1.01070641 -0.38456999 0.02051783 -H 1.75851210 -0.17376585 -1.30871516 -H 0.74087192 -1.62024959 -1.27516511 -H 0.22023351 -0.19051179 -2.17729020 -9 -Properties=species:S:1:pos:R:3 energy=-154.93831867676175 pbc="F F F" -C -0.00860504 1.50203829 -0.00681217 -C 0.01099310 -0.01764877 -0.01377035 -O 0.68088841 -0.44041803 -1.19313210 -H 1.01153334 1.89662030 -0.01920155 -H -0.53159862 1.88076109 -0.88974659 -H -0.51674572 1.87611771 0.88710739 -H 0.52377121 -0.38912295 0.88824082 -H -1.02027544 -0.40507261 0.01690670 -H 0.69529573 -1.40179568 -1.20148495 -9 -Properties=species:S:1:pos:R:3 energy=-154.9273484643228 pbc="F F F" -C -0.01482147 1.39241234 0.00567104 -O -0.00471537 -0.01360660 0.01459658 -C 0.63794893 -0.55329676 -1.11358232 -H 1.00528358 1.81015807 0.00465631 -H -0.54689560 1.79343530 -0.87251051 -H -0.53002895 1.72291969 0.91101696 -H 0.13993792 -0.25599333 -2.05098375 -H 1.69265275 -0.23868382 -1.17477743 -H 0.59959435 -1.64180161 -1.02407616 -9 -Properties=species:S:1:pos:R:3 energy=-117.7813921727021 pbc="F F F" -C -0.01193280 1.51433198 0.01031700 -C 1.30299118 0.77886562 -0.00617842 -C 0.00867174 0.00767042 0.00201032 -H -0.30541464 2.01702117 0.92533239 -H -0.32275498 2.02680156 -0.89347839 -H 1.88493396 0.79145020 -0.92119393 -H 1.90226631 0.78165391 0.89766373 -H -0.27088043 -0.51289125 0.91137474 -H -0.28821983 -0.50310409 -0.90740824 -7 -Properties=species:S:1:pos:R:3 energy=-153.76084125469677 pbc="F F F" -C 0.01537720 1.41764380 0.00956287 -C 1.26478161 0.64923984 -0.00655044 -O -0.00024018 -0.00771006 0.00204055 -H -0.31763326 1.88586598 0.93475751 -H -0.33527583 1.89576673 -0.90397578 -H 1.83246682 0.56256848 -0.93193290 -H 1.85008258 0.55267938 0.90680147 -10 -Properties=species:S:1:pos:R:3 energy=-193.01687569711424 pbc="F F F" -C -0.00310189 1.48050328 -0.17259867 -C -0.04527202 -0.02887059 0.00139493 -C 1.29705800 -0.72194415 0.16889042 -O -1.08643172 -0.64273343 0.00630393 -H 0.59403529 1.74668579 -1.05225043 -H -1.01540407 1.87034023 -0.28382265 -H 0.48099600 1.95070605 0.69099376 -H 1.82512144 -0.32470731 1.04328658 -H 1.14892507 -1.79597689 0.28554393 -H 1.93682635 -0.52949692 -0.69995403 -9 -Properties=species:S:1:pos:R:3 energy=-209.1755257951248 pbc="F F F" -C 0.00679889 1.49969736 -0.02567030 -C -0.02740385 -0.01752051 -0.14894811 -N 1.17826667 -0.63324298 0.05691721 -O -1.03721965 -0.63980649 -0.40727572 -H 0.91390280 1.92923755 -0.46100067 -H -0.87080896 1.91124186 -0.52345176 -H -0.02826124 1.78517271 1.03149125 -H 1.98405139 -0.13175861 0.38674906 -H 1.19049421 -1.63919563 0.10006209 -8 -Properties=species:S:1:pos:R:3 energy=-225.335372430874 pbc="F F F" -N 0.03605270 1.36077873 -0.12416403 -C -0.02591138 -0.02076560 0.00200645 -N 1.21968479 -0.62334220 0.11963222 -O -1.06822866 -0.64174597 0.00865573 -H 0.80749439 1.83455148 0.32144915 -H -0.85825775 1.80373500 0.02243770 -H 1.99927148 -0.17303054 -0.33602496 -H 1.18204327 -1.62147901 -0.02109234 -14 -Properties=species:S:1:pos:R:3 energy=-158.2083148124739 pbc="F F F" -C -0.03215888 1.54021598 0.01074456 -C 0.03381741 0.00745852 0.00180716 -C 0.71375572 -0.50856404 -1.27296949 -C 0.73848999 -0.52220886 1.25750907 -H 0.97522736 1.97414341 0.00528362 -H -0.56196769 1.92232326 -0.86835418 -H -0.54817239 1.91268414 0.90208039 -H -0.99752525 -0.37310578 0.00977297 -H 1.75070021 -0.15586784 -1.33269631 -H 0.73446691 -1.60328288 -1.29939696 -H 0.19367011 -0.16085589 -2.17195508 -H 0.23611990 -0.18382017 2.17005260 -H 0.75964083 -1.61713153 1.27226101 -H 1.77635866 -0.16985318 1.30053019 -12 -Properties=species:S:1:pos:R:3 energy=-194.1956334960471 pbc="F F F" -C -0.03315871 1.54782566 -0.00438815 -C -0.01108534 0.01859095 0.01676117 -C 0.70938384 -0.53596711 1.23978444 -O -1.33219841 -0.51712554 0.05236057 -H 0.98215692 1.95715900 -0.03182225 -H -0.56388100 1.92087623 -0.88845865 -H -0.54082548 1.93340945 0.88575489 -H 0.51042122 -0.33767241 -0.88819176 -H 0.22240492 -0.18785860 2.15650245 -H 0.68242024 -1.62887638 1.23305141 -H 1.75434301 -0.21246950 1.25524188 -H -1.81818681 -0.15577435 -0.69553962 -6 -Properties=species:S:1:pos:R:3 energy=-153.51342386612694 pbc="F F F" -C 0.68098021 0.00000000 0.00000000 -C -0.68098021 0.00000000 0.00000000 -C -1.88766603 0.00000000 0.00000000 -C 1.88766603 0.00000000 0.00000000 -H -2.94960000 0.00000000 0.00000000 -H 2.94960000 0.00000000 0.00000000 -5 -Properties=species:S:1:pos:R:3 energy=-169.66696661889353 pbc="F F F" -C 0.01510390 0.00000000 1.00000000 -C 1.38233149 0.00000000 1.00000000 -C -1.18862525 0.00000000 1.00000000 -H -2.25177201 0.00000000 1.00000000 -N 2.54296187 0.00000000 1.00000000 -4 -Properties=species:S:1:pos:R:3 energy=-185.8203762509031 pbc="F F F" -N 0.01745734 -1.16134217 -0.00415342 -C 0.00253212 -0.00344278 0.00179939 -C -0.01611419 1.37220987 0.00934873 -N -0.03264302 2.53008276 0.01609090 -6 -Properties=species:S:1:pos:R:3 energy=-190.6738191826082 pbc="F F F" -O -0.06776120 -0.04233838 0.00282489 -C -0.00562945 1.16382879 0.00743862 -C 1.22985272 1.91339997 0.00028781 -C 2.23625322 2.57430970 -0.00529277 -H -0.91670701 1.79467546 0.01781352 -H 3.13429662 3.14370267 -0.01037656 -5 -Properties=species:S:1:pos:R:3 energy=-206.82709610477625 pbc="F F F" -O -0.04055978 -0.03799144 0.00266513 -C -0.01768870 1.16193251 0.00746008 -C 1.23315534 1.93381336 0.00043371 -N 2.19857378 2.57055097 -0.00483320 -H -0.92627534 1.78959196 0.01764859 -6 -Properties=species:S:1:pos:R:3 energy=-227.83401567182878 pbc="F F F" -O 0.00337122 -0.03146586 0.00157206 -C -0.01713174 1.17081409 0.00676444 -C 1.26555783 1.99719410 -0.00007703 -O 1.24507069 3.19946589 0.00681275 -H -0.94690483 1.77678142 0.01852668 -H 2.19534410 1.39121374 -0.01006739 -10 -Properties=species:S:1:pos:R:3 energy=-155.85748206180227 pbc="F F F" -C -0.01787959 1.46676893 0.01011180 -C 0.00186644 0.01072913 0.00211109 -C 0.01819704 -1.19272861 -0.00450723 -C 0.03795170 -2.64876793 -0.01251193 -H 0.86460312 1.87589979 0.51479719 -H -0.03217624 1.87210581 -1.00791002 -H -0.90233115 1.85185524 0.53003953 -H -0.83477011 -3.06339007 0.50451436 -H 0.03276422 -3.04315564 -1.03491223 -H 0.93213486 -3.03931642 0.48626606 -10 -Properties=species:S:1:pos:R:3 energy=-155.86202269220013 pbc="F F F" -C -0.03095840 1.54775025 0.03167945 -C 0.01485375 0.00962471 -0.02082154 -C 0.69099073 -0.49954575 -1.20857624 -C 1.25222275 -0.89514467 -2.19527879 -H 0.97899300 1.96621609 0.03373834 -H -0.56082354 1.95002902 -0.83580745 -H -0.54576708 1.88225519 0.93709062 -H 0.51920135 -0.37425398 0.87496224 -H -1.00644802 -0.39030838 0.01340632 -H 1.74594541 -1.25604187 -3.06299415 -9 -Properties=species:S:1:pos:R:3 energy=-172.01520451505468 pbc="F F F" -C -0.02522005 1.54773054 0.02133370 -C 0.01183939 0.00999278 -0.01556702 -C 0.68915114 -0.50836846 -1.20331488 -N 1.22565733 -0.90360846 -2.14737482 -H 0.98571620 1.96212990 0.02370153 -H -0.55522192 1.94599662 -0.84711771 -H -0.53962556 1.88294354 0.92536604 -H 0.52481910 -0.38226048 0.86933355 -H -1.00453542 -0.39832109 0.00530071 -8 -Properties=species:S:1:pos:R:3 energy=-188.17128260875586 pbc="F F F" -N -0.03608099 1.48762533 0.03678072 -C -0.01039471 0.02517605 -0.01506608 -C -1.37180956 -0.52108920 0.02739272 -N -2.44026695 -0.95956444 0.03370519 -H 0.91729752 1.83547547 0.05202682 -H -0.47162178 1.85677205 -0.80275569 -H 0.48946161 -0.40880401 -0.89715168 -H 0.52827150 -0.34533338 0.86469547 -8 -Properties=species:S:1:pos:R:3 energy=-191.8497758271177 pbc="F F F" -O -0.02013197 1.45738137 0.01010195 -C 0.00168478 0.03579980 0.00224736 -C -1.36366691 -0.47481101 0.01255056 -C -2.47902835 -0.91970202 0.02082451 -H 0.89446911 1.75736553 0.00327363 -H 0.51979028 -0.35175413 -0.88980302 -H 0.53670458 -0.36127661 0.88000894 -H -3.46773502 -1.30737009 0.02818120 -7 -Properties=species:S:1:pos:R:3 energy=-208.0028177815803 pbc="F F F" -O -0.03738221 1.44547841 0.01010769 -C 0.01292906 0.03441661 0.00209165 -C -1.35747452 -0.48874523 0.01239738 -N -2.42135277 -0.93685184 0.02016053 -H 0.86898057 1.76972949 0.00417577 -H 0.51692713 -0.36329790 -0.89215814 -H 0.53387616 -0.37278749 0.88223921 -10 -Properties=species:S:1:pos:R:3 energy=-193.02218181903672 pbc="F F F" -C 0.16879340 1.52513042 -0.15747056 -C -0.18737625 0.06194763 0.14679374 -C 0.50917645 -0.43996215 1.39125850 -O 1.18191079 -1.43565585 1.45816384 -H 1.23126511 1.63137254 -0.39632693 -H -0.40744668 1.89431681 -1.00969246 -H -0.04931034 2.17266260 0.69857432 -H -1.26905160 -0.01668067 0.32854433 -H 0.06279062 -0.60250479 -0.68474036 -H 0.35384841 0.20663370 2.28871052 -9 -Properties=species:S:1:pos:R:3 energy=-209.16922499543483 pbc="F F F" -C 0.01474916 1.47888256 -0.03509326 -N 0.18708077 0.03831317 -0.02906851 -C 0.45703661 -0.66858895 1.10069001 -O 0.58457996 -0.19876202 2.21119705 -H 0.76025289 1.96736104 -0.67198126 -H -0.98462423 1.75984483 -0.38485103 -H 0.14269849 1.82387718 0.99149397 -H 0.10386349 -0.46937726 -0.89461379 -H 0.55047568 -1.75253452 0.88868242 -8 -Properties=species:S:1:pos:R:3 energy=-229.00173936866847 pbc="F F F" -C 0.10653781 1.43512049 0.03336100 -O 0.42686564 0.04716929 0.09309945 -C 0.50714862 -0.63652665 -1.06318297 -O 0.76927014 -1.79955017 -1.11010475 -H 0.92349251 2.00385139 0.48465728 -H -0.03757815 1.76927183 -1.00057425 -H -0.81269569 1.60801916 0.59873287 -H 0.30458460 -0.00231902 -1.94965553 -8 -Properties=species:S:1:pos:R:3 energy=-229.00948778530264 pbc="F F F" -O 0.19375856 1.37170995 0.31398297 -C 0.04992637 0.01405481 -0.04526239 -C -1.40888025 -0.39635680 -0.20601574 -O -1.77729462 -1.37233860 -0.80361689 -H -0.01723186 1.91269132 -0.45337758 -H 0.60440478 -0.26519766 -0.95205725 -H 0.46740406 -0.57521679 0.78176270 -H -2.11835055 0.30075962 0.29870515 -14 -Properties=species:S:1:pos:R:3 energy=-158.21126506448377 pbc="F F F" -C -0.03007624 1.55804912 0.02980774 -C 0.00707277 0.02834877 -0.00712529 -C 0.71320792 -0.52989340 -1.24765581 -C 0.75036895 -2.05959366 -1.28458957 -H 0.98195330 1.97845113 0.02800797 -H -0.55582433 1.96212343 -0.84270157 -H -0.54083762 1.92692755 0.92493697 -H 0.50928672 -0.34909049 0.89361319 -H -1.01733481 -0.36542299 0.03207393 -H 0.21098948 -0.15245770 -2.14839302 -H 1.73761331 -0.13611625 -1.28685672 -H 1.27616854 -2.46366410 -0.41210980 -H -0.26165699 -2.48000447 -1.28273552 -H 1.26108491 -2.42846444 -2.17974803 -12 -Properties=species:S:1:pos:R:3 energy=-194.19841985508427 pbc="F F F" -C -0.00379012 1.52196790 0.01027996 -C -0.03589372 -0.00778254 0.00225671 -C -1.45219016 -0.56653711 0.01284386 -O -1.36799785 -1.98394604 0.00453606 -H 1.02477576 1.89411231 0.00239793 -H -0.51286674 1.93764614 -0.86653888 -H -0.49584080 1.92801344 0.90121721 -H 0.48140784 -0.39530552 -0.88316064 -H 0.49828589 -0.40486256 0.87330348 -H -1.98734220 -0.20399494 0.90666062 -H -2.00431485 -0.19459473 -0.86666460 -H -2.26171819 -2.33824298 0.01034748 -12 -Properties=species:S:1:pos:R:3 energy=-194.18760581581495 pbc="F F F" -C -0.00519551 1.50868224 0.03308760 -C 0.01316580 -0.01037819 0.01988643 -O 0.69758944 -0.46344140 1.16868979 -C 0.76688491 -1.86508183 1.24602669 -H 1.01445476 1.90423799 0.02996018 -H -0.52990866 1.89184059 -0.84726911 -H -0.51263765 1.87805843 0.92875424 -H -1.01599507 -0.40998729 0.00714282 -H 0.51093143 -0.38369435 -0.89219395 -H -0.23415841 -2.32451489 1.28977780 -H 1.30129276 -2.29853663 0.38486095 -H 1.30990287 -2.11811998 2.16013206 -10 -Properties=species:S:1:pos:R:3 energy=-230.18526304281096 pbc="F F F" -O -0.01418735 1.42642242 -0.05423651 -C -0.00391839 0.00717714 0.03496062 -C -1.42317019 -0.55560600 -0.01256639 -O -2.11229413 -0.10563875 -1.17228313 -H -0.18987882 1.64154705 -0.97555148 -H 0.59659504 -0.43315430 -0.77409095 -H 0.47311116 -0.24903733 0.98747216 -H -1.39494859 -1.64975279 -0.06283188 -H -1.96497417 -0.27216915 0.90131972 -H -2.35925991 0.80944396 -1.00614597 -12 -Properties=species:S:1:pos:R:3 energy=-157.0385698613141 pbc="F F F" -C -0.03602245 1.52092949 0.01569161 -C 0.01938487 0.01004403 0.04814953 -C 1.30891671 -0.71251995 -0.24920416 -C 0.75347423 -0.70267714 1.15564676 -H 0.90105691 1.95389291 0.38283338 -H -0.19640365 1.89437369 -1.00208569 -H -0.84685273 1.90588930 0.64451322 -H -0.88416809 -0.48001889 -0.30566335 -H 1.26900901 -1.63903068 -0.81150371 -H 2.19010738 -0.11131209 -0.44927513 -H 1.26248862 -0.09487455 1.89690028 -H 0.33540836 -1.62248918 1.54980695 -10 -Properties=species:S:1:pos:R:3 energy=-193.01830935317872 pbc="F F F" -C -0.01646343 1.51830705 0.00771445 -C -0.02743227 0.01657694 -0.10889741 -C 0.77296553 -0.70131886 -1.10863115 -O 1.17212293 -0.66702969 0.26278829 -H 0.91865980 1.92914217 -0.38285880 -H -0.85158014 1.95456506 -0.55109460 -H -0.11487702 1.82596470 1.05397777 -H -0.93582598 -0.47350600 0.24682793 -H 0.44443922 -1.67201495 -1.47810622 -H 1.40538284 -0.13600339 -1.79271491 -11 -Properties=species:S:1:pos:R:3 energy=-173.17966747290075 pbc="F F F" -C -0.05275541 1.47419574 0.00999108 -N 0.01940516 0.02189947 0.06334866 -C 1.32511048 -0.56446850 -0.21420725 -C 0.78051759 -0.54057993 1.17242760 -H 0.86784202 1.97176076 0.36297285 -H -0.23845155 1.79095005 -1.02142866 -H -0.88683448 1.81938959 0.62950398 -H 1.31992909 -1.48186782 -0.79602038 -H 2.15202820 0.11020204 -0.43285248 -H 1.24563570 0.14996098 1.87499245 -H 0.37013358 -1.44020447 1.62233365 -10 -Properties=species:S:1:pos:R:3 energy=-193.02615692959702 pbc="F F F" -O 0.21577583 1.35386859 -0.10695107 -C 0.01628099 -0.02832718 -0.02915694 -C -0.39081465 -0.71497009 1.24315669 -C -1.35118138 -0.64280380 0.06273589 -H -0.43642338 1.79062849 0.45006761 -H 0.74981167 -0.52404050 -0.65624767 -H 0.05959375 -1.66840483 1.49729237 -H -0.61369353 -0.08848006 2.10170640 -H -2.19821932 0.03058430 0.15411451 -H -1.56395912 -1.54640426 -0.49826515 -12 -Properties=species:S:1:pos:R:3 energy=-157.0405081304258 pbc="F F F" -C -0.02542957 1.54032578 -0.04215944 -C 1.52564399 1.50419989 0.04121276 -C 1.42146727 0.06146790 0.60844885 -C -0.02638833 -0.01070956 0.04935088 -H -0.46591372 1.99639894 0.84962894 -H -0.47900239 2.00028207 -0.92365389 -H 1.98248278 1.51375334 -0.95303183 -H 2.02191365 2.25986579 0.65522129 -H 2.14291679 -0.67956358 0.25531480 -H 1.43105853 0.05751479 1.70261879 -H -0.79053440 -0.48530296 0.66996573 -H -0.05233245 -0.47238446 -0.94236394 -10 -Properties=species:S:1:pos:R:3 energy=-193.0195691628832 pbc="F F F" -C -0.03489789 1.55259455 -0.08507691 -C 1.49349183 1.45459700 0.10114677 -O 1.42725884 0.02348990 0.27254886 -C -0.00634758 0.02236494 0.10944630 -H -0.56579210 2.11301721 0.68591527 -H -0.36628352 1.89393380 -1.06692327 -H 2.10031724 1.73525720 -0.76898349 -H 1.90023090 1.95506611 0.98896748 -H -0.51987849 -0.35595179 1.00235948 -H -0.31970062 -0.57567421 -0.75559275 -12 -Properties=species:S:1:pos:R:3 energy=-248.43592866438485 pbc="F F F" -C -0.10255370 1.49907127 -0.00133642 -C -0.00519774 -0.00343114 -0.02723470 -C -0.00688536 -0.76890740 1.26434744 -N 0.08186799 -0.69202791 -1.10087306 -O 0.07439067 0.13215394 -2.24195258 -H 0.78342093 1.94690862 -0.46354050 -H -0.96150430 1.83614082 -0.59021965 -H -0.19854173 1.87462989 1.01931607 -H -0.92620012 -0.57297946 1.82982479 -H 0.07256154 -1.84064782 1.07516863 -H 0.82937178 -0.45553340 1.90133089 -H 0.13975924 -0.51254299 -2.95389260 -10 -Properties=species:S:1:pos:R:3 energy=-210.09921285290702 pbc="F F F" -N -0.00829694 1.35362838 0.00995971 -C 1.28033254 1.82457421 -0.00022459 -C 2.12216639 0.73698898 -0.01445600 -C 1.30849904 -0.43109580 -0.01284154 -C -0.00342782 -0.01836884 0.00235736 -H -0.83243234 1.92772668 0.02122995 -H 1.48471820 2.88312630 0.00354313 -H 3.20066918 0.77343077 -0.02488416 -H 1.64810599 -1.45539683 -0.02180394 -H -0.92551647 -0.57697054 0.00839402 -9 -Properties=species:S:1:pos:R:3 energy=-226.24869739686426 pbc="F F F" -N -0.00996090 1.35636172 0.01000855 -C 1.29535422 1.79575578 -0.00047017 -C 2.05550519 0.65637438 -0.01422927 -N 1.25385745 -0.46275132 -0.01260894 -C 0.02301170 -0.00706382 0.00200146 -H -0.83195718 1.93618436 0.02132575 -H 1.54553961 2.84344998 0.00289054 -H 3.13177434 0.57569766 -0.02524155 -H -0.87667864 -0.60414531 0.00750794 -9 -Properties=species:S:1:pos:R:3 energy=-229.9291879872837 pbc="F F F" -O -0.03255819 1.35065130 0.00967376 -C 1.25319237 1.79167710 -0.00030351 -C 2.11664681 0.74375623 -0.01441494 -C 1.30397796 -0.43852387 -0.01283316 -C 0.01629568 -0.00777185 0.00191294 -H 1.37951089 2.86161135 0.00427433 -H 3.19376406 0.79865501 -0.02458604 -H 1.63858893 -1.46383271 -0.02156949 -H -0.93736295 -0.50899925 0.00843891 -8 -Properties=species:S:1:pos:R:3 energy=-246.0780478767452 pbc="F F F" -O -0.03808298 1.35643965 0.00975193 -C 1.26496982 1.76855319 -0.00061744 -C 2.04955750 0.66630033 -0.01406047 -N 1.24227075 -0.46732066 -0.01237541 -C 0.04019820 0.00561577 0.00183569 -H 1.43513907 2.83095265 0.00340823 -H 3.12532898 0.59783015 -0.02480757 -H -0.89387707 -0.53342154 0.00796935 -17 -Properties=species:S:1:pos:R:3 energy=-197.46274800748583 pbc="F F F" -C -0.01859029 1.53486266 0.01039904 -C 0.00210320 -0.00413672 0.00196980 -C 0.74643954 -0.51390760 1.24887638 -C -1.44190166 -0.53673615 0.01311457 -C 0.72234971 -0.50049606 -1.26445632 -H 0.99776928 1.94420529 0.00435474 -H -0.54181883 1.92841415 -0.86819911 -H -0.52758402 1.91888376 0.90148530 -H 0.25549576 -0.17602728 2.16833067 -H 0.77815389 -1.60892372 1.27088904 -H 1.77964786 -0.14975834 1.26944035 -H -1.99871895 -0.18888794 -0.86408066 -H -1.45956909 -1.63227235 0.00649916 -H -1.98088827 -0.19979639 0.90561580 -H 1.75482473 -0.13554018 -1.30118083 -H 0.75396989 -1.59524036 -1.29822280 -H 0.21358221 -0.15343900 -2.17067181 -15 -Properties=species:S:1:pos:R:3 energy=-233.45029884694642 pbc="F F F" -C -0.00855999 1.54270147 0.00152717 -C 0.00506780 0.00702635 0.01856160 -C 0.76137731 -0.51839196 1.24766443 -C -1.42012774 -0.54933183 -0.02116008 -O 0.62590477 -0.48363745 -1.17657057 -H 1.01361406 1.94020776 0.00281128 -H -0.51459669 1.90702466 -0.89705781 -H -0.52214815 1.94882514 0.87918344 -H 0.28130613 -0.20165548 2.17943598 -H 0.79965506 -1.61131746 1.23022549 -H 1.79096916 -0.14072935 1.26083003 -H -1.93854829 -0.19910724 -0.91828281 -H -1.39937632 -1.64259062 -0.04563833 -H -1.98850725 -0.23059656 0.85726520 -H 1.53111188 -0.15488046 -1.19210222 -9 -Properties=species:S:1:pos:R:3 energy=-229.92918286474116 pbc="F F F" -C -0.00693851 1.49559567 -0.01063358 -C -0.02986170 -0.01594623 0.06248673 -O -0.08815239 -0.63215062 1.10334812 -C 0.02336981 -0.70256747 -1.22062379 -C 0.06738132 -1.26058341 -2.28623129 -H 0.90429806 1.83281887 -0.51655384 -H -0.85338524 1.85556926 -0.60552819 -H -0.05237764 1.91099807 0.99695949 -H 0.10466868 -1.77036047 -3.21832617 -8 -Properties=species:S:1:pos:R:3 energy=-246.08255887169082 pbc="F F F" -C -0.01171097 1.49973776 -0.01213268 -C -0.02919740 -0.00338745 0.07151218 -O -0.09164028 -0.64592927 1.08732241 -C 0.03831104 -0.69690258 -1.23748557 -N 0.09136286 -1.22982650 -2.26228068 -H 0.90093132 1.83370670 -0.51814928 -H -0.85663933 1.84864400 -0.61618135 -H -0.06416540 1.92131542 0.99203818 -8 -Properties=species:S:1:pos:R:3 energy=-242.4115277766697 pbc="F F F" -N -0.05232108 1.34991769 0.15535538 -C 0.08549378 -0.01476951 0.02668890 -N 1.14555215 -0.71993906 -0.03966037 -C -1.19426556 -0.71152088 0.01802151 -N -2.22747610 -1.22790543 0.00132148 -H 0.75474469 1.91998737 -0.04411334 -H -0.94458527 1.76600473 -0.05932293 -H 1.98312429 -0.13415500 -0.02878551 -9 -Properties=species:S:1:pos:R:3 energy=-267.0892973798888 pbc="F F F" -C -0.43126066 1.30586664 -0.12758585 -C 0.25285715 -0.01026988 0.13138867 -O 0.69872099 -0.36890333 1.19604690 -C 0.38978943 -0.96773680 -1.06226208 -O -0.01611268 -0.71564293 -2.16583718 -H 0.10006565 1.85324490 -0.91332597 -H -1.44270433 1.13069361 -0.50923371 -H -0.46757554 1.89548158 0.78836479 -H 0.90329886 -1.91558845 -0.79531972 -9 -Properties=species:S:1:pos:R:3 energy=-263.41796861865316 pbc="F F F" -N -0.16032929 1.08528962 -0.45398652 -C 0.18649127 -0.08762327 0.14758021 -N 1.28979627 -0.46427423 0.67927030 -C -0.94204384 -1.08440264 0.20423621 -O -2.01802205 -0.89007687 -0.30583149 -H 0.54574437 1.73837930 -0.74689246 -H -1.04684920 1.09570857 -0.93607796 -H 2.01738195 0.24991828 0.59881811 -H -0.67740148 -2.01003995 0.74746441 -13 -Properties=species:S:1:pos:R:3 energy=-195.11938872974875 pbc="F F F" -C -0.01763434 1.54859468 -0.00253584 -C -0.01719180 0.00735789 0.03269604 -C 0.75818463 -0.52820155 1.25278862 -C -1.38213303 -0.51768438 0.00775516 -C -2.50796392 -0.94005629 0.00478552 -H 1.00944396 1.92639613 -0.02632830 -H -0.54514614 1.92217052 -0.88393459 -H -0.51243000 1.95339892 0.88560642 -H 0.49366179 -0.34904155 -0.87265890 -H 0.28968458 -0.19345372 2.18334679 -H 0.77833392 -1.62102506 1.25783727 -H 1.78952492 -0.16181727 1.23574954 -H -3.49998244 -1.31810165 -0.00723572 -12 -Properties=species:S:1:pos:R:3 energy=-211.27265408953502 pbc="F F F" -C -0.00242350 1.55035837 0.01056187 -C -0.01856600 0.01004352 -0.02261770 -C -1.45045318 -0.55766178 0.01293347 -C 0.70125749 -0.48583168 -1.20172764 -N 1.26190946 -0.87126766 -2.13619740 -H 1.01959496 1.93673215 0.00349668 -H -0.52972844 1.96141639 -0.85498386 -H -0.50134251 1.90346839 0.91755862 -H 0.52481877 -0.36222456 0.85525462 -H -2.02427903 -0.21428716 -0.85251869 -H -1.44438296 -1.65026927 0.00754107 -H -1.95805494 -0.21725882 0.91996760 -11 -Properties=species:S:1:pos:R:3 energy=-227.42960250774672 pbc="F F F" -C -0.01064295 1.54128691 0.00722087 -C -0.00203811 0.00756015 0.03863463 -N 0.76268677 -0.47101822 1.19250856 -C -1.38541954 -0.52099256 -0.00194097 -N -2.45680847 -0.95636072 0.00694969 -H 1.02043523 1.90106589 0.00392365 -H -0.52873161 1.91193452 -0.88031480 -H -0.51849536 1.94150431 0.89013197 -H 0.50418828 -0.35805500 -0.86276072 -H 0.30070681 -0.18364934 2.05155305 -H 0.78148992 -1.48670299 1.20428183 -11 -Properties=species:S:1:pos:R:3 energy=-231.1072634896723 pbc="F F F" -C -0.00754278 1.55566144 0.08650633 -C 0.01207541 0.02096553 0.04935916 -O -1.29150251 -0.52785128 0.22126386 -C 0.65093362 -0.47718651 -1.17430507 -C 1.13902673 -0.86577343 -2.20205518 -H 1.00824243 1.95969458 0.04929733 -H -0.56272245 1.95192010 -0.76978085 -H -0.49328161 1.88929438 1.00704123 -H 0.57811967 -0.34464907 0.91458864 -H -1.78516532 -0.35903262 -0.58909400 -H 1.58078877 -1.22365060 -3.09919447 -10 -Properties=species:S:1:pos:R:3 energy=-247.26037633910093 pbc="F F F" -C -0.00992462 1.54951908 0.00732200 -C 0.00740485 0.01722020 0.05031270 -O 0.72085722 -0.49630479 1.15864583 -C -1.36995095 -0.52355929 0.00894432 -N -2.45081572 -0.93233138 0.00716912 -H 1.01892314 1.91630447 0.02724149 -H -0.50261490 1.90969362 -0.89997951 -H -0.54800426 1.95377611 0.87053664 -H 0.53602846 -0.36494195 -0.82970945 -H 0.27702643 -0.20644534 1.96421773 -13 -Properties=species:S:1:pos:R:3 energy=-232.27967697177337 pbc="F F F" -C -0.02629647 1.53877116 -0.00783747 -C 0.01468904 0.00095310 0.00166037 -C 0.74737862 -0.53388859 1.24420471 -C -1.40211264 -0.53859257 -0.01557820 -O -1.87620455 -1.23582351 -0.87399559 -H 0.98823696 1.94625080 0.03705522 -H -0.50725090 1.92153422 -0.91285565 -H -0.57756514 1.92360883 0.85796386 -H 0.50584680 -0.36421091 -0.90619124 -H 0.22958380 -0.23909403 2.16431052 -H 0.81692736 -1.62559499 1.22973438 -H 1.76267153 -0.12846566 1.29050755 -H -2.00861510 -0.22792742 0.87121666 -11 -Properties=species:S:1:pos:R:3 energy=-268.26719688446104 pbc="F F F" -C -0.05483118 1.46032843 -0.17068647 -C 0.07105714 -0.03524485 0.11225841 -O 0.58204486 -0.33316656 1.40176256 -C -1.27639279 -0.74383027 0.03051185 -O -2.11855775 -0.49643175 -0.79163412 -H 0.93158072 1.93091398 -0.23353204 -H -0.57713995 1.61290939 -1.11835562 -H -0.62444315 1.94776119 0.62573670 -H 0.69687521 -0.50071620 -0.67159471 -H 1.45603316 0.06066659 1.47858584 -H -1.40723217 -1.53388627 0.80211181 -12 -Properties=species:S:1:pos:R:3 energy=-248.4189085470366 pbc="F F F" -C -0.09776499 1.44917268 0.04561984 -N 0.01043053 0.00373818 -0.00070600 -C 0.05323028 -0.71432112 1.25264891 -C 0.06728716 -0.64067225 -1.20060778 -O 0.03636432 -0.11006515 -2.29109228 -H 0.75650660 1.88747109 0.57647421 -H -0.11648577 1.81632103 -0.98049172 -H -1.01641106 1.75521548 0.56151415 -H -0.85453556 -0.53657675 1.84390168 -H 0.13297722 -1.78696336 1.05851351 -H 0.91637348 -0.40737846 1.85761345 -H 0.14762240 -1.73801339 -1.06805139 -11 -Properties=species:S:1:pos:R:3 energy=-268.2638777094278 pbc="F F F" -C -0.01708808 1.44281136 0.03225501 -C -0.05544542 -0.06560572 -0.02375999 -O -0.17379913 -0.76196233 0.96223129 -C 0.06068107 -0.73615179 -1.38825252 -O 0.00877771 -2.12574390 -1.27749486 -H 0.92062950 1.81463913 -0.39522215 -H -0.83050523 1.86542281 -0.56780350 -H -0.10911975 1.78049045 1.06493675 -H -0.75015067 -0.35235060 -2.03056074 -H 1.00312898 -0.40389029 -1.85592942 -H -0.09063255 -2.29450960 -0.32608019 -13 -Properties=species:S:1:pos:R:3 energy=-232.27701367560746 pbc="F F F" -C -0.04384102 1.54099793 -0.03913814 -C 0.02765132 0.01885817 0.04778773 -C 0.76814644 -0.48842218 1.28000847 -C 0.87850208 -1.99746312 1.42393323 -O 1.24179142 0.26651340 2.09788702 -H 0.95796454 1.97690198 -0.06816012 -H -0.58447717 1.85356031 -0.93690369 -H -0.55173626 1.95737759 0.83440529 -H -0.97692824 -0.42709877 0.05353178 -H 0.51853486 -0.40806507 -0.83809409 -H 1.39924980 -2.42678188 0.56053177 -H 1.42001187 -2.24449367 2.33776426 -H -0.11750602 -2.45360651 1.45141965 -12 -Properties=species:S:1:pos:R:3 energy=-248.4357728153985 pbc="F F F" -C -0.00220144 1.53344329 -0.05960369 -C -0.03235837 0.01206167 0.06840265 -C 0.69666086 -0.48196462 1.31828322 -N 0.98104007 -1.82034162 1.31984698 -O 1.00392124 0.24606232 2.24136749 -H 1.02111190 1.89525169 -0.19182672 -H -0.59707204 1.86206427 -0.91645604 -H -0.39728839 1.99920712 0.84545201 -H -1.06936083 -0.34552935 0.13040806 -H 0.39947165 -0.46906818 -0.81777020 -H 0.63281951 -2.43917647 0.60874785 -H 1.35708014 -2.22217793 2.16303522 -12 -Properties=species:S:1:pos:R:3 energy=-248.42526816200925 pbc="F F F" -C 0.00619941 1.45933202 -0.03893859 -N -0.06411616 0.01422963 -0.12046901 -C -1.20595394 -0.68196796 0.16117120 -C -1.08982704 -2.19284899 0.02095775 -O -2.24482911 -0.14443077 0.49994418 -H 0.75053989 1.78372520 0.69715573 -H 0.25692001 1.90395263 -1.00876215 -H -0.97856026 1.81121438 0.27082194 -H 0.75820982 -0.49543660 -0.39464024 -H -0.09909703 -2.53543104 -0.28970003 -H -1.34097671 -2.65395851 0.97972885 -H -1.82903100 -2.53483935 -0.70813076 -11 -Properties=species:S:1:pos:R:3 energy=-264.5853117493019 pbc="F F F" -C 0.00922630 1.45021814 -0.03194543 -N -0.01429488 -0.00054646 -0.01782667 -C -1.21576579 -0.67252403 0.04421896 -N -1.09733352 -2.04644898 -0.15997741 -O -2.28599299 -0.12893711 0.24196027 -H 0.89659038 1.81885022 0.49120949 -H 0.00233950 1.86388504 -1.04914155 -H -0.88562684 1.79943346 0.48353298 -H 0.75257305 -0.47506631 -0.46719265 -H -0.24882333 -2.48772194 0.16375654 -H -1.93419610 -2.53898393 0.11482880 -12 -Properties=species:S:1:pos:R:3 energy=-248.42559868402765 pbc="F F F" -C -0.09160695 1.37540046 -0.00729426 -O -0.06964534 -0.04831581 -0.11148812 -C 0.68114625 -0.56142673 -1.10732458 -C 0.60405298 -2.06701550 -1.08766892 -N 1.32645533 0.19266343 -1.89967731 -H 0.91463916 1.76843655 0.16257460 -H -0.48562826 1.82624615 -0.92235216 -H -0.73971430 1.60007423 0.84110605 -H -0.43430065 -2.39242162 -1.20325205 -H 1.20627110 -2.50049977 -1.88745640 -H 0.95651337 -2.44976670 -0.12501838 -H 1.83504115 -0.36104361 -2.58486055 -11 -Properties=species:S:1:pos:R:3 energy=-268.256996283395 pbc="F F F" -C 0.07295254 1.38840919 0.06442046 -O 0.21049114 -0.03740028 0.04612736 -C 0.50102805 -0.57224288 -1.15975346 -C 0.62218715 -2.07378323 -1.06030684 -O 0.63922154 0.08224418 -2.16157325 -H 1.00029720 1.87062570 -0.25532064 -H -0.73338957 1.70782089 -0.60080454 -H -0.15751280 1.65154060 1.09692954 -H -0.31330001 -2.50202851 -0.68941906 -H 0.85646588 -2.48430275 -2.04157352 -H 1.40651685 -2.34055496 -0.34634301 -10 -Properties=species:S:1:pos:R:3 energy=-284.4165248609943 pbc="F F F" -C -0.02645771 1.38305753 0.02085660 -O 0.04139566 -0.04439503 -0.00277452 -C 0.66775338 -0.56001625 -1.09000344 -N 0.72605063 -1.92219983 -0.98822954 -O 1.12952381 0.09648143 -1.99322180 -H 0.97529779 1.82044307 0.02387306 -H -0.57085698 1.76214621 -0.84790425 -H -0.55410722 1.63835731 0.94043594 -H 0.12662696 -2.38401590 -0.32566929 -H 0.97230070 -2.41798421 -1.82732573 -10 -Properties=species:S:1:pos:R:3 energy=-284.4234752505414 pbc="F F F" -N -0.08115607 1.31807026 0.01276742 -C 0.05442259 -0.04477733 0.08155388 -O 1.12163074 -0.59783950 0.20940553 -C -1.28687786 -0.79011642 0.06178435 -O -1.04605114 -2.13954195 -0.23957158 -H 0.76623366 1.85991128 -0.04483425 -H -0.93021346 1.74567447 -0.31565615 -H -1.74559696 -0.65521334 1.05526700 -H -1.96026061 -0.31149222 -0.67026256 -H -1.85637296 -2.63017646 -0.07625478 -10 -Properties=species:S:1:pos:R:3 energy=-284.42244772184733 pbc="F F F" -N 0.01838100 0.93057357 0.04943058 -H -0.70674506 0.56116798 -0.55550134 -H 0.68248307 0.18430002 0.21487099 -H 0.21928084 2.79858558 -0.32670585 -C -0.54586914 1.44688585 1.30274586 -C -0.80466975 2.96030569 1.21052835 -O -0.21468822 3.53648884 0.15531687 -O -1.45295676 3.56338618 2.02143528 -H -1.47662579 0.96512183 1.62072169 -H 0.17781209 1.30324286 2.11157176 -13 -Properties=species:S:1:pos:R:3 energy=-269.4427897037706 pbc="F F F" -C -0.02775167 1.53421433 0.00651151 -C 0.08343246 0.01218277 0.05258986 -O 0.95856392 -0.48200710 -0.96694113 -C 0.69767574 -0.49516451 1.35948812 -O 2.02247062 -0.02842530 1.52222186 -H 0.94333763 1.98841434 0.21841589 -H -0.37320516 1.87354041 -0.97716908 -H -0.74773817 1.89256394 0.74926853 -H -0.91671848 -0.43697036 -0.06040528 -H 0.76726710 -0.01412177 -1.78502043 -H 0.11650002 -0.13351914 2.21392431 -H 0.65814685 -1.59563445 1.36274474 -H 2.46378566 -0.22762476 0.68698431 -17 -Properties=species:S:1:pos:R:3 energy=-197.46826930124075 pbc="F F F" -C 0.05879035 1.56174169 -0.01945240 -C -0.01544024 0.03182306 0.00308332 -C -1.44103237 -0.54862028 0.05028629 -C -1.40777007 -2.07231030 -0.13012010 -C -2.18400529 -0.17659759 1.34114303 -H 1.09435638 1.90233607 -0.11900072 -H -0.50689566 1.97217319 -0.86388098 -H -0.34407951 2.00628082 0.89579522 -H 0.48926758 -0.36011214 -0.88953902 -H 0.55254938 -0.35139446 0.86269887 -H -2.00031575 -0.12153682 -0.79559684 -H -0.85501131 -2.55065810 0.68775438 -H -2.41787513 -2.49543628 -0.13720127 -H -0.91928762 -2.35363802 -1.06914014 -H -3.19100197 -0.60699559 1.35137051 -H -1.65197294 -0.56010584 2.22063481 -H -2.28793759 0.90575132 1.46079572 -15 -Properties=species:S:1:pos:R:3 energy=-233.45573194755383 pbc="F F F" -C -0.03841227 1.55621396 0.00935837 -C 0.01907135 0.02716079 -0.02074203 -C 0.73141506 -0.52709328 -1.25454422 -C 0.83975868 -2.05206973 -1.22872655 -O -0.01226470 -0.08514394 -2.38973758 -H 0.96845664 1.98863424 0.03526234 -H -0.54377006 1.93824134 -0.88074407 -H -0.57652955 1.91383386 0.89256698 -H 0.53166867 -0.34991486 0.87240999 -H -0.99727186 -0.38638654 -0.00185289 -H 1.74909346 -0.09943025 -1.28826184 -H 1.34143968 -2.42487137 -2.12957624 -H 1.41822012 -2.39229108 -0.36340871 -H -0.15616765 -2.50443859 -1.18308875 -H 0.43090825 -0.40901616 -3.17979642 -15 -Properties=species:S:1:pos:R:3 energy=-233.44494348552263 pbc="F F F" -C -0.00857605 1.38097833 0.09454670 -O -0.02255106 -0.00739461 -0.13062576 -C -1.30243341 -0.61997805 -0.02088309 -C -1.18687286 -1.97885751 -0.70303918 -C -1.75587824 -0.74662760 1.43714508 -H 1.00321550 1.73258087 -0.12443496 -H -0.71511468 1.90838275 -0.56674280 -H -0.24909065 1.64967237 1.13384681 -H -2.03737978 -0.00432241 -0.56884198 -H -0.44792779 -2.59945605 -0.18596870 -H -2.14751041 -2.50225525 -0.69102581 -H -0.86524212 -1.85860679 -1.74077836 -H -2.73321482 -1.23674908 1.49205117 -H -1.03621350 -1.34483828 2.00544671 -H -1.84898410 0.22935483 1.92198087 -15 -Properties=species:S:1:pos:R:3 energy=-196.29306583078866 pbc="F F F" -C -0.03913204 1.50456305 0.04978913 -C 0.00985856 -0.01113880 0.01248619 -C -1.24167981 -0.66663044 -0.53989979 -C 1.33803387 -0.66895748 -0.27400430 -C 0.75126442 -0.72221586 1.11862571 -H 0.88633040 1.92490040 0.45579358 -H -0.18183878 1.92045743 -0.95489291 -H -0.86832076 1.85815718 0.67439648 -H -1.43570890 -0.34344387 -1.56976411 -H -1.15326757 -1.75757800 -0.54433832 -H -2.12221416 -0.40570820 0.05951361 -H 1.34398374 -1.58235208 -0.86005084 -H 2.20196897 -0.03329084 -0.43929326 -H 1.21949576 -0.12246018 1.89246580 -H 0.36153319 -1.67153717 1.47171932 -13 -Properties=species:S:1:pos:R:3 energy=-232.2730586604603 pbc="F F F" -C -0.03970330 1.50954998 -0.04112233 -C -0.03023556 -0.00335329 -0.06498361 -C -1.24613189 -0.68356648 0.52531190 -C 0.78937201 -0.71129193 -1.06027559 -O 1.22546798 -0.60059036 0.29712283 -H 0.88992772 1.90948478 -0.45296558 -H -0.87952723 1.90350108 -0.62376642 -H -0.14448576 1.87590604 0.98604429 -H -2.15218727 -0.41012616 -0.02629495 -H -1.13412584 -1.77005431 0.49747032 -H -1.38586631 -0.38055453 1.56882757 -H 0.50712690 -1.71386874 -1.38085018 -H 1.37088104 -0.14369322 -1.78640853 -13 -Properties=species:S:1:pos:R:3 energy=-232.2810112883452 pbc="F F F" -C -0.03714052 1.53215920 0.01332310 -C 0.01344335 0.02117019 0.01922005 -O -1.17476104 -0.59735284 -0.40931260 -C 1.30744798 -0.69902106 -0.27389650 -C 0.70844749 -0.71373504 1.12226318 -H 0.89026861 1.96240279 0.40276135 -H -0.17846151 1.91561262 -1.00518522 -H -0.87011232 1.88955201 0.62730953 -H -1.28352265 -0.40225391 -1.34690641 -H 1.23973813 -1.61642115 -0.84783774 -H 2.20543993 -0.11523820 -0.44744474 -H 1.19539159 -0.13889834 1.90240284 -H 0.24735439 -1.63670241 1.45378480 -10 -Properties=species:S:1:pos:R:3 energy=-247.25839812118107 pbc="F F F" -N -0.04445152 1.25623533 0.31681915 -C -0.03914559 0.04913710 -0.01670558 -C -1.08749619 -1.04164446 -0.11488033 -C 0.09869688 -1.90754844 -0.58225894 -O 0.99647508 -0.76306629 -0.44028010 -H 0.88935980 1.66481350 0.24916893 -H -1.54324114 -1.32235812 0.83572172 -H -1.86910036 -0.85713839 -0.85325910 -H 0.39739753 -2.72227350 0.08158721 -H 0.06945080 -2.25418345 -1.61796084 -11 -Properties=species:S:1:pos:R:3 energy=-231.1079280898958 pbc="F F F" -O -0.00101746 0.01846628 -0.20114742 -C -0.01405811 1.19658059 0.00205306 -C -1.13542911 2.22979148 0.21957980 -C -0.03500884 3.29097637 0.53052223 -C 1.08469664 2.25947795 0.18994331 -H -1.71642814 2.41772662 -0.68901078 -H -1.83392757 1.98415059 1.02444244 -H -0.05534741 4.17585264 -0.10670963 -H -0.02541477 3.61399048 1.57278917 -H 1.81074389 2.03288534 0.97578973 -H 1.63600801 2.46255380 -0.73376244 -10 -Properties=species:S:1:pos:R:3 energy=-247.25841709372799 pbc="F F F" -O 0.03184134 -0.03461682 0.00849836 -C -0.02440334 1.16440533 0.02160811 -C -1.14541322 2.23712809 0.03012901 -C 0.00928805 3.27945878 0.04557758 -N 0.93843838 2.14652109 0.03554396 -H -1.77030529 2.23779730 -0.86428437 -H -1.77632809 2.21765386 0.92007934 -H 0.07170564 3.91863516 -0.84072193 -H 0.06622603 3.89826625 0.94657952 -H 1.94616840 2.09535713 0.03855945 -9 -Properties=species:S:1:pos:R:3 energy=-267.0901197527288 pbc="F F F" -O 0.04424004 0.03933243 -0.33071104 -C -0.04854479 1.17416230 0.00410076 -C -1.14211656 2.23611850 0.15338361 -C 0.02332538 3.12357010 0.61681625 -O 0.95663808 2.01190122 0.42603746 -H -1.62573755 2.51482212 -0.78401102 -H -1.90009213 1.99553386 0.90028663 -H 0.28368077 3.96172751 -0.03229287 -H 0.00782250 3.43942655 1.66162725 -10 -Properties=species:S:1:pos:R:3 energy=-247.25652981857672 pbc="F F F" -O 0.00053891 0.00665475 -0.09743049 -C -0.01371990 1.19213881 0.03139936 -C -1.10668681 2.26612284 0.17247913 -N -0.03543445 3.25123475 0.48533693 -C 1.05328615 2.29521506 0.14383904 -H -1.65047970 2.42796175 -0.76886054 -H -1.83606786 2.11370530 0.97567410 -H -0.05434600 4.07193609 -0.10727051 -H 1.80754206 2.16277968 0.92736250 -H 1.56737937 2.47130277 -0.81152688 -9 -Properties=species:S:1:pos:R:3 energy=-267.08778168489164 pbc="F F F" -O -0.00031692 0.00676321 -0.17139774 -C -0.01417098 1.18672865 -0.00980279 -C -1.08283120 2.27653381 0.15574094 -O -0.03856115 3.26460423 0.27513986 -C 1.02857270 2.30515693 0.12774311 -H -1.72923855 2.43647507 -0.71671274 -H -1.70219898 2.19346725 1.05800754 -H 1.67366781 2.23923293 1.01324179 -H 1.64705068 2.48224548 -0.76148355 -15 -Properties=species:S:1:pos:R:3 energy=-196.29786966454915 pbc="F F F" -C -0.47005934 1.44206547 -0.06684548 -C 0.14287306 0.05485144 0.03747984 -C 1.37254693 -0.30295273 -0.84679168 -C 1.95947994 -1.09364561 0.35326039 -C 0.99887433 -0.30768787 1.28563099 -H 0.29210839 2.21844829 0.06844100 -H -0.93614604 1.60094605 -1.04612799 -H -1.24148161 1.59707353 0.69627593 -H -0.63517341 -0.70560132 -0.10055095 -H 1.19338376 -0.84118177 -1.78129390 -H 1.96867777 0.58857708 -1.07004184 -H 1.69873597 -2.15500718 0.30521100 -H 3.03253510 -1.01077235 0.54148058 -H 1.48290386 0.58242428 1.70211026 -H 0.51304296 -0.84979686 2.10121062 -13 -Properties=species:S:1:pos:R:3 energy=-232.27716018779967 pbc="F F F" -C -0.32308228 1.53751451 0.01947624 -C 0.11847214 0.08900172 -0.00523140 -C 0.87489284 -0.43763303 -1.24721738 -C 1.97841048 -0.80657483 -0.23740356 -O 1.27344926 -0.15419108 0.83794040 -H 0.49211985 2.19658795 -0.29527664 -H -1.17615835 1.68923490 -0.65134808 -H -0.62776963 1.82747912 1.03013205 -H -0.71410200 -0.56389187 0.29597305 -H 0.41033314 -1.26269706 -1.78910031 -H 1.15560811 0.34596269 -1.95459519 -H 2.09501012 -1.88349764 -0.05606083 -H 2.96970344 -0.36924147 -0.40408009 -13 -Properties=species:S:1:pos:R:3 energy=-232.27701585718498 pbc="F F F" -C -0.18371124 1.54668909 -0.01671129 -C 0.04513382 0.04386724 0.02270494 -C 1.20301104 -0.54034580 -0.81983464 -O 1.80061686 -1.15530615 0.33924991 -C 0.83391983 -0.54313754 1.21648003 -H 0.75102609 2.09256015 0.15344911 -H -0.58319248 1.86155707 -0.98694169 -H -0.89843724 1.85917126 0.75244153 -H -0.89506736 -0.48768372 -0.14843995 -H 0.93560472 -1.27857588 -1.58543917 -H 1.86392938 0.21379924 -1.27081649 -H 1.29414565 0.20948993 1.87273952 -H 0.31517042 -1.28326856 1.83756393 -13 -Properties=species:S:1:pos:R:3 energy=-232.2855477058313 pbc="F F F" -O 0.54622847 1.03270424 -0.58398083 -C -0.00112269 -0.11036621 0.01898238 -C 0.13945950 -0.34310429 1.54777117 -C -1.26863784 -0.99876517 1.51632654 -C -1.53844651 -0.26418236 0.17423510 -H 0.20332379 1.80433874 -0.12071219 -H 0.41296647 -0.95857955 -0.53560402 -H 0.98890738 -0.92719626 1.90921867 -H 0.11786549 0.61323034 2.08356053 -H -1.20828813 -2.08191064 1.38036699 -H -1.94143614 -0.79119746 2.35014116 -H -2.00495682 0.71307933 0.34581493 -H -2.09160311 -0.78230202 -0.61249171 -11 -Properties=species:S:1:pos:R:3 energy=-268.26484123819444 pbc="F F F" -O 0.07721714 1.41738724 -0.14439016 -C 0.01675156 0.02484791 0.03233817 -C 0.11193823 -0.54392541 1.47000744 -O -1.16387804 -1.20093191 1.32441605 -C -1.41930178 -0.52040930 0.07750673 -H 1.00022214 1.67889479 -0.21697466 -H 0.66036495 -0.50380879 -0.68180327 -H 0.91806589 -1.25385265 1.68878628 -H 0.09146208 0.24427487 2.23499232 -H -2.16139683 0.28183960 0.18222436 -H -1.72867456 -1.20941157 -0.71550887 -15 -Properties=species:S:1:pos:R:3 energy=-196.29571338186346 pbc="F F F" -C -0.05189850 1.55217435 -0.10318438 -C 0.01226648 0.04690675 0.03747520 -C 1.30115692 -0.70661553 -0.19725724 -C 0.70431939 -0.64893239 1.19003562 -C 1.39750324 0.09481280 2.31078011 -H 0.87404209 2.03543171 0.22162228 -H -0.21641357 1.83695278 -1.14852958 -H -0.87157646 1.97673684 0.48797046 -H -0.88508206 -0.45596941 -0.31580786 -H 1.27663658 -1.64149022 -0.74697967 -H 2.19424067 -0.11404121 -0.37569359 -H 0.21672461 -1.56377934 1.51902400 -H 1.91317356 0.99051175 1.95271747 -H 0.68738009 0.40901468 3.08446972 -H 2.14934633 -0.54151807 2.79111543 -13 -Properties=species:S:1:pos:R:3 energy=-232.28351736358312 pbc="F F F" -C -0.07992786 1.55914739 -0.03875994 -C 0.00042206 0.05111569 0.04346551 -C 1.31748624 -0.66230034 -0.20269965 -C 0.71624326 -0.61854924 1.18128126 -O 1.28134126 0.21474798 2.15341739 -H 0.80207677 2.01979988 0.41147972 -H -0.15235410 1.89225261 -1.07968732 -H -0.95836082 1.93564781 0.49643179 -H -0.88615174 -0.46939753 -0.30918496 -H 1.32384464 -1.60086657 -0.74666557 -H 2.18619315 -0.03316813 -0.37068758 -H 0.28509951 -1.54025035 1.57291630 -H 2.12931661 -0.16234387 2.40895930 -14 -Properties=species:S:1:pos:R:3 energy=-212.43771700068461 pbc="F F F" -C -0.17034561 1.55765735 -0.10065470 -C 0.01075256 0.05574638 -0.05225833 -C 0.71794239 -0.67802425 -1.14204150 -N 1.29811574 -0.59777508 0.19386866 -C 2.50047290 0.20256923 0.36428818 -H 0.60876703 2.05717913 -0.68119301 -H -1.13238698 1.79957181 -0.56489127 -H -0.17350949 1.98946323 0.90659028 -H -0.81010441 -0.46148051 0.44427396 -H 0.39136106 -1.66274618 -1.46771171 -H 1.16668484 -0.06908735 -1.92776126 -H 2.58340476 1.06745445 -0.31262255 -H 2.55143652 0.56892747 1.39502638 -H 3.37185012 -0.43769461 0.19201862 -13 -Properties=species:S:1:pos:R:3 energy=-232.2757058765174 pbc="F F F" -C -0.03345961 1.54674842 -0.13373520 -C -0.04966080 0.05914273 0.10861437 -O 1.17261123 -0.65888877 -0.09925231 -C 0.62653087 -0.62548063 1.22492030 -C 1.43849738 0.05647689 2.29618065 -H 0.84261573 2.02417904 0.30895947 -H -0.02020603 1.75197977 -1.20938503 -H -0.93419215 2.01073729 0.28317577 -H -0.92262410 -0.44789053 -0.31001063 -H 0.19593793 -1.58039168 1.53656778 -H 1.84118250 1.01302927 1.95813013 -H 0.82514514 0.22925358 3.18745348 -H 2.28152757 -0.57796414 2.58961605 diff --git a/examples/train.sh b/examples/train.sh deleted file mode 100644 index e2615eaa6..000000000 --- a/examples/train.sh +++ /dev/null @@ -1,12 +0,0 @@ -metatensor-models train --config-dir=. \ - --config-name=parameters.yaml - -# A model dumps file suffixes `.pt` are written to the output folder for evaluation. The -# architure-specific help page can also be accessed from the cli - -metatensor-models train architecture=soap_bpnn --help - -# This prints the default parameters of the architure. The general Hydra specific help -# can be accessed by - -metatensor-models train --hydra-help diff --git a/examples/usage.sh b/examples/usage.sh new file mode 100644 index 000000000..33fdb4e55 --- /dev/null +++ b/examples/usage.sh @@ -0,0 +1,23 @@ +#!\bin\bash + +metatensor-models train --parameters=parameters.yaml + +# The functions saves the final model `model.pt` to the current output folder for later +# evaluation. All command line flags of the train sub-command can be listed via + +metatensor-models train --help + +# We now evaluate the model on the training dataset + +metatensor-models eval --model=model.pt --structures=qm9_reduced_100.xyz + +# The evaluation command predicts the property the model was trained against; here "U0". +# The predictions together with the structures have been written in a file named +# ``output.xyz`` in the current directory. The written file starts with the following +# lines + +head -n 20 output.xyz + +# All command line flags of the eval sub-command can be listed via + +metatensor-models eval --help diff --git a/src/metatensor/models/__main__.py b/src/metatensor/models/__main__.py index e34e88f9d..7c980816f 100644 --- a/src/metatensor/models/__main__.py +++ b/src/metatensor/models/__main__.py @@ -1,11 +1,13 @@ -"""The main entry point for the metatensor models interface.""" +"""The main entry point for the metatensor-models interface.""" import argparse import sys from pathlib import Path + from . import __version__ from .cli import eval_model, export_model, train_model -from .cli.eval_model import _eval_model_cli -from .cli.train_model import _train_model_cli +from .cli.eval_model import _add_eval_model_parser +from .cli.export_model import _add_export_model_parser +from .cli.train_model import _add_train_model_parser def main(): @@ -23,62 +25,37 @@ def main(): version=f"metatensor-models {__version__}", ) + # Add sub-parsers subparser = ap.add_subparsers(help="sub-command help") - - # Add train sub-parser - train_parser = subparser.add_parser( - "train", - description=train_model.__doc__.split(r"\n:param")[0], - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - ) - train_parser.set_defaults(callable="train_model") - _train_model_cli(train_parser) - - # Add eval sub-parser - evaluate_parser = subparser.add_parser( - "eval", - description=eval_model.__doc__.split(r"\n:param")[0], - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - ) - evaluate_parser.set_defaults(callable="eval_model") - _eval_model_cli(evaluate_parser) - - # Add export sub-parser - export_parser = subparser.add_parser( - "export", - description=export_model.__doc__, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - ) - export_parser.set_defaults(callable="export_model") + _add_eval_model_parser(subparser) + _add_export_model_parser(subparser) + _add_train_model_parser(subparser) args = ap.parse_args() callable = args.__dict__.pop("callable") - # Workaround since we are using hydra for the train parsing - if callable == "train_model": - - # HACK: Hydra directly takes arguments from `sys.argv`. - # We have to overwrite `sys.argv` to be compatible with our CLI architecture + if callable == "eval_model": + eval_model(**args.__dict__) + elif callable == "export_model": + export_model(**args.__dict__) + elif callable == "train_model": + # HACK: Hydra parses command line arguments directlty from `sys.argv`. We + # override `sys.argv` to be compatible with our CLI architecture. argv = sys.argv[:1] parameters_path = Path(args.parameters_path) argv.append(f"--config-dir={parameters_path.parent}") argv.append(f"--config-name={parameters_path.name}") - #argv.append(f"+output_path={args.output_path}") + argv.append(f"+output_path={args.output_path}") if args.hydra_paramters is not None: - argv += args.hydra_paramters + argv += args.hydra_paramters sys.argv = argv - print(sys.argv) train_model() - if callable == "eval_model": - eval_model(**args.__dict__) - elif callable == "export_model": - export_model(**args.__dict__) else: - raise ValueError("internal error when setting up sub-commands.") + raise ValueError("internal error when selecting a sub-command.") if __name__ == "__main__": diff --git a/src/metatensor/models/cli/eval_model.py b/src/metatensor/models/cli/eval_model.py index 1aa32548f..ed61e6922 100644 --- a/src/metatensor/models/cli/eval_model.py +++ b/src/metatensor/models/cli/eval_model.py @@ -4,8 +4,17 @@ from ..utils.data.writers import write_predictions from ..utils.model_io import load_model -def _eval_model_cli(parser: argparse.ArgumentParser) -> None: + +def _add_eval_model_parser(subparser: argparse.ArgumentParser) -> None: """Add the `eval_model` paramaters to an argparse (sub)-parser""" + + parser = subparser.add_parser( + "eval", + description=eval_model.__doc__.split(r"\n:param")[0], + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.set_defaults(callable="eval_model") + parser.add_argument( "-m", "--model", diff --git a/src/metatensor/models/cli/export_model.py b/src/metatensor/models/cli/export_model.py index 2dabddd2d..b2876300d 100644 --- a/src/metatensor/models/cli/export_model.py +++ b/src/metatensor/models/cli/export_model.py @@ -1,3 +1,15 @@ +import argparse + + +def _add_export_model_parser(subparser: argparse.ArgumentParser) -> None: + parser = subparser.add_parser( + "export", + description=export_model.__doc__, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.set_defaults(callable="export_model") + + def export_model(): """export a model""" print("Run exort...") diff --git a/src/metatensor/models/cli/train_model.py b/src/metatensor/models/cli/train_model.py index 12a544608..ea5e75bc3 100644 --- a/src/metatensor/models/cli/train_model.py +++ b/src/metatensor/models/cli/train_model.py @@ -1,33 +1,45 @@ +import argparse import importlib import logging -import argparse from pathlib import Path + import hydra from omegaconf import DictConfig, OmegaConf from metatensor.models.utils.data import Dataset from metatensor.models.utils.data.readers import read_structures, read_targets -from ..utils.model_io import save_model from .. import CONFIG_PATH +from ..utils.model_io import save_model logger = logging.getLogger(__name__) + def _has_yaml_suffix(s: str) -> str: """Checks if a string has a .yaml suffix.""" if Path(s).suffix != ".yaml": raise argparse.ArgumentTypeError( - f"Parameters file '{s}' must be a `.yaml` file.") + f"Parameters file '{s}' must be a `.yaml` file." + ) return s -def _train_model_cli(parser: argparse.ArgumentParser) -> None: + +def _add_train_model_parser(subparser: argparse.ArgumentParser) -> None: """Add basic the `train_model` paramaters to an argparse (sub)-parser. This is just the first layer of arguments. Additional arguments are allowed and will be parsed by the hydra CLI.""" + + parser = subparser.add_parser( + "train", + description=train_model.__doc__.split(r"\n:param")[0], + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) + parser.set_defaults(callable="train_model") + parser.add_argument( "-p", "--parameters", @@ -51,15 +63,28 @@ def _train_model_cli(parser: argparse.ArgumentParser) -> None: dest="hydra_paramters", nargs="+", type=str, - help="Flags for the hydra library", + help="Hydra's command line and override flags.", ) @hydra.main(config_path=str(CONFIG_PATH), config_name="config", version_base=None) def train_model(config: DictConfig) -> None: - """Train a model.""" + """Train an atomistic machine learning model using configurations provided by Hydra. + + This function sets up the dataset and model architecture, then runs the training + process. The dataset is prepared by reading structural data and target values from + specified paths. The model architecture is dynamically imported and instantiated + based on the configuration. Training is executed with the specified hyperparameters, + and the trained model is saved to a designated output path. + + Hydra is used for command-line configuration management, allowing for dynamic + parameter setting at runtime. See + https://hydra.cc/docs/advanced/hydra-command-line-flags/ and + https://hydra.cc/docs/advanced/override_grammar/basic/ for details. - print(config) + :param config: A dictionary-like object obtained from Hydra, containing all the + necessary parameters for dataset preparation, model instantiation, and training. + """ logger.info("Setting up dataset") structures = read_structures(config["dataset"]["structure_path"]) @@ -87,5 +112,4 @@ def train_model(config: DictConfig) -> None: output_dir=output_dir, ) - # Save the model: - save_model(model, "model.pt") + save_model(model, config["output_path"]) diff --git a/src/metatensor/models/soap_bpnn/train.py b/src/metatensor/models/soap_bpnn/train.py index fa0028bfa..3758ba4b6 100644 --- a/src/metatensor/models/soap_bpnn/train.py +++ b/src/metatensor/models/soap_bpnn/train.py @@ -1,9 +1,8 @@ import logging +from pathlib import Path import torch -from pathlib import Path - from ..utils.composition import calculate_composition_weights from ..utils.data import collate_fn from ..utils.model_io import save_model diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index ea4c72b3b..8bab7fb28 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -16,7 +16,7 @@ def test_wrong_module(self): with pytest.raises(subprocess.CalledProcessError): subprocess.check_call(["metatensor-models", "foo"]) - @pytest.mark.parametrize("module", tuple(["eval", "export"])) + @pytest.mark.parametrize("module", tuple(["eval", "export", "train"])) def test_available_modules(self, module): """Test available modules.""" subprocess.check_call(["metatensor-models", module, "--help"]) diff --git a/tests/cli/test_train_model.py b/tests/cli/test_train_model.py index a98e7b7c0..8b078bedb 100644 --- a/tests/cli/test_train_model.py +++ b/tests/cli/test_train_model.py @@ -15,7 +15,6 @@ def test_train(monkeypatch, tmp_path): [ "metatensor-models", "train", - "--config-dir=.", - "--config-name=parameters.yaml", + "--parameters=parameters.yaml", ] ) diff --git a/tox.ini b/tox.ini index 937cf2a6a..e0d634f91 100644 --- a/tox.ini +++ b/tox.ini @@ -88,7 +88,7 @@ allowlist_externals = bash commands = sphinx-build {posargs:-E} -W -b html docs/src docs/build/html - bash -c "set -e && cd {toxinidir}/examples && bash train.sh && bash eval.sh" + bash -c "set -e && cd {toxinidir}/examples && bash usage.sh" [flake8] # longer lines for compatibility with other linters