-
Notifications
You must be signed in to change notification settings - Fork 75
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
fix: evaluator unit bug #277
Conversation
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.
Hm, I just tried study 022 and got the attached output. How did you get the reference optimize.out? Maybe you forgot to commit some other changes?
Also, I activated CI on this PR so we can see if I've just messed up my install of this branch. Sorry for the delay on that!
study 022 output
(forcebalance-test) jw@mba$ ForceBalance.py optimize.in
Warning: importing 'simtk.openmm' is deprecated. Import 'openmm' instead.
#======================================================================#
#| Welcome to ForceBalance version 1.9.4! =D |#
#| Force Field Optimization System |#
#| |#
#| Authors: |#
#| Lee-Ping Wang |#
#| Yudong Qiu, Keri A. McKiernan |#
#| Jeffrey R. Wagner, Hyesu Jang, Simon Boothroyd |#
#| Arthur Vigil, Erik G. Brandt, John Stoppelman |#
#| Johnny Israeli, Matt Thompson |#
#======================================================================#
`.:+@@###@'
,;'+###############.
+################':`
`.,,...####+.
,##### +##.
##### ######
###' ####' :#####'
:####@ ####. ,####'
###### #### +###+
##### #### ###;
:## #### ++`
####``..:;+##############+`
.,:;;'++##################################`
`############################++++''';;;;;;;;;;;'';
,########':,.`` ####
####
####
####
####
####
####
####
####
####
####
####
###
+`
Reading options from file: optimize.in
#========================================================#
#| Options at their default values are not printed |#
#| Use 'verbose_options True' to Enable |#
#========================================================#
Reading force field from file: smirnoff99Frosst_experimental.offxml
#=========================================================#
#| Starting parameter indices, physical values and IDs |#
#=========================================================#
0 [ 9.3800e+02 ] : Bonds/Bond/k/[#6X3:1]:[#6X3:2]
1 [ 1.4000e+00 ] : Bonds/Bond/length/[#6X3:1]:[#6X3:2]
2 [ 9.0000e+02 ] : Bonds/Bond/k/[#6X3a:1]-[#8X2H0:2]
3 [ 1.3230e+00 ] : Bonds/Bond/length/[#6X3a:1]-[#8X2H0:2]
4 [ 6.8000e+02 ] : Bonds/Bond/k/[#6X4:1]-[#1:2]
5 [ 1.0900e+00 ] : Bonds/Bond/length/[#6X4:1]-[#1:2]
6 [ 7.3400e+02 ] : Bonds/Bond/k/[#6X3:1]-[#1:2]
7 [ 1.0800e+00 ] : Bonds/Bond/length/[#6X3:1]-[#1:2]
8 [ 1.0950e+02 ] : Angles/Angle/angle/[#1:1]-[#6X4:2]-[#1:3]
9 [ 7.0000e+01 ] : Angles/Angle/k/[#1:1]-[#6X4:2]-[#1:3]
10 [ 1.2000e+02 ] : Angles/Angle/angle/[*:1]~[#6X3:2]~[*:3]
11 [ 1.4000e+02 ] : Angles/Angle/k/[*:1]~[#6X3:2]~[*:3]
12 [ 1.2000e+02 ] : Angles/Angle/angle/[#1:1]-[#6X3:2]~[*:3]
13 [ 1.0000e+02 ] : Angles/Angle/k/[#1:1]-[#6X3:2]~[*:3]
14 [ 1.2000e+02 ] : Angles/Angle/angle/[#6X3,#7:1]~;@[#8;r:2]~;@[#6X3,#7:3]
15 [ 1.4000e+02 ] : Angles/Angle/k/[#6X3,#7:1]~;@[#8;r:2]~;@[#6X3,#7:3]
16 [ 0.0000e+00 ] : ProperTorsions/Proper/k1/[*:1]~[#6X3:2]-[#6X4:3]-[*:4]
17 [ 3.6250e+00 ] : ProperTorsions/Proper/k1/[*:1]~[#6X3:2]:[#6X3:3]~[*:4]
18 [ 2.5000e+00 ] : ProperTorsions/Proper/k1/[*:1]-[#8X2:2]@[#6X3:3]~[*:4]
19 [ 1.4870e+00 ] : vdW/Atom/rmin_half/[#1:1]-[#6X4]
20 [ 1.5700e-02 ] : vdW/Atom/epsilon/[#1:1]-[#6X4]
21 [ 1.4590e+00 ] : vdW/Atom/rmin_half/[#1:1]-[#6X3]
22 [ 1.5000e-02 ] : vdW/Atom/epsilon/[#1:1]-[#6X3]
23 [ 1.9080e+00 ] : vdW/Atom/rmin_half/[#6X4:1]
24 [ 1.0940e-01 ] : vdW/Atom/epsilon/[#6X4:1]
25 [ 1.6837e+00 ] : vdW/Atom/rmin_half/[#8X2H0+0:1]
26 [ 1.7000e-01 ] : vdW/Atom/epsilon/[#8X2H0+0:1]
-----------------------------------------------------------
#=========================================================#
#| Rescaling Factors by Type (Lower Takes Precedence): |#
#=========================================================#
ProperTorsions/Proper/k1 : 3.62500e+00
Bonds/Bond/k : 1.00000e+01
Bonds/Bond/length : 1.00000e-01
Angles/Angle/k : 1.00000e+01
Angles/Angle/angle : 1.00000e+01
ProperTorsions/Proper/k : 1.00000e+01
vdW/Atom/epsilon : 1.00000e-01
vdW/Atom/rmin_half : 1.00000e-01
-----------------------------------------------------------
#========================================================#
#| Rescaling Types / Factors by Parameter Number: |#
#========================================================#
0 [ Bonds/Bond/k : 1.00000e+01 ] : Bonds/Bond/k/[#6X3:1]:[#6X3:2]
1 [ Bonds/Bond/length : 1.00000e-01 ] : Bonds/Bond/length/[#6X3:1]:[#6X3:2]
2 [ Bonds/Bond/k : 1.00000e+01 ] : Bonds/Bond/k/[#6X3a:1]-[#8X2H0:2]
3 [ Bonds/Bond/length : 1.00000e-01 ] : Bonds/Bond/length/[#6X3a:1]-[#8X2H0:2]
4 [ Bonds/Bond/k : 1.00000e+01 ] : Bonds/Bond/k/[#6X4:1]-[#1:2]
5 [ Bonds/Bond/length : 1.00000e-01 ] : Bonds/Bond/length/[#6X4:1]-[#1:2]
6 [ Bonds/Bond/k : 1.00000e+01 ] : Bonds/Bond/k/[#6X3:1]-[#1:2]
7 [ Bonds/Bond/length : 1.00000e-01 ] : Bonds/Bond/length/[#6X3:1]-[#1:2]
8 [ Angles/Angle/angle : 1.00000e+01 ] : Angles/Angle/angle/[#1:1]-[#6X4:2]-[#1:3]
9 [ Angles/Angle/k : 1.00000e+01 ] : Angles/Angle/k/[#1:1]-[#6X4:2]-[#1:3]
10 [ Angles/Angle/angle : 1.00000e+01 ] : Angles/Angle/angle/[*:1]~[#6X3:2]~[*:3]
11 [ Angles/Angle/k : 1.00000e+01 ] : Angles/Angle/k/[*:1]~[#6X3:2]~[*:3]
12 [ Angles/Angle/angle : 1.00000e+01 ] : Angles/Angle/angle/[#1:1]-[#6X3:2]~[*:3]
13 [ Angles/Angle/k : 1.00000e+01 ] : Angles/Angle/k/[#1:1]-[#6X3:2]~[*:3]
14 [ Angles/Angle/angle : 1.00000e+01 ] : Angles/Angle/angle/[#6X3,#7:1]~;@[#8;r:2]~;@[#6X3,#7:3]
15 [ Angles/Angle/k : 1.00000e+01 ] : Angles/Angle/k/[#6X3,#7:1]~;@[#8;r:2]~;@[#6X3,#7:3]
16 [ ProperTorsions/Proper/k : 1.00000e+01 ] : ProperTorsions/Proper/k1/[*:1]~[#6X3:2]-[#6X4:3]-[*:4]
17 [ ProperTorsions/Proper/k : 1.00000e+01 ] : ProperTorsions/Proper/k1/[*:1]~[#6X3:2]:[#6X3:3]~[*:4]
18 [ ProperTorsions/Proper/k : 1.00000e+01 ] : ProperTorsions/Proper/k1/[*:1]-[#8X2:2]@[#6X3:3]~[*:4]
19 [ vdW/Atom/rmin_half : 1.00000e-01 ] : vdW/Atom/rmin_half/[#1:1]-[#6X4]
20 [ vdW/Atom/epsilon : 1.00000e-01 ] : vdW/Atom/epsilon/[#1:1]-[#6X4]
21 [ vdW/Atom/rmin_half : 1.00000e-01 ] : vdW/Atom/rmin_half/[#1:1]-[#6X3]
22 [ vdW/Atom/epsilon : 1.00000e-01 ] : vdW/Atom/epsilon/[#1:1]-[#6X3]
23 [ vdW/Atom/rmin_half : 1.00000e-01 ] : vdW/Atom/rmin_half/[#6X4:1]
24 [ vdW/Atom/epsilon : 1.00000e-01 ] : vdW/Atom/epsilon/[#6X4:1]
25 [ vdW/Atom/rmin_half : 1.00000e-01 ] : vdW/Atom/rmin_half/[#8X2H0+0:1]
26 [ vdW/Atom/epsilon : 1.00000e-01 ] : vdW/Atom/epsilon/[#8X2H0+0:1]
----------------------------------------------------------
#========================================================#
#| Setup for force field |#
#========================================================#
fnms ['smirnoff99Frosst_experimental.offxml']
priors OrderedDict([('Bonds/Bond/k', 10.0), ('Bonds/Bond/length', 0.1), ('Angles/Angle/k', 10.0), ('Angles/Angle/angle', 10.0), ('ProperTorsions/Proper/k', 10.0), ('vdW/Atom/epsilon', 0.1), ('vdW/Atom/rmin_half', 0.1)])
----------------------------------------------------------
Backing up: optimize.tmp/optgeo to: optimize.bak/optgeo_2.tar.bz2
Reading optgeo options from file: targets/optgeo/optgeo_options.txt
/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/openff/interchange/components/interchange.py:339: UserWarning: Automatically up-converting BondHandler from version 0.3 to 0.4. Consider manually upgrading this BondHandler (or <Bonds> section in an OFFXML file) to 0.4 or newer. For more details, see https://openforcefield.github.io/standards/standards/smirnoff/#bonds.
warnings.warn(
Traceback (most recent call last):
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/EGG-INFO/scripts/ForceBalance.py", line 41, in Run_ForceBalance
objective = Objective(options, tgt_opts, forcefield)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/objective.py", line 182, in __init__
else: Tgt = Implemented_Targets[opts['type']](options,opts,forcefield)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/smirnoffio.py", line 686, in __init__
super(OptGeoTarget_SMIRNOFF,self).__init__(options,tgt_opts,forcefield)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/opt_geo_target.py", line 79, in __init__
self.create_engines(engine_args)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/smirnoffio.py", line 705, in create_engines
self.engines[sysname] = self.engine_(target=self, mol=M, name=sysname, pdb=pdbpath, mol2=mol2path, **engine_args)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/smirnoffio.py", line 265, in __init__
super(SMIRNOFF,self).__init__(name=name, **kwargs)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/openmmio.py", line 626, in __init__
super(OpenMM,self).__init__(name=name, **kwargs)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/engine.py", line 80, in __init__
self.prepare(**kwargs)
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/forcebalance-1.9.4-py3.9-macosx-10.9-x86_64.egg/forcebalance/smirnoffio.py", line 443, in prepare
self.xyz_omms.append((positions, box))
File "/Users/jeffreywagner/conda/envs/forcebalance-test/lib/python3.9/site-packages/openmm/unit/quantity.py", line 773, in append
raise TypeError("Cannot append item without units into list with units")
TypeError: Cannot append item without units into list with units
I didn't have time to dive deep into this bug so I didn't try study022. I tried the tutorial04 in openff-evaluator and that scripts runs without raising error but the result is not fully correct. according to
Originally posted by @mattwthompson in openforcefield/openff-evaluator#482 (comment) There are probably many more fixes necessary to make forcebalance work properly with evaluator 0.4.1 and openff-toolkit 0.11.* |
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 @wenyan4work - It took me a while but I got this test running on my dinky laptop [1]. I reproduced the error in #276 and verified that this PR fixes it. Thanks for your patience!
[1] The key to getting this running in a reasonable amount of time on a GPU-less computer is to turn steps_per_iteration
in these lines down to something like 5000. Since this is just a technical error instead of a numerical issue, I think this is sufficient to say I reproduced the bug and this patch fixes it.
Thank you! I'll merge this now, so that we have it for ForceBalance v1.9.5. |
the unit system of openff-evaluator 0.3.9 has been changed to openff-units based on pint. So this simple fix is necessary.
Tested to work on openff-evaluator 0.4.1 / tutorial04
this PR fixes #276