Skip to content

Commit

Permalink
Update gmso_equation_compare.py
Browse files Browse the repository at this point in the history
Changed back to only OPLS dihedral using sympy.nsimplify as it is less efficient than symengine.sympify, and the only way to get the non-integer valuse for OPLS working
  • Loading branch information
bc118 authored Jul 17, 2024
1 parent b40b737 commit a9685d0
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions mosdef_gomc/utils/gmso_equation_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
# import signac
import xml.etree.ElementTree as ET

import symengine
import sympy
import unyt as u

# Although,'symengine.sympify' from 'import symengine ' is faster, it was changed to 'sympy.nsimplify' as it changes
# Although,'symengine.sympify' from 'import symengine ' is faster, it was changed to 'sympy.nsimplify' for some
# with the 0.5 decimals in it like as it changes
# improves the solving of the code by also solving 0.5 or other non-integers with integers.


Expand Down Expand Up @@ -46,7 +48,8 @@ def evaluate_nonbonded_lj_format_with_scaler(new_lj_form, base_lj_form):
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_lj_form) / sympy.nsimplify(base_lj_form),
- symengine.sympify(new_lj_form)
/ symengine.sympify(base_lj_form),
Rmin - sigma * two ** (1 / 6),
two - 2,
],
Expand Down Expand Up @@ -97,8 +100,8 @@ def evaluate_nonbonded_mie_format_with_scaler(new_mie_form, base_mie_form):
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_mie_form)
/ sympy.nsimplify(base_mie_form),
- symengine.sympify(new_mie_form)
/ symengine.sympify(base_mie_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -148,8 +151,8 @@ def evaluate_nonbonded_exp6_format_with_scaler(new_exp6_form, base_exp6_form):
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_exp6_form)
/ sympy.nsimplify(base_exp6_form),
- symengine.sympify(new_exp6_form)
/ symengine.sympify(base_exp6_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -367,8 +370,8 @@ def evaluate_harmonic_bond_format_with_scaler(new_bond_form, base_bond_form):
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_bond_form)
/ sympy.nsimplify(base_bond_form),
- symengine.sympify(new_bond_form)
/ symengine.sympify(base_bond_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -414,8 +417,8 @@ def evaluate_harmonic_angle_format_with_scaler(new_angle_form, base_angle_form):
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_angle_form)
/ sympy.nsimplify(base_angle_form),
- symengine.sympify(new_angle_form)
/ symengine.sympify(base_angle_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -461,8 +464,8 @@ def evaluate_harmonic_torsion_format_with_scaler(
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_torsion_form)
/ sympy.nsimplify(base_torsion_form),
- symengine.sympify(new_torsion_form)
/ symengine.sympify(base_torsion_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -557,8 +560,8 @@ def evaluate_periodic_torsion_format_with_scaler(
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_torsion_form)
/ sympy.nsimplify(base_torsion_form),
- symengine.sympify(new_torsion_form)
/ symengine.sympify(base_torsion_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -604,8 +607,8 @@ def evaluate_RB_torsion_format_with_scaler(new_torsion_form, base_torsion_form):
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_torsion_form)
/ sympy.nsimplify(base_torsion_form),
- symengine.sympify(new_torsion_form)
/ symengine.sympify(base_torsion_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -651,8 +654,8 @@ def evaluate_harmonic_improper_format_with_scaler(
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_improper_form)
/ sympy.nsimplify(base_improper_form),
- symengine.sympify(new_improper_form)
/ symengine.sympify(base_improper_form),
],
[eqn_ratio],
)
Expand Down Expand Up @@ -698,8 +701,8 @@ def evaluate_periodic_improper_format_with_scaler(
values = sympy.nonlinsolve(
[
eqn_ratio
- sympy.nsimplify(new_improper_form)
/ sympy.nsimplify(base_improper_form),
- symengine.sympify(new_improper_form)
/ symengine.sympify(base_improper_form),
],
[eqn_ratio],
)
Expand Down

0 comments on commit a9685d0

Please sign in to comment.