@@ -2110,57 +2110,6 @@ def from_dict(cls, d):
2110
2110
# Implement abstract method Serializable.to_dict()
2111
2111
raise NotImplementedError () # TODO
2112
2112
2113
- # TODO: Merge this into Molecule.from_networkx if/when we implement that.
2114
- # TODO: can we now remove this as we have the ability to do this in the Molecule class?
2115
- @staticmethod
2116
- def _networkx_to_hill_formula (mol_graph ):
2117
- """
2118
- Convert a networkX representation of a molecule to a molecule formula. Used in printing out
2119
- informative error messages when a molecule from an openmm topology can't be matched.
2120
-
2121
- Parameters
2122
- ----------
2123
- mol_graph : a networkX graph
2124
- The graph representation of a molecule
2125
-
2126
- Returns
2127
- -------
2128
- formula : str
2129
- The molecular formula of the graph molecule
2130
- """
2131
- from simtk .openmm .app import Element
2132
-
2133
- # Make a flat list of all atomic numbers in the molecule
2134
- atom_nums = []
2135
- for idx in mol_graph .nodes :
2136
- atom_nums .append (mol_graph .nodes [idx ]["atomic_number" ])
2137
-
2138
- # Count the number of instances of each atomic number
2139
- at_num_to_counts = dict ([(unq , atom_nums .count (unq )) for unq in atom_nums ])
2140
-
2141
- symbol_to_counts = {}
2142
- # Check for C and H first, to make a correct hill formula (remember dicts in python 3.6+ are ordered)
2143
- if 6 in at_num_to_counts :
2144
- symbol_to_counts ["C" ] = at_num_to_counts [6 ]
2145
- del at_num_to_counts [6 ]
2146
-
2147
- if 1 in at_num_to_counts :
2148
- symbol_to_counts ["H" ] = at_num_to_counts [1 ]
2149
- del at_num_to_counts [1 ]
2150
-
2151
- # Now count instances of all elements other than C and H, in order of ascending atomic number
2152
- sorted_atom_nums = sorted (at_num_to_counts .keys ())
2153
- for atom_num in sorted_atom_nums :
2154
- symbol_to_counts [
2155
- Element .getByAtomicNumber (atom_num ).symbol
2156
- ] = at_num_to_counts [atom_num ]
2157
-
2158
- # Finally format the formula as string
2159
- formula = ""
2160
- for ele , count in symbol_to_counts .items ():
2161
- formula += f"{ ele } { count } "
2162
- return formula
2163
-
2164
2113
@classmethod
2165
2114
def from_openmm (cls , openmm_topology , unique_molecules = None ):
2166
2115
"""
@@ -2477,65 +2426,21 @@ def from_mdtraj(mdtraj_topology, unique_molecules=None):
2477
2426
mdtraj_topology .to_openmm (), unique_molecules = unique_molecules
2478
2427
)
2479
2428
2480
- # TODO: Jeff prepended an underscore on this before 0.2.0 release to remove it from the API.
2481
- # Before exposing this, we should look carefully at the information that is preserved/lost during this
2482
- # conversion, and make it clear what would happen to this information in a round trip. For example,
2483
- # we should know what would happen to formal and partial bond orders and charges, stereochemistry, and
2484
- # multi-conformer information. It will be important to document these risks to users, as all of these
2485
- # factors could lead to unintended behavior during system parameterization.
2429
+ # Avoid removing this method, even though it is private and would not be difficult for most
2430
+ # users to replace. Also avoid making it public as round-trips with MDTraj are likely
2431
+ # to not preserve necessary information.
2486
2432
def _to_mdtraj (self ):
2487
2433
"""
2488
2434
Create an MDTraj Topology object.
2489
-
2490
2435
Returns
2491
2436
----------
2492
2437
mdtraj_topology : mdtraj.Topology
2493
2438
An MDTraj Topology object
2494
- # """
2439
+ """
2495
2440
import mdtraj as md
2496
2441
2497
2442
return md .Topology .from_openmm (self .to_openmm ())
2498
2443
2499
- @staticmethod
2500
- def from_parmed (parmed_structure , unique_molecules = None ):
2501
- """
2502
- .. warning:: This functionality will be implemented in a future toolkit release.
2503
-
2504
- Construct an OpenFF Topology object from a ParmEd Structure object.
2505
-
2506
- Parameters
2507
- ----------
2508
- parmed_structure : parmed.Structure
2509
- A ParmEd structure object
2510
- unique_molecules : iterable of objects that can be used to construct unique Molecule objects
2511
- All unique molecules must be provided, in any order, though multiple copies of each molecule are allowed.
2512
- The atomic elements and bond connectivity will be used to match the reference molecules
2513
- to molecule graphs appearing in the structure's ``topology`` object. If bond orders are present in the
2514
- structure's ``topology`` object, these will be used in matching as well.
2515
-
2516
- Returns
2517
- -------
2518
- topology : openff.toolkit.topology.Topology
2519
- An OpenFF Topology object
2520
- """
2521
- # TODO: Implement functionality
2522
- raise NotImplementedError
2523
-
2524
- def to_parmed (self ):
2525
- """
2526
-
2527
- .. warning:: This functionality will be implemented in a future toolkit release.
2528
-
2529
- Create a ParmEd Structure object.
2530
-
2531
- Returns
2532
- ----------
2533
- parmed_structure : parmed.Structure
2534
- A ParmEd Structure objecft
2535
- """
2536
- # TODO: Implement functionality
2537
- raise NotImplementedError
2538
-
2539
2444
# TODO: Jeff prepended an underscore on this before 0.2.0 release to remove it from the API.
2540
2445
# This function is deprecated and expects the OpenEye toolkit. We need to discuss what
2541
2446
# to do with this functionality in light of our move to the ToolkitWrapper architecture.
0 commit comments