Skip to content
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

Merged
merged 5 commits into from
Sep 9, 2024
Merged

Conversation

JintaoWu98
Copy link
Member

The previous conformers_before_optimization.txt doesn't include energy information for the conformer before the optimization, so the updated one will include this.

arc/plotter.py Fixed Show resolved Hide resolved
Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.81%. Comparing base (3631196) to head (9591699).

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     
Flag Coverage Δ
unittests 73.81% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alongd alongd left a 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 Fixed Show resolved Hide resolved
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'
Copy link
Member

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,
Copy link
Member

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"

@JintaoWu98 JintaoWu98 force-pushed the conf_before_opt branch 2 times, most recently from 9591699 to 8470e4f Compare May 24, 2024 01:13
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.09%. Comparing base (5a82b3c) to head (e9de000).
Report is 6 commits behind head on main.

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     
Flag Coverage Δ
unittests 74.09% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alongd alongd left a 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 Show resolved Hide resolved
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):
Copy link
Member

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,
Copy link
Member

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

Copy link
Member

@alongd alongd left a 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

arc/scheduler.py Show resolved Hide resolved
@@ -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])
Copy link
Member

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?

Copy link
Member Author

@JintaoWu98 JintaoWu98 May 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARC/arc/scheduler.py

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.

Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alongd alongd merged commit fb16f4a into main Sep 9, 2024
7 checks passed
@alongd alongd deleted the conf_before_opt branch September 9, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants