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

list of quantities vs. quantity with list as value #103

Open
cwalker7 opened this issue Dec 2, 2020 · 0 comments
Open

list of quantities vs. quantity with list as value #103

cwalker7 opened this issue Dec 2, 2020 · 0 comments
Labels
Discussion A topic to be discussed

Comments

@cwalker7
Copy link
Contributor

cwalker7 commented Dec 2, 2020

There are two ways of making lists with simtk units, which can cause issues when getting their values if we don't use some standard convention throughout cg_openmm.

  1. a list of quantities
[0*unit.degrees, 180*unit.degrees]
[Quantity(value=0, unit=degree), Quantity(value=180, unit=degree)]
  1. a quantity whose value is a list
[0,180]*unit.degrees
Quantity(value=[0, 180], unit=degree)

Indexing works the same way for both methods.
However, we can't apply value_in_unit(unit.degrees) to the first case. We can apply it only to the second case.

I came up with some logic in cg_build.add_force (see #102 ) to handle both types of lists, but it seems like this is an issue that comes up in many other places (especially the free energy / entropy / enthalpy code)

@cwalker7 cwalker7 added the Discussion A topic to be discussed label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion A topic to be discussed
Projects
None yet
Development

No branches or pull requests

1 participant