Closed Lactoria-cornuta closed 4 months ago
Could you please try recreating your conda environment? The API for sire-emle is currently unstable so this function is only available in our most recent conda build, i.e. either of those available here.
I've just created the environment myself and see:
In [1]: import sire as sr
In [2]: help(sr.qm.zero_charge)
Help on function _zero_charge in module sire.qm._utils:
_zero_charge(mols, qm_atoms, map=None)
Zero the charge for the QM atoms in the system.
Parameters
----------
mols : sire.system.System
The molecular system.
qm_atoms : str, int, list, molecule view/collection etc.
Any valid search string, atom index, list of atom indicies,
or molecule view/container that can be used to select
qm_atoms from 'mols'.
Returns
-------
mols : sire.system.System
The molecular system with the QM atom charges zeroed.
In [3]: help(sr.legacy.Convert._SireOpenMM.EMLEEngine.get_forces)
Help on function _get_openmm_forces in module sire.qm._emle:
_get_openmm_forces(self)
Get the OpenMM forces for this engine. The first force is the actual
EMLEForce, which uses a CustomCPPForceImpl to calculate the electrostatic
embedding force. The second is a null CustomBondForce that can be used to
add a "lambda_emle" global parameter to a context to allow the force to be
scaled.
Returns
-------
emle_force : openmm.Force
The EMLEForce object to compute the electrostatic embedding force.
interpolation_force : openmm.CustomBondForce
A null CustomBondForce object that can be used to add a "lambda_emle"
global parameter to an OpenMM context. This allows the electrostatic
embedding force to be scaled.
lines 1-19/19 (END)
Recreating the environment fixed the issue for me. Thank you!
No problem. For now assume that the tutorials always refer to the latest version of the code, so check for updates when reading anything new. I currently delete all old conda packages so the only ones available will be up to date.
Describe the bug When I try to reproduce the OpenMM-ML section of EMLE tutorial at https://github.com/OpenBioSim/sire/blob/feature_emle/doc/source/tutorial/partXX/01_emle.rst#interfacing-with-openmm-ml
the line emle_force, interpolation_force = engine.get_forces() gives me AttributeError: 'EMLEEngine' object has no attribute 'get_forces'
I can still get the emle force with emle_force = d._d._omm_mols.getSystem().getForce(0) after creating the dynamics object, but then I encounter AttributeError: module 'sire.qm' has no attribute 'zero_charge'. Does the tutorial describe some unimplemented features?
To reproduce import sire as sr from emle.calculator import EMLECalculator calculator = EMLECalculator(backend=None, device="cpu") mols = sr.load_test_files("ala.crd", "ala.top") mols, engine = sr.qm.emle(mols, mols[0], calculator, "7.5A", 20) engine.get_forces()
OS: Ubuntu 20.04 Python: 3.10.14 Sire: 2024.1.0.dev from openbiosim/label/emle