Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
assign_charges.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # (c) Copyright Rosetta Commons Member Institutions.
3 # (c) This file is part of the Rosetta software suite and is made available under license.
4 # (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
5 # (c) For more information, see http://www.rosettacommons.org. Questions about this can be
6 # (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
7 import sys
8 from openeye.oechem import * # OpenEye
9 try:
10  from openeye.oequacpac import * # OpenEye, newer releases
11 except ImportError:
12  from openeye.oeproton import * # OpenEye, older releases
13 
14 ifs = oemolistream()
15 ifs.open() # stdin
16 ofs = oemolostream()
17 ofs.open() # stdout
18 
19 ifs.SetFormat(OEFormat_MOL2)
20 
21 # Write MOL2 without renaming atoms to match their input ordering
22 ofs.SetFormat(OEFormat_MOL2)
23 ofs.SetFlavor(OEFormat_MOL2, (OEOFlavor_Generic_Default | OEOFlavor_MOL2_Default) & ~OEOFlavor_MOL2_AtomNames)
24 
25 first = True
26 for m in ifs.GetOEGraphMols():
27  mol = OEGraphMol(m) # otherwise same mol obj is reused
28  if first:
29  first = False
30  OEClearPartialCharges(mol)
31  OEAssignPartialCharges(mol, OECharges_AM1BCC)
32  OEWriteMolecule(ofs, mol)
33