-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feature/relax #451
Feature/relax #451
Conversation
Thanks a lot @moritzgubler, this looks really interesting! I will have a closer look later this week. |
That sounds great @stigrj. |
@moritzgubler I made a pull request on your fork with an updated input parser. |
Hey @stigrj
Is there something I forgot? |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #451 +/- ##
==========================================
- Coverage 71.64% 70.31% -1.33%
==========================================
Files 186 190 +4
Lines 15022 15308 +286
==========================================
+ Hits 10762 10764 +2
- Misses 4260 4544 +284 ☔ View full report in Codecov by Sentry. |
I will try to figure out a smart way to handle the output asap |
Do you have time to look at it soon? |
Vacation time right now in Norway, but I guess Stig will be able to have a look at it once he is back, or at least delegate it to some of us! 😃 |
src/vc_sqnm/mrchem_optimizer.hpp
Outdated
|
||
json results = energyAndForces(mol_inp, scf_inp, energy, forces); | ||
// write progress to stderr for earier debugging. | ||
std::cerr << i << " " << energy << " " << forces.cwiseAbs().maxCoeff() << "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the various printing facilities in MRChem to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really now what to print/ how to format the output. Do you have some printing guidelines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These numbers are quite important to see if the geometry optimization converges. If they would just be printed, it is easy to overlook them because of all the other prints. Do you have an idea on how we could highlight this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a Printer
class that comes from MRCPP, which tries to handle formatting and such.1 You can #include <MRCPP/Printer>
and see here for some usage documentation https://mrcpp.readthedocs.io/en/latest/mrcpp_api/printer.html
I would say that this data should be part of both the JSON and the human-readable output files. When it comes to format for the latter, I don't have any great suggestions to offer, unfortunately. Maybe at the end of each optimization step a summary like printed in Psi4?
==> Convergence Check <==
Measures of convergence in internal coordinates in au.
Criteria marked as inactive (o), active & met (*), and active & unmet ( ).
--------------------------------------------------------------------------------------------- ~
Step Total Energy Delta E MAX Force RMS Force MAX Disp RMS Disp ~
--------------------------------------------------------------------------------------------- ~
Convergence Criteria 1.00e-06 * 3.00e-04 * o 1.20e-03 * o ~
--------------------------------------------------------------------------------------------- ~
1 -74.96466254 -7.50e+01 2.37e-02 1.83e-02 o 1.44e-01 8.71e-02 o ~
---------------------------------------------------------------------------------------------
Footnotes
-
I'm not the expert on this, usually Stig Rune intervenes to cleansup the output... ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @robertodr
Now, all the relevant prints are replaced by the mrchem printing api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and I format an output json that gets written after the simulation. (see changes in mrchem.cpp)
I implemented all your suggestions except for the printing and tested the code. I have a question about the units. The parameters that will be set in my code are in Hartree/ Bohr and my code expects Hartree/ Bohr. Some input parameters would change if the units were angstrom. For example the initial step size. Do you think it makes sense to change them? |
Thank you very much Moritz, especially for your patience! I can have a second review round in the weekend/Monday at the latest.
I'm pretty sure that, at the level where you've interfaced your code, everything is guaranteed to be in atomic units already. |
I see that your branch is outdated with |
The branch is up to date with master again. |
Hi @robertodr |
not converge
@moritzgubler sorry for my ridiculous response time on this. I actually thought there would be much more for me to consider here, but it turns out you have sorted out most things already 🙂 Great work! I think your last suggestion with a separate JSON file for the geometry iterations is quite acceptable, so if you can just make that final change we can get this PR merged. Then the regular JSON output file should contain the original input but the output of the final geometry iteration. In this way the file should be backwards compatible. I have resolved the conflicts in the input parser with a rebase and added some minor changes to the printed output. I pushed the fixes to the |
@stigrj No worries:) I may have an even better idea: I adjust the mrchem output json the way you mentioned to make sure it is backwards compatible. The geometry optimization trajectory is written as a .xyz file. That way it is is easy to visualize the converged geometry. If you also agree with this, I will implement it like that. |
Is there any standardized format for such an xyz-file that other programs use? Will it contain only the molecular geometry? I think it will be good to keep a full record of all the properties (energy contributions, gradients, etc), as is currently done in the non-backward-compatible json we have now, only dump it into a separate file. But if there is a standard xyz-format that allows for immediate visualization of the trajectory, you can of course add that as well 🙂 |
The .xyz format is pretty standardized and supported by standard visualization software. In that case, I will do both the json summary and the xyz output file. |
62b9be3
to
ea8ba9d
Compare
Hi @stigrj |
if (mrcpp::mpi::grand_master()) { | ||
std::ofstream ofs; | ||
ofs.open(jsonOutFileName + "_optimization_summary.json", std::ios::out); | ||
ofs << summary.dump(2) << std::endl; | ||
ofs.close(); | ||
xyzFile.close(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stigrj is this the proper way to only write a file from the master process?
@stigrj I think I adapted all the changes we recently talked about. I want to test one final thing regarding the xyz file output. I will contact you when I think the branch is ready to be merged. |
@stigrj The xyz writer is now also tested well and works. I have done and tested everything I wanted. If you also agree, we can merge it now. |
Great! Going in once the CI checks pass |
This is a draft of a geometry optimization implementation using the SQNM method. Variable cell shape optimization would also possible.
At the moment the geometry optimization input parameters are not parsed. Can someone help me with that?
I changed the main executable to always do a geometry optimization for testing purposes. To test the program, just compile it and run mrchem. A few parameters need to be set manualy:
A tighter orbital_thrs reduces the noise in the forces significantly. The "path_orbitals" and "write_orbitals" need to be set like that because after the first geometry optimization iteration, I recycle the previous wave function as the initial guess for the next scf cycle to speed up convergence.
TODOLIST: