From d1d78ab2d3904b39f2a7f819f605cf9f4b2e5888 Mon Sep 17 00:00:00 2001 From: Co Quach Date: Thu, 21 Sep 2023 12:47:22 -0500 Subject: [PATCH] only convert unique atom type, remove unneccessary deepcopy --- gmso/external/convert_parmed.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gmso/external/convert_parmed.py b/gmso/external/convert_parmed.py index 8ab60f741..a5245044d 100644 --- a/gmso/external/convert_parmed.py +++ b/gmso/external/convert_parmed.py @@ -309,7 +309,7 @@ def _atom_types_from_pmd(structure): "epsilon": atom_type.epsilon * u.Unit("kcal / mol"), }, independent_variables={"r"}, - mass=copy.deepcopy(atom_type.mass), + mass=atom_type.mass, ) pmd_top_atomtypes[atom_type] = top_atomtype return pmd_top_atomtypes @@ -415,9 +415,6 @@ def to_parmed(top, refer_type=True): msg = "Provided argument is not a topology.Topology." assert isinstance(top, gmso.Topology) - # Copy structure to not overwrite object in memory - top = copy.deepcopy(top) - # Set up Parmed structure and define general properties structure = pmd.Structure() structure.title = top.name @@ -555,7 +552,9 @@ def _atom_types_from_gmso(top, structure, atom_map): """ # Maps atype_map = dict() - for atom_type in top.atom_types: + for atom_type in top.atom_types( + filter_by=PotentialFilters.UNIQUE_NAME_CLASS + ): msg = "Atom type {} expression does not match Parmed AtomType default expression".format( atom_type.name )