def test_top_update(self): top = Topology() top.update_topology() assert top.n_sites == 0 assert len(top.atom_types) == 0 assert len(top.atom_type_expressions) == 0 assert top.n_connections == 0 assert len(top.connection_types) == 0 assert len(top.connection_type_expressions) == 0 atomtype = AtomType() site1 = Site(name='site1', atom_type=atomtype) top.add_site(site1) site2 = Site(name='site2', atom_type=atomtype) top.add_site(site2) assert top.n_sites == 2 assert len(top.atom_types) == 1 assert len(top.atom_type_expressions) == 1 assert top.n_connections == 0 assert len(top.connection_types) == 0 assert len(top.connection_type_expressions) == 0 ctype = BondType() connection_12 = Bond(connection_members=[site1, site2], connection_type=ctype) top.add_connection(connection_12) assert top.n_sites == 2 assert len(top.atom_types) == 1 assert len(top.atom_type_expressions) == 1 assert top.n_connections == 1 assert len(top.connection_types) == 1 assert len(top.connection_type_expressions) == 1 site1.atom_type = AtomType(expression='sigma*epsilon') assert top.n_sites == 2 assert len(top.atom_types) == 1 assert len(top.atom_type_expressions) == 1 assert top.n_connections == 1 assert len(top.connection_types) == 1 assert len(top.connection_type_expressions) == 1 top.update_atom_types() assert top.n_sites == 2 assert len(top.atom_types) == 2 assert len(top.atom_type_expressions) == 2 assert top.n_connections == 1 assert len(top.connection_types) == 1 assert len(top.connection_type_expressions) == 1
def test_top_update(self): top = Topology() top.update_topology() assert top.n_sites == 0 assert len(top.atom_types) == 0 assert len(top.atom_type_expressions) == 0 assert top.n_connections == 0 assert len(top.connection_types) == 0 assert len(top.connection_type_expressions) == 0 atomtype = AtomType() atom1 = Atom(name='atom1', atom_type=atomtype) top.add_site(atom1) atom2 = Atom(name='atom2', atom_type=atomtype) top.add_site(atom2) assert top.n_sites == 2 assert len(top.atom_types) == 1 assert len(top.atom_type_expressions) == 1 assert top.n_connections == 0 assert len(top.connection_types) == 0 assert len(top.connection_type_expressions) == 0 ctype = BondType() connection_12 = Bond(connection_members=[atom1, atom2], bond_type=ctype) top.add_connection(connection_12) assert top.n_sites == 2 assert len(top.atom_types) == 1 assert len(top.atom_type_expressions) == 1 assert top.n_connections == 1 assert len(top.connection_types) == 1 assert len(top.connection_type_expressions) == 1 atom1.atom_type = AtomType(expression='sigma*epsilon*r') assert top.n_sites == 2 assert len(top.atom_types) == 1 assert len(top.atom_type_expressions) == 1 assert top.n_connections == 1 assert len(top.connection_types) == 1 assert len(top.connection_type_expressions) == 1 top.update_atom_types() assert top.n_sites == 2 assert len(top.atom_types) == 2 assert len(top.atom_type_expressions) == 2 assert top.n_connections == 1 assert len(top.connection_types) == 1 assert len(top.connection_type_expressions) == 1