-
Notifications
You must be signed in to change notification settings - Fork 22
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
Report energy in conformers_before_optimization.txt
#743
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #743 +/- ##
==========================================
+ Coverage 73.80% 73.81% +0.01%
==========================================
Files 99 99
Lines 27352 27356 +4
Branches 5718 5719 +1
==========================================
+ Hits 20187 20193 +6
+ Misses 5738 5737 -1
+ Partials 1427 1426 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thanks! I added some minor comments
arc/plotter.py
Outdated
with open(conf_path, 'w') as f: | ||
content = '' | ||
if optimized: | ||
level_of_theory = level_of_theory.simple() if isinstance(level_of_theory, Level) else level_of_theory | ||
content += f'Conformers for {label}, optimized at the {level_of_theory} level:\n\n' | ||
if before_optimized: | ||
level_of_theory = level_of_theory.simple() if isinstance(level_of_theory, Level) else level_of_theory | ||
content += f'Conformers for {label}, generated from RDKit:\n\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 can pass the string level of theory into this function (e.g., MMFF94s or UFF) and print it here instead of writing RDKit
arc/scheduler.py
Outdated
@@ -1845,6 +1845,8 @@ def process_conformers(self, label): | |||
multiplicity=self.species_dict[label].multiplicity, | |||
charge=self.species_dict[label].charge, | |||
is_ts=False, | |||
energies=self.species_dict[label].conformer_energies, | |||
before_optimized=True, |
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.
Please rename to "before_optimization"
9591699
to
8470e4f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #743 +/- ##
=======================================
Coverage 74.08% 74.09%
=======================================
Files 101 101
Lines 28007 28005 -2
Branches 5860 5860
=======================================
+ Hits 20750 20751 +1
+ Misses 5787 5786 -1
+ Partials 1470 1468 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
8470e4f
to
9106a3c
Compare
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.
Thanks, please see some comments
arc/plotter.py
Outdated
@@ -923,18 +924,21 @@ def save_conformers_file(project_directory: str, | |||
geo_dir = os.path.join(project_directory, 'output', spc_dir, label, 'geometry', 'conformers') | |||
if not os.path.exists(geo_dir): | |||
os.makedirs(geo_dir) | |||
if energies is not None and any(e is not None for e in energies): | |||
if before_optimization or energies is None or not any(e is not None for e in energies): |
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.
We should make the conditions much simpler and differentiate the case simply using the before_optimization
arg instead of looking at the energies. something like:
Also, now we don't need to set optimized
, we can just use before_optimization
.
Can you go over the logic and make this function simpler and robust?
arc/plotter.py
Outdated
@@ -900,6 +900,7 @@ def save_conformers_file(project_directory: str, | |||
ts_methods: Optional[List[str]] = None, | |||
im_freqs: Optional[List[List[float]]] = None, | |||
log_content: bool = False, | |||
before_optimization: Optional[bool] = None, |
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 think this shouldn't be Optional (cannot be None
) because we're always either before or after opt.
We should make sure to send a proper value in all the calls to this functions, including tests
30d4952
to
357696d
Compare
10cd5b8
to
98b443c
Compare
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.
Thanks! Please see two minor comments
@@ -1098,7 +1098,7 @@ def generate_conformers(self, | |||
) | |||
if len(lowest_confs): | |||
self.conformers.extend([conf['xyz'] for conf in lowest_confs]) | |||
self.conformer_energies.extend([None] * len(lowest_confs)) | |||
self.conformer_energies.extend([conf['FF energy'] for conf in lowest_confs]) |
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.
Can you explain what this does?
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.
Lines 1842 to 1851 in 98b443c
plotter.save_conformers_file(project_directory=self.project_directory, | |
label=label, | |
xyzs=self.species_dict[label].conformers, | |
level_of_theory=self.conformer_level, | |
multiplicity=self.species_dict[label].multiplicity, | |
charge=self.species_dict[label].charge, | |
is_ts=False, | |
energies=self.species_dict[label].conformer_energies, | |
before_optimization=True, | |
) # before optimization |
Line 1849 self.species_dict[label].conformer_energies
requires attribute conformer_energies
to be well defined, previous code will lead to a list of None
, rather than the actual values.
98b443c
to
e53ab9e
Compare
Now it decides the condition based on the new var `before_optimization`
e53ab9e
to
e9de000
Compare
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.
Thanks!
The previous
conformers_before_optimization.txt
doesn't include energy information for the conformer before the optimization, so the updated one will include this.