Batched workflows for TorchSim#1505
Conversation
|
@akwarii Please note that the elastic workflow depends a lot on the symmetry of the optimization step. If you can enforce symmtry there, it might stabilize the results. At least, this was true for our other force field implementations |
|
Yes I saw the issue discussing about this. Next week I plan to try to enforce the symmetry using torchsim |
|
@akwarii Yep, exactly. The phonon workflow is more robust in this regard. I am fine with you updating the other optimizer as long as it is not a breaking change. |
|
Note: When using the test mace model ( Energies:
Elastic constants
@JaGeo any idea about what can be the problem here? |
|
Is there maybe still a problem with the equillibrium structure? Have you compared the optimized structures? i am not familiar with the optimization in torchsim |
|
Good call! The lattice parameters are changing a lot when using the test model with the ASE backend. The bigger mace problem doesn't have this problem. This seems weird to me since both backend are using the same algorithm to relax the box, ie Frechet cell filter Original cell TorchSim (test model) ASE (test model) TorchSim (mace medium) ASE (mace medium) |
|
Different floating point precision or stopping criterion? |
|
In both tests I have set |
|
Any other specifics of the optimizer? Do they differ in some way? Potentially, the small test mace model has Additional local minima that one algorithm falls into, the other one mot. |
|
I was unable to find any differences between the two after investigating the classes / functions signatures. I also tried to bump TS to a newer commit since they had an issue with constrained optimization (TorchSim/torch-sim#552) but it didn't change the results. As you pointed out, the small model probably has more minima and might get stuck into one due to small implementation differences. However, I also ran TorchSim's If we want to merge I can update the TS test values to make them pass (since real production models still give the same results), but I think we still need to see this issue through to the end. |
|
Thanks. It might be an option to ask the TorchSim developers for help. After all, it should be in their interest to get the same results or at least have an explanation for the differences. |
|
side note: i just saw that my modifications from #1504 are also included here but in any case it should be ready |
|
Thanks! i will take a look until beginning of next week! |
| assert task_doc.output.stress is not None | ||
| assert len(task_doc.output.stress) == 2 | ||
| # Each stress should be a 3x3 matrix | ||
| for stress in task_doc.output.stress: |
There was a problem hiding this comment.
Does it make sense to test at least one numerical value herw?
|
I think I have one real comment: to check one of the computed results at least to spot drastic implementation changes etc. Beyond this, I am happy! |
|
I completely agree, I will add the check. Also, it seems like the problem with the elastic test was due to an overlook from my side: in TS, enabling a cell filter doesn't mean by default that the cell forces are used in the convergence check (see TorchSim/torch-sim#582). |
|
Ah! That's great to know! |
|
One more point: do you think the current documentation is sufficient? maybe you can use an llm and one of your tests to provide more info on the socket implementations with torchsim? |
|
I can extend a bit the docstring explanation and add examples to the torchsim tutorial notebook, would that be alright? |
|
Yes! Absolutely! |
|
Thanks! Do you want to add yourself to the list of contributors? And, is #1504 still needed? |
|
#1504 was superseded by this PR so it can be closed without problem. As for the list of contributors, i will gladly be part of it. |
|
I will close the other PR. Please raise a short PR to add your details 😃 |
Summary
Include a summary of major changes in bullet points:
Note that batching can be disabled by setting
socket=False. Also, I didn't perform any benchmark (yet) to get an idea of the performance improvement introduced by this PR.Additional dependencies introduced (if any)
I don't expect to introduce new dependencies in this PR
TODO (if any)
If this is a work-in-progress, write something about what else needs to be done.
forcefieldstest)Not sure if I will implement the others workflows for the moment as I don't really need them for my work but if someone is interested feel free to get in touch or to contribute to this PR.
Checklist
Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.
Before a pull request can be merged, the following items must be checked:
The easiest way to handle this is to run the following in the correct sequence on
your local machine. Start with running
ruffandruff formaton your new code. This willautomatically reformat your code to PEP8 conventions and fix many linting issues.
Run ruff on your code.
type check your code.
Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit installand a check will be run prior to allowing commits.