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

Change forcefield_generators.generateOEMolFromTopologyResidue to use molecule_to_mol2 #284

Open
jchodera opened this issue Mar 14, 2019 · 2 comments
Labels

Comments

@jchodera
Copy link
Member

openmoltools.forcefield_generators.generateOEMolFromTopologyResidue currently uses the default OpenEye mol2 writer which generates <0> for substructure names, causing problems with antechamber like

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 35: invalid start byte

To fix this, we need to change this section to instead use

from openmoltools.openeye import molecule_to_mol2
molecule_to_mol2(molecule, mol2_input_filename)
@jchodera jchodera added the bug label Mar 14, 2019
@jchodera
Copy link
Member Author

Wait, that's not correct. We have to use the low-level writer since this is then being fed into antechamber for bond order perception (which isn't really a good idea anyway).

Instead, I think we need to rewrite the substructure name <0> with

    # Replace <0> substructure names with valid text.                                                                                                                                                                                  
    infile = open(mol2_input_filename, 'r')
    lines = infile.readlines()
    infile.close()
    newlines = [line.replace('<0>', residue.name) for line in lines]
    outfile = open(mol2_input_filename, 'w')
    outfile.writelines(newlines)
    outfile.close()

though I note this still gives me

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 226: invalid start byte

which seems to be because the Tripos atom types are incorrect:

@<TRIPOS>ATOM
      1 C1          0.0000    0.0000    0.0000           1 MOL         0.0000
      2 C3          0.0000    0.0000    0.0000           1 MOL         0.0000

@jchodera
Copy link
Member Author

I think this function just isn't a good idea at all. We should probably just deprecate it.

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

No branches or pull requests

1 participant