Skip to content

from_RDKMol can remove atoms from other configurations #99

@paulsaxe

Description

@paulsaxe

In from_RDKMol, this code:

            self.clear()
            try:
                ids = self.atoms.append(x=Xs, y=Ys, z=Zs, atno=atnos)
            except Exception:

causes problems because self.clear() deletes the atoms by calling self.atoms.delete("all"). In atom.py the code is this:

        # velocities, and gradients                                                                                                                                                       
        if atoms == "all" or atoms == "*":
            sql = """                                                                                                                                                                     
            DELETE FROM atom                                                                                                                                                              
             WHERE id IN (SELECT atom FROM atomset_atom WHERE atomset = ?)                                                                                                                
            """
            parameters = (self.atomset,)
            self.db.execute(sql, parameters)

The problem is that configurations usually share atoms by having the same atom set. The solution is to check for other configurations sharing the atoms whenever atoms are added, deleted, or have e.g. the element changed. If the atom set is shared, create new atom set and the appropriate atoms.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions