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

has attribute 'in_units_of' #2

Open
Dariuscty opened this issue Nov 16, 2023 · 3 comments
Open

has attribute 'in_units_of' #2

Dariuscty opened this issue Nov 16, 2023 · 3 comments

Comments

@Dariuscty
Copy link

Hello, I prepare the environment as envs/environment-0.3.0-v3.yaml, but I meet the problem as
微信截图_20231116095703

how can I deal with it?

@ijpulidos
Copy link

Hi, thanks for the feedback.

When is this happening exactly? Can you share the code that is causing this to happen?

That said, we should probably update the environment file since there has been some new releases for the dependencies that should be reflected in this file.

@Dariuscty
Copy link
Author

in this two line code
ligand_positions = ligand_positions.in_units_of(unit.nanometers)
complex_positions = unit.Quantity(np.zeros([n_atoms_total, 3]), unit=unit.nanometers)

@ijpulidos
Copy link

I see, this probably comes from a difference between versions of the openff-toolkit. Basically, before version 0.11 the conformers would be of type openmm.unit.quantity.Quantity, but since version 0.11 the conformers are of type openff.units.units.Quantity.

The scripts in this repo expect an older (and now unsupported) version of the toolkit, which is 0.10.6. We should probably adapt the scripts here to be able to use the recent and supported versions of the toolkit.

As a workaround for the snippet of code you shared you could do something like the following

ligand_positions = ligand_positions.to_openmm().in_units_of(unit.nanometers)
complex_positions = unit.Quantity(np.zeros([n_atoms_total, 3]), unit=unit.nanometers)

which is just adding to_openmm to pass from the openff units to openmm units. And the rest of the code should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants