Replies: 7 comments 16 replies
-
Hi @mariummou , Thank you for your interest in NequIP! I managed to create a fresh conda environment with Python 3.11,
I think the crucial difference may be how the dataset is specified in the config - the following worked for me
Note the
Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hello,
If you used all the data for training and validation, you should generate data for testing.
You can modify the script accordingly. Assuming you have external testing data DFT.xyz, and you want to use the model to predict the energyiesforces/stress
Add the following to examples/parity_plot.py
calc = NequIPCalculator.from_deployed_model(model_path=model_path,species_to_type_name = {"H":"H", ...})
for frame in ase.io.iread(args.xyzoutput):
true_forces.append(frame.get_forces().flatten())
true_energies.append(frame.get_potential_energy())
true_stress.append(frame.get_stress().flatten())
frame.calc = calc
forces.append(frame.get_forces().flatten())
energies.append(frame.get_potential_energy())
stress.append(frame.get_stress().flatten())
natoms.append(len(frame))
And run the script under the nequip environment:
python parity_plot.py --output test.png /yourpath/DFT.xyz
Hope these help!
…________________________________
From: Mou ***@***.***>
Sent: Tuesday, July 23, 2024 10:59 AM
To: mir-group/nequip ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [mir-group/nequip] extxyz file with different atom numbers (Discussion #451)
Thank you. So nequip-evaluate not going to work if I use all the data for training and validation: I used this command>nequip-evaluate --train-dir results/BaO/BaO_17K/ --output out.xyz --output-fields-from-original-dataset total_energy,forces and got this output :Loading original dataset...
Loaded dataset specified in config.yaml.
Using origial training dataset (17745 frames) minus training (15000 frames) and validation frames (2745 frames), yielding a test set size of 0 frames.
Starting...
0it [00:00, ?it/s]
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mir-2Dgroup_nequip_discussions_451-23discussioncomment-2D10127903&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=JDarp8V81-EqwA6m4qZl1Wg5jeWKg3tkM9IR1tnlo0Vj7EEM-jA1jaJ6pUbEZEWD&s=97ANaK5qQ8E14Fy61MBJqNxbyucAuGsOfdHr0HzIx0M&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AGFWNPW4R6XLOCXWP6YGPATZNZVUBAVCNFSM6AAAAABLBWWM32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJSG44TAMY&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=JDarp8V81-EqwA6m4qZl1Wg5jeWKg3tkM9IR1tnlo0Vj7EEM-jA1jaJ6pUbEZEWD&s=Q1q4AS1c6U5_8-CY_8y4gBlCsxWOG353gLExomjLqp8&e=>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello,
You didn’t specify the model file. The model_path is the path to your potential .pth. The path in my previous email is the path for your testing data.
The command should be:
python parity_plot.py —output test.png —model_path /path_of_nequip_model/model.pth /path_to_data/out.xyz
On Jul 29, 2024, at 7:08 PM, Mou ***@***.***> wrote:
how to do the parity.py? python parity_plot.py --output test.png --model_path results/BaO/BaO_17K_trial/ out.xyz
if I do this, I get this error: Matplotlib created a temporary cache directory at /share/dwb/mmou/tmp/matplotlib-_szujmn0 because the default path (/home/mmou/.cache/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/scripts/deploy.py", line 105, in load_deployed_model
model = torch.jit.load(model_path, map_location=device, _extra_files=metadata)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/torch/jit/_serialization.py", line 158, in load
cpp_module = torch._C.import_ir_module(cu, os.fspath(f), map_location, _extra_files, _restore_shapes) # type: ignore[call-arg]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: PytorchStreamReader failed locating file constants.pkl: file not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_common/share02/dwb/mmou/nequip/trial3/4/parity_plot.py", line 20, in
calc = NequIPCalculator.from_deployed_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/ase/nequip_calculator.py", line 62, in from_deployed_model
model, metadata = nequip.scripts.deploy.load_deployed_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/scripts/deploy.py", line 107, in load_deployed_model
raise ValueError(
ValueError: results/BaO/BaO_17K_trial/best_model.pth does not seem to be a deployed NequIP model file. Did you forget to deploy it using nequip-deploy?
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mir-2Dgroup_nequip_discussions_451-23discussioncomment-2D10184592&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=O0yGcu_RgYxpHf8sJiuUnLvLOgnjLSUeTlufc3mPN4kt5VArBVThVTbK_7d7MR0B&s=r4mRfT5Obwjc98Kta6Z-qMlUY4jQwYobiZXqFipS_A8&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AGFWNPWXXF2VOUJWUQOMVATZO3DQHAVCNFSM6AAAAABLBWWM32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJYGQ2TSMQ&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=O0yGcu_RgYxpHf8sJiuUnLvLOgnjLSUeTlufc3mPN4kt5VArBVThVTbK_7d7MR0B&s=I21AD2k22kjnTACgv-TVZcamMcbuPfPpqDGApz1Ku-E&e=>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm not sure what you did exactly. Here're two scenarios:
1.
If you didn't use all data for training and validation, the unused frames will be the testing set. nequip-evaluate generates out.xyz for you, and the original file in examples/parity_plot.py should work. In this case, the out.xyz contains tags like original_dataset_stress. Please check nequip-evaluate --help
2.
If you used all data for training and validation, you need to generate additional testing data (e.g. from DFT) and use NequIPCalculator to recalculate the energies/forces/stress as discussed earlier.
Please check your testing data for the exact tags and determine whether you need to calculate the properties with nequip model, or you can read them directly from the .xyz files.
…________________________________
From: Mou ***@***.***>
Sent: Tuesday, July 30, 2024 11:27 AM
To: mir-group/nequip ***@***.***>
Cc: Ding, Jingxuan ***@***.***>; Comment ***@***.***>
Subject: Re: [mir-group/nequip] extxyz file with different atom numbers (Discussion #451)
Hello, I have found out the problem is that I did not deploy the pth. That's why it's not working. I also see the out,xyz files have tags like original_dataset_stress and maybe that's not why the parity.py not working.the error I was getting error. Have you faced this before? do you change parity script for this? Thank You
ase.calculators.calculator.PropertyNotImplementedError: The property "stress" is not available.
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mir-2Dgroup_nequip_discussions_451-23discussioncomment-2D10192237&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=O21DB18JolXjwA-7RX3yD031iLe81t4a89j3oNEVLwxLl6rhrXOyVpVakFX5ps9j&s=eeCKA5Vvl8cWuF9JKzCpBLT-_s6TM5kNCBzejwaVgE4&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AGFWNPRQNUVR6NTY7GQCHVTZO6WFNAVCNFSM6AAAAABLBWWM32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJZGIZDGNY&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=O21DB18JolXjwA-7RX3yD031iLe81t4a89j3oNEVLwxLl6rhrXOyVpVakFX5ps9j&s=NWovgyW2jQ7z3YLsTLjrpRq0Qp-wFG-OVDeqkZCzTa0&e=>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
nequip-evaluate should give you the error estimation printed at the end. It generates out.xyz if you add the tags. You can get the data and plot with scripts e.g. parity.py.
https://github.com/mir-group/nequip
[cid:7bae4838-3284-41c9-8dd7-94ff068e6dda]
…________________________________
From: Mou ***@***.***>
Sent: Tuesday, July 30, 2024 1:56 PM
To: mir-group/nequip ***@***.***>
Cc: Ding, Jingxuan ***@***.***>; Comment ***@***.***>
Subject: Re: [mir-group/nequip] extxyz file with different atom numbers (Discussion #451)
Thank You, I have a question regarding nequip-evaluate. nequip-evaluate --train-dir results/BaO/BaO_17K/ --output out.xyz --output-fields-from-original-dataset total_energy,forces by doing this, am I just making xyz file that was not included in training and validation set? so this xyz is my dft input result and if I use it in parity.py where the model result or y coming from if I am just doing python x.py --output test.png out.xyz
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mir-2Dgroup_nequip_discussions_451-23discussioncomment-2D10193558&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=NoOyXZDSp1PiwMm3Za6KEKTGKa9eQfBMuQWCq0vna4-7QkQcFpyFyLYbddtPqEwk&s=A0PKjcekk4vsPMAz7z-8tztOcQ0ou7CxPUyuVI8iL34&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AGFWNPV67MS4QGA57ZJOD4LZO7HTXAVCNFSM6AAAAABLBWWM32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJZGM2TKOA&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=NoOyXZDSp1PiwMm3Za6KEKTGKa9eQfBMuQWCq0vna4-7QkQcFpyFyLYbddtPqEwk&s=0lquTc4WE0jDGM46YCGj6U0fttUqJHo7YuOqY9rvK84&e=>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello,
It is explained in the document I shared:
(nequip-evaluate) "will evaluate the original training error metrics over any part of the original dataset not used in the training or validation sets."
*
True data comes from you. Please compare the values with your input dataset.
*
Model data is the prediction from the model of those frames.
*
out.xyz stores the information.
…________________________________
From: Mou ***@***.***>
Sent: Tuesday, July 30, 2024 4:37 PM
To: mir-group/nequip ***@***.***>
Cc: Ding, Jingxuan ***@***.***>; Comment ***@***.***>
Subject: Re: [mir-group/nequip] extxyz file with different atom numbers (Discussion #451)
okay, sorry I was not clear in my question. the out.xyz that comes from evaluate code what is it actually? and in parity py I get model data and true data. is the true data coming from out.xyz?
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mir-2Dgroup_nequip_discussions_451-23discussioncomment-2D10194634&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=zAtgFYhVI6iBCBqfSh0E-fYlKiE55Sjlk94o3tcjnKUDkr2i9POF0Wsne_5oVo4v&s=kz3xVmsTCusHbmq1Ro3ZkCZiW-TldIdzWBHZdcA68sI&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AGFWNPWRQEIZXLJBMMHWGXLZO72RNAVCNFSM6AAAAABLBWWM32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJZGQ3DGNA&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=zIC86DlCRZRdnPEXZoQz1HUxhtqrzLtsKP6l6QgWy5E&m=zAtgFYhVI6iBCBqfSh0E-fYlKiE55Sjlk94o3tcjnKUDkr2i9POF0Wsne_5oVo4v&s=v27gD7AOFoDDR1KGgeG7Cfp55d3DV4MAH-P2t1Z7PSs&e=>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hello, I have been trying to train data set with different number of atoms. they are converted into extxyz from OUTCARs. I am getting this error: _ValueError: Found a None in the provided data objects for batching in key stress
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/usrapps/dwb/mmou/nequip/bin/nequip-train", line 8, in
sys.exit(main())
^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/scripts/train.py", line 83, in main
trainer = fresh_start(config)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/scripts/train.py", line 196, in fresh_start
dataset = dataset_from_config(config, prefix="dataset")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/data/build.py", line 78, in dataset_from_config
instance, _ = instantiate(
^^^^^^^^^^^^
File "/usr/local/usrapps/dwb/mmou/nequip/lib/python3.12/site-packages/nequip/utils/auto_init.py", line 245, in instantiate
raise RuntimeError(
RuntimeError: Failed to build object with prefix dataset using builder ASEDataset
do I need to have some number of atoms? Or i am missing something. any suggestion would be helpful. I have added different key mapping but they did not work. thanks. The extxyz file look like this:
16
Lattice="5.885510724 1.04413177 -0.0 -5.655489276 7.707331227 -0.0 3.616978552 -2.08826354 6.687" Properties=species:S:1:pos:R:3:forces:R:3 stress="-0.40495150258530094 -0.0849967963781687 0.25249470922750344 -0.0849967963781687 -0.07775347510550817 -0.04172617995550269 0.25249470922750344 -0.04172617995550269 -0.6266741737241558" free_energy=-31.96450481 energy=-31.96450481 pbc="T T T"
Ba 0.17788000 2.18233000 1.78950000 -16.02805800 -6.67820100 -2.24668400
Ba 3.96259000 -0.11121000 4.62618000 -28.80804900 -6.75819600 103.44914800
Ba 2.42760000 2.92590000 1.60337000 22.74640400 1.90358100 -12.37054700
Ba 6.99133000 0.41177000 5.36172000 0.26549100 0.19799200 4.10083600
Ba -2.76777000 6.35008000 2.04950000 16.59548700 -3.29609200 -21.52321000
Ba 0.69294000 4.24383000 4.59197000 1.00105800 10.97409700 8.55905900
Ba 0.27908000 6.64526000 2.05330000 -1.44788000 -2.98929100 -6.13623100
Ba 4.96556000 3.58873000 5.49907000 -9.06335500 -5.92535200 3.39656300
O -1.78539000 5.63328000 6.33713000 -1.38418800 -1.43969000 0.23882500
O 1.92996000 7.50440000 3.24840000 -15.10262300 1.74603900 16.21832800
O 2.44378000 0.78064000 0.36853000 0.83658500 -0.23813500 0.38009400
O 4.33562000 -0.00148000 3.34275000 29.34903200 11.20015800 -98.45349900
O 0.99341000 1.77721000 6.50654000 -1.41883800 -0.99794000 0.18077800
O 4.19455000 3.77646000 3.12181000 1.28321800 0.38678900 0.67891900
O 3.04308000 2.30169000 6.49414000 2.73527400 0.23960000 0.96836800
O 1.56992000 3.58274000 3.09565000 -1.55955900 1.67463900 2.55925300
4
Lattice="4.76411 0.0 0.988552825 0.0 4.76411 0.0 0.819614625 0.0 3.94995" Properties=species:S:1:pos:R:3:forces:R:3 stress="-0.12453601395105318 -0.0 0.05932598114715919 -0.0 -0.052608794127774104 -0.0 0.05932598114715919 -0.0 -0.022565889135211126" free_energy=-21.92976455 energy=-21.92976455 pbc="T T T"
Ba 0.22257000 2.38205000 1.07265000 -2.67711200 0.00000000 0.81685100
Ba 2.97910000 0.00000000 3.37158000 2.67711200 0.00000000 -0.81685100
O 0.00000000 0.00000000 0.00000000 -1.86397300 0.00000000 0.30610300
O 2.38205000 2.38205000 0.49428000 1.86397300 -0.00000000 -0.30610300
2
Lattice="3.28 0.0 0.0 0.0 3.28 0.0 0.0 0.0 3.28" Properties=species:S:1:pos:R:3:forces:R:3 stress="-0.0504758769726769 -0.00039203542970585325 4.173073001565547e-05 -0.00039203542970585325 -0.05065688697883664 0.00012896206155899988 4.173073001565547e-05 0.00012896206155899988 -0.0504665958486067" free_energy=-11.04616834 energy=-11.04616834 pbc="T T T"
Ba 0.05105000 3.25515000 0.04447000 0.01003200 0.03107700 -0.00326700
O 1.71446000 1.68851000 1.67685000 -0.01003200 -0.03107700 0.00326700. the config file is attached.
config.txt
Beta Was this translation helpful? Give feedback.
All reactions