From d0b1d0996489c187524f58f262c5db6402b97ad9 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Fri, 22 Dec 2023 12:13:15 -0700 Subject: [PATCH 01/11] Fix bugs in add_void_particles --- flowermd/modules/welding/utils.py | 33 +++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/flowermd/modules/welding/utils.py b/flowermd/modules/welding/utils.py index 532acaad..d9d9c794 100644 --- a/flowermd/modules/welding/utils.py +++ b/flowermd/modules/welding/utils.py @@ -31,12 +31,34 @@ def add_void_particles( """ void_axis = np.asarray(void_axis) snapshot.particles.N += num_voids - snapshot.particles.position[-1] = ( - void_axis * snapshot.configuration.box[0:3] / 2 + # Set updated positions + void_pos = void_axis * snapshot.configuration.box[0:3] / 2 + init_pos = snapshot.particles.position + new_pos = np.empty((init_pos.shape[0] + 1, 3)) + new_pos[: init_pos.shape[0]] = init_pos + new_pos[-1] = void_pos + # snapshot.particles.position = new_pos + snapshot.particles.position = np.concatenate( + (init_pos, void_pos.reshape(1, 3)), axis=0 ) - snapshot.particles.types = snapshot.particles.types + ["VOID"] - snapshot.particles.typeid[-1] = len(snapshot.particles.types) - 1 - snapshot.particles.mass[-1] = 1 + + # Set updated types and type IDs + snapshot.particles.types.append("VOID") + void_id = len(snapshot.particles.types) - 1 + init_ids = snapshot.particles.typeid + snapshot.particles.typeid = np.concatenate( + (init_ids, np.array([void_id])), axis=None + ) + # Set updated mass and charges + init_mass = snapshot.particles.mass + snapshot.particles.mass = np.concatenate( + (init_mass, np.array([1])), axis=None + ) + init_charges = snapshot.particles.charge + snapshot.particles.charge = np.concatenate( + (init_charges, np.array([0])), axis=None + ) + # Updated LJ params lj = [i for i in forcefield if isinstance(i, hoomd.md.pair.LJ)][0] for ptype in snapshot.particles.types: lj.params[(ptype, "VOID")] = { @@ -44,5 +66,4 @@ def add_void_particles( "epsilon": epsilon, } lj.r_cut[(ptype, "VOID")] = r_cut - return snapshot, forcefield From 26e2bf1f6e904426e435819e31184c40565ef8ad Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Fri, 22 Dec 2023 12:45:11 -0700 Subject: [PATCH 02/11] add sim initializaiton to void particle test --- flowermd/tests/modules/test_weld.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flowermd/tests/modules/test_weld.py b/flowermd/tests/modules/test_weld.py index 219935af..0c902f33 100644 --- a/flowermd/tests/modules/test_weld.py +++ b/flowermd/tests/modules/test_weld.py @@ -117,3 +117,5 @@ def test_void_particle(self, polyethylene_system): for p_type in init_types: assert lj.params[(p_type, "VOID")]["sigma"] == 0.4 assert lj.params[(p_type, "VOID")]["epsilon"] == 1 + sim = SlabSimulation(initial_state=void_snap, forcefield=ff) + sim.run_NVT(n_steps=1, kT=1, tau_kt=sim.dt * 100) From eabba4ee3e93df47da0cdbfb6c7c3dd0d54a59fa Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Wed, 10 Jan 2024 18:46:05 -0700 Subject: [PATCH 03/11] remove density param from Lattice --- flowermd/base/system.py | 2 -- flowermd/tests/base/test_system.py | 2 -- flowermd/tests/library/test_tensile.py | 1 - 3 files changed, 5 deletions(-) diff --git a/flowermd/base/system.py b/flowermd/base/system.py index 931ea705..9f23e2f2 100644 --- a/flowermd/base/system.py +++ b/flowermd/base/system.py @@ -773,7 +773,6 @@ class Lattice(System): def __init__( self, molecules, - density: float, x: float, y: float, n: int, @@ -786,7 +785,6 @@ def __init__( self.basis_vector = basis_vector super(Lattice, self).__init__( molecules=molecules, - density=density, base_units=base_units, ) diff --git a/flowermd/tests/base/test_system.py b/flowermd/tests/base/test_system.py index b8c796d0..ada434ee 100644 --- a/flowermd/tests/base/test_system.py +++ b/flowermd/tests/base/test_system.py @@ -782,7 +782,6 @@ def test_lattice_polymer(self, polyethylene): polyethylene = polyethylene(lengths=2, num_mols=32) system = Lattice( molecules=[polyethylene], - density=1.0, x=1, y=1, n=4, @@ -807,7 +806,6 @@ def test_lattice_molecule(self, benzene_molecule): benzene_mol = benzene_molecule(n_mols=32) system = Lattice( molecules=[benzene_mol], - density=1.0, x=1, y=1, n=4, diff --git a/flowermd/tests/library/test_tensile.py b/flowermd/tests/library/test_tensile.py index ae39990d..161dfc38 100644 --- a/flowermd/tests/library/test_tensile.py +++ b/flowermd/tests/library/test_tensile.py @@ -10,7 +10,6 @@ def test_tensile(self): pps = PPS(lengths=6, num_mols=32) system = Lattice( molecules=[pps], - density=1.0, x=1.2, y=1.2, n=4, From 31ac4408c49c64ca472fea5856361314f5b11d99 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Tue, 23 Jan 2024 15:46:43 -0700 Subject: [PATCH 04/11] add ability to combine 2 slabs in Interface rather than duplicate one slab --- flowermd/modules/welding/welding.py | 91 +++++++++++++++++------------ flowermd/tests/modules/test_weld.py | 4 +- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/flowermd/modules/welding/welding.py b/flowermd/modules/welding/welding.py index 0b486e53..060ca437 100644 --- a/flowermd/modules/welding/welding.py +++ b/flowermd/modules/welding/welding.py @@ -4,6 +4,7 @@ import numpy as np from flowermd.base.simulation import Simulation +from flowermd.internal import check_return_iterable from flowermd.utils import HOOMDThermostats @@ -24,8 +25,8 @@ class Interface: """ - def __init__(self, gsd_file, interface_axis, gap, wall_sigma=1.0): - self.gsd_file = gsd_file + def __init__(self, gsd_files, interface_axis, gap, wall_sigma=1.0): + self.gsd_files = check_return_iterable(gsd_files) self.interface_axis = interface_axis self.gap = gap self.wall_sigma = wall_sigma @@ -33,103 +34,117 @@ def __init__(self, gsd_file, interface_axis, gap, wall_sigma=1.0): def _build(self): """Duplicates the slab and builds the interface.""" - gsd_file = gsd.hoomd.open(self.gsd_file) - snap = gsd_file[-1] - gsd_file.close() + if len(self.gsd_files) == 1: + gsd_file_L = gsd.hoomd.open(self.gsd_files[0]) + gsd_file_R = gsd.hoomd.open(self.gsd_files[0]) + else: + gsd_file_L = gsd.hoomd.open(self.gsd_files[0]) + gsd_file_R = gsd.hoomd.open(self.gsd_files[1]) + # Get snapshots + snap_L = gsd_file_L[-1] + snap_R = gsd_file_R[-1] + gsd_file_L.close() + gsd_file_R.close() + axis_index = np.where(self.interface_axis != 0)[0] interface = gsd.hoomd.Frame() - interface.particles.N = snap.particles.N * 2 - interface.bonds.N = snap.bonds.N * 2 - interface.bonds.M = snap.bonds.M - interface.angles.N = snap.angles.N * 2 - interface.angles.M = snap.angles.M - interface.dihedrals.N = snap.dihedrals.N * 2 - interface.dihedrals.M = snap.dihedrals.M - interface.pairs.N = snap.pairs.N * 2 + interface.particles.N = snap_L.particles.N + snap_R.particles.N + interface.bonds.N = snap_L.bonds.N + snap_R.bonds.N + # TODO: Do we need bonds.M? + interface.bonds.M = snap_L.bonds.M + interface.angles.N = snap_L.angles.N + snap_R.angles.N + # TODO: Do we need angles.M? + interface.angles.M = snap_L.angles.M + interface.dihedrals.N = snap_L.dihedrals.N + snap_R.dihedrals.N + # TODO: Do we need dihedrals.M? + interface.dihedrals.M = snap_L.dihedrals.M + interface.pairs.N = snap_L.pairs.N + snap_R.pairs.N # Set up box. Box edge is doubled along the interface axis direction, # plus the gap - interface.configuration.box = np.copy(snap.configuration.box) + interface.configuration.box = np.copy(snap_L.configuration.box) interface.configuration.box[axis_index] *= 2 interface.configuration.box[axis_index] += self.gap - self.wall_sigma # Set up snapshot.particles info: # Get set of new coordiantes, shifted along interface axis shift = ( - snap.configuration.box[axis_index] + self.gap - self.wall_sigma + snap_L.configuration.box[axis_index] + self.gap - self.wall_sigma ) / 2 - right_pos = np.copy(snap.particles.position) + right_pos = np.copy(snap_R.particles.position) right_pos[:, axis_index] += shift - left_pos = np.copy(snap.particles.position) + left_pos = np.copy(snap_L.particles.position) left_pos[:, axis_index] -= shift pos = np.concatenate((left_pos, right_pos), axis=None) mass = np.concatenate( - (snap.particles.mass, snap.particles.mass), axis=None + (snap_L.particles.mass, snap_R.particles.mass), axis=None ) charges = np.concatenate( - (snap.particles.charge, snap.particles.charge), axis=None + (snap_L.particles.charge, snap_R.particles.charge), axis=None ) type_ids = np.concatenate( - (snap.particles.typeid, snap.particles.typeid), axis=None + (snap_L.particles.typeid, snap_R.particles.typeid), axis=None ) interface.particles.position = pos interface.particles.mass = mass interface.particles.charge = charges - interface.particles.types = snap.particles.types + interface.particles.types = snap_L.particles.types interface.particles.typeid = type_ids # Set up bonds: - bond_group_left = np.copy(snap.bonds.group) - bond_group_right = np.copy(snap.bonds.group) + snap.particles.N + bond_group_left = np.copy(snap_L.bonds.group) + bond_group_right = np.copy(snap_R.bonds.group) + snap_R.particles.N bond_group = np.concatenate( (bond_group_left, bond_group_right), axis=None ) bond_type_ids = np.concatenate( - (snap.bonds.typeid, snap.bonds.typeid), axis=None + (snap_L.bonds.typeid, snap_R.bonds.typeid), axis=None ) interface.bonds.group = bond_group interface.bonds.typeid = bond_type_ids - interface.bonds.types = snap.bonds.types + interface.bonds.types = snap_L.bonds.types # Set up angles: - angle_group_left = np.copy(snap.angles.group) - angle_group_right = np.copy(snap.angles.group) + snap.particles.N + angle_group_left = np.copy(snap_L.angles.group) + angle_group_right = np.copy(snap_R.angles.group) + snap_L.particles.N angle_group = np.concatenate( (angle_group_left, angle_group_right), axis=None ) angle_type_ids = np.concatenate( - (snap.angles.typeid, snap.angles.typeid), axis=None + (snap_L.angles.typeid, snap_R.angles.typeid), axis=None ) interface.angles.group = angle_group interface.angles.typeid = angle_type_ids - interface.angles.types = snap.angles.types + interface.angles.types = snap_L.angles.types # Set up dihedrals: - dihedral_group_left = np.copy(snap.dihedrals.group) - dihedral_group_right = np.copy(snap.dihedrals.group) + snap.particles.N + dihedral_group_left = np.copy(snap_L.dihedrals.group) + dihedral_group_right = ( + np.copy(snap_R.dihedrals.group) + snap_L.particles.N + ) dihedral_group = np.concatenate( (dihedral_group_left, dihedral_group_right), axis=None ) dihedral_type_ids = np.concatenate( - (snap.dihedrals.typeid, snap.dihedrals.typeid), axis=None + (snap_L.dihedrals.typeid, snap_R.dihedrals.typeid), axis=None ) interface.dihedrals.group = dihedral_group interface.dihedrals.typeid = dihedral_type_ids - interface.dihedrals.types = snap.dihedrals.types + interface.dihedrals.types = snap_L.dihedrals.types # Set up pairs: - if snap.pairs.N > 0: - pair_group_left = np.copy(snap.pairs.group) - pair_group_right = np.copy(snap.pairs.group) + snap.particles.N + if snap_L.pairs.N > 0: + pair_group_left = np.copy(snap_L.pairs.group) + pair_group_right = np.copy(snap_R.pairs.group) + snap_L.particles.N pair_group = np.concatenate((pair_group_left, pair_group_right)) pair_type_ids = np.concatenate( - (snap.pairs.typeid, snap.pairs.typeid), axis=None + (snap_L.pairs.typeid, snap_R.pairs.typeid), axis=None ) interface.pairs.group = pair_group interface.pairs.typeid = pair_type_ids - interface.pairs.types = snap.pairs.types + interface.pairs.types = snap_L.pairs.types return interface diff --git a/flowermd/tests/modules/test_weld.py b/flowermd/tests/modules/test_weld.py index 219935af..a221f533 100644 --- a/flowermd/tests/modules/test_weld.py +++ b/flowermd/tests/modules/test_weld.py @@ -26,7 +26,7 @@ def test_interface(self, polyethylene_system): ) sim.save_restart_gsd() interface = Interface( - gsd_file="restart.gsd", interface_axis=(1, 0, 0), gap=0.1 + gsd_files="restart.gsd", interface_axis=(1, 0, 0), gap=0.1 ) interface_snap = interface.hoomd_snapshot with gsd.hoomd.open("restart.gsd", "r") as traj: @@ -90,7 +90,7 @@ def test_weld_sim(self, polyethylene_system): sim.save_restart_gsd() # Create interface system from slab restart.gsd file interface = Interface( - gsd_file="restart.gsd", interface_axis="x", gap=0.1 + gsd_files="restart.gsd", interface_axis="x", gap=0.1 ) sim = WeldSimulation( initial_state=interface.hoomd_snapshot, From 6a5b7bd4a13f2307f713860dc9a6303a78ea363d Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Tue, 23 Jan 2024 16:01:11 -0700 Subject: [PATCH 05/11] add test for list of 2 files --- flowermd/tests/modules/test_weld.py | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/flowermd/tests/modules/test_weld.py b/flowermd/tests/modules/test_weld.py index a221f533..8f54dc1e 100644 --- a/flowermd/tests/modules/test_weld.py +++ b/flowermd/tests/modules/test_weld.py @@ -45,6 +45,44 @@ def test_interface(self, polyethylene_system): if os.path.isfile("restart.gsd"): os.remove("restart.gsd") + def test_interface_2_files(self, polyethylene_system): + sim = Simulation( + initial_state=polyethylene_system.hoomd_snapshot, + forcefield=polyethylene_system.hoomd_forcefield, + log_write_freq=2000, + ) + sim.add_walls(wall_axis=(1, 0, 0), sigma=1, epsilon=1, r_cut=2) + sim.run_update_volume( + n_steps=1000, + period=10, + kT=2.0, + tau_kt=0.01, + final_box_lengths=sim.box_lengths / 2, + ) + sim.save_restart_gsd("restart.gsd") + sim.save_restart_gsd("restart2.gsd") + interface = Interface( + gsd_files=["restart.gsd", "restart2.gsd"], + interface_axis=(1, 0, 0), + gap=0.1, + ) + interface_snap = interface.hoomd_snapshot + with gsd.hoomd.open("restart.gsd", "r") as traj: + slab_snap = traj[0] + + assert interface_snap.particles.N == slab_snap.particles.N * 2 + assert interface_snap.bonds.N == slab_snap.bonds.N * 2 + assert interface_snap.bonds.M == slab_snap.bonds.M + assert interface_snap.angles.N == slab_snap.angles.N * 2 + assert interface_snap.angles.M == slab_snap.angles.M + assert interface_snap.dihedrals.N == slab_snap.dihedrals.N * 2 + assert interface_snap.dihedrals.M == slab_snap.dihedrals.M + assert interface_snap.pairs.N == slab_snap.pairs.N * 2 + assert interface_snap.pairs.M == slab_snap.pairs.M + + if os.path.isfile("restart.gsd"): + os.remove("restart.gsd") + def test_slab_sim_xaxis(self, polyethylene_system): sim = SlabSimulation( initial_state=polyethylene_system.hoomd_snapshot, From a833a6c2eeb5805a5b712fa327a0d12105940b1c Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Wed, 24 Jan 2024 13:55:35 -0700 Subject: [PATCH 06/11] remove VOID from integrate types in WeldSimulation --- flowermd/modules/welding/welding.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flowermd/modules/welding/welding.py b/flowermd/modules/welding/welding.py index 060ca437..553b91d8 100644 --- a/flowermd/modules/welding/welding.py +++ b/flowermd/modules/welding/welding.py @@ -256,3 +256,6 @@ def __init__( wall_r_cut, wall_r_extrap, ) + snap = self.state.get_snapshot() + integrate_types = [i for i in snap.particles.types if i != "VOID"] + self.integrate_group = hoomd.filter.Type(integrate_types) From 2de44c1228989bfce9687d127669fd5cb0f01931 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Thu, 25 Jan 2024 13:34:28 -0700 Subject: [PATCH 07/11] add flag to remove VOID particles from slab snapshots --- flowermd/modules/welding/welding.py | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/flowermd/modules/welding/welding.py b/flowermd/modules/welding/welding.py index 553b91d8..1d5a9a7a 100644 --- a/flowermd/modules/welding/welding.py +++ b/flowermd/modules/welding/welding.py @@ -25,11 +25,19 @@ class Interface: """ - def __init__(self, gsd_files, interface_axis, gap, wall_sigma=1.0): + def __init__( + self, + gsd_files, + interface_axis, + gap, + wall_sigma=1.0, + remove_void_particles=True, + ): self.gsd_files = check_return_iterable(gsd_files) self.interface_axis = interface_axis self.gap = gap self.wall_sigma = wall_sigma + self._remove_void_particles = remove_void_particles self.hoomd_snapshot = self._build() def _build(self): @@ -45,8 +53,23 @@ def _build(self): snap_R = gsd_file_R[-1] gsd_file_L.close() gsd_file_R.close() - - axis_index = np.where(self.interface_axis != 0)[0] + # Remove VOID partilces if needed + if self._remove_void_particles: + for snap in [snap_L, snap_R]: + if "VOID" in snap.particles.types: + snap.particles.N -= 1 + void_id = snap.particles.types.index("VOID") + snap.particles.types.remove("VOID") + keep_indices = np.where(snap.particles.typeid != void_id)[0] + snap.particles.position = snap.particles.position[ + keep_indices + ] + snap.particles.mass = snap.particles.mass[keep_indices] + snap.particles.charge = snap.particles.charge[keep_indices] + snap.particles.orientation = snap.particles.orientation[ + keep_indices + ] + snap.particles.typeid = snap.particles.typeid[keep_indices] interface = gsd.hoomd.Frame() interface.particles.N = snap_L.particles.N + snap_R.particles.N @@ -63,6 +86,7 @@ def _build(self): # Set up box. Box edge is doubled along the interface axis direction, # plus the gap + axis_index = np.where(self.interface_axis != 0)[0] interface.configuration.box = np.copy(snap_L.configuration.box) interface.configuration.box[axis_index] *= 2 interface.configuration.box[axis_index] += self.gap - self.wall_sigma From c530744fef9f2b7462987366523d39b9c505b6e6 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Thu, 25 Jan 2024 13:34:48 -0700 Subject: [PATCH 08/11] add new tests --- flowermd/tests/modules/test_weld.py | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/flowermd/tests/modules/test_weld.py b/flowermd/tests/modules/test_weld.py index 8f54dc1e..eff70dc7 100644 --- a/flowermd/tests/modules/test_weld.py +++ b/flowermd/tests/modules/test_weld.py @@ -155,3 +155,51 @@ def test_void_particle(self, polyethylene_system): for p_type in init_types: assert lj.params[(p_type, "VOID")]["sigma"] == 0.4 assert lj.params[(p_type, "VOID")]["epsilon"] == 1 + + def test_interface_with_void_particle(self, polyethylene_system): + init_snap = polyethylene_system.hoomd_snapshot + void_snap, ff = add_void_particles( + init_snap, + polyethylene_system.hoomd_forcefield, + void_diameter=0.10, + num_voids=1, + void_axis=(1, 0, 0), + epsilon=0.7, + r_cut=0.7, + ) + sim = SlabSimulation( + initial_state=void_snap, + forcefield=ff, + log_write_freq=2000, + ) + sim.run_update_volume( + n_steps=1000, + period=10, + kT=2.0, + tau_kt=0.01, + final_box_lengths=sim.box_lengths / 2, + ) + sim.save_restart_gsd("restart.gsd") + interface = Interface( + gsd_files=["restart.gsd"], + interface_axis=(1, 0, 0), + gap=0.1, + ) + + interface_snap = interface.hoomd_snapshot + with gsd.hoomd.open("restart.gsd", "r") as traj: + slab_snap = traj[0] + + assert "VOID" not in interface_snap.particles.types + assert interface_snap.particles.N == (slab_snap.particles.N * 2) - 2 + assert interface_snap.bonds.N == slab_snap.bonds.N * 2 + assert interface_snap.bonds.M == slab_snap.bonds.M + assert interface_snap.angles.N == slab_snap.angles.N * 2 + assert interface_snap.angles.M == slab_snap.angles.M + assert interface_snap.dihedrals.N == slab_snap.dihedrals.N * 2 + assert interface_snap.dihedrals.M == slab_snap.dihedrals.M + assert interface_snap.pairs.N == slab_snap.pairs.N * 2 + assert interface_snap.pairs.M == slab_snap.pairs.M + + if os.path.isfile("restart.gsd"): + os.remove("restart.gsd") From a337c3cef657a6870a17445a1ef3a9bfacdef900 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Thu, 25 Jan 2024 14:43:59 -0700 Subject: [PATCH 09/11] debugging last weld test --- flowermd/tests/modules/test_weld.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flowermd/tests/modules/test_weld.py b/flowermd/tests/modules/test_weld.py index eff70dc7..09ed0e42 100644 --- a/flowermd/tests/modules/test_weld.py +++ b/flowermd/tests/modules/test_weld.py @@ -2,6 +2,7 @@ import gsd.hoomd import hoomd +import numpy as np from flowermd import Simulation from flowermd.modules.welding import Interface, SlabSimulation, WeldSimulation @@ -158,6 +159,7 @@ def test_void_particle(self, polyethylene_system): def test_interface_with_void_particle(self, polyethylene_system): init_snap = polyethylene_system.hoomd_snapshot + init_N = np.copy(init_snap.particles.N) void_snap, ff = add_void_particles( init_snap, polyethylene_system.hoomd_forcefield, @@ -167,6 +169,7 @@ def test_interface_with_void_particle(self, polyethylene_system): epsilon=0.7, r_cut=0.7, ) + assert void_snap.particles.N == init_N + 1 sim = SlabSimulation( initial_state=void_snap, forcefield=ff, From 34211d2cc676f88a2086f420cee2cb7bd3dca2f9 Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Mon, 29 Jan 2024 11:44:57 -0700 Subject: [PATCH 10/11] remove commented-out line of code --- flowermd/modules/welding/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/flowermd/modules/welding/utils.py b/flowermd/modules/welding/utils.py index 12668646..029aa467 100644 --- a/flowermd/modules/welding/utils.py +++ b/flowermd/modules/welding/utils.py @@ -38,11 +38,9 @@ def add_void_particles( new_pos = np.empty((init_pos.shape[0] + 1, 3)) new_pos[: init_pos.shape[0]] = init_pos new_pos[-1] = void_pos - # snapshot.particles.position = new_pos snapshot.particles.position = np.concatenate( (init_pos, void_pos.reshape(1, 3)), axis=0 ) - # Set updated types and type IDs snapshot.particles.types.append("VOID") void_id = len(snapshot.particles.types) - 1 From 2c11ecd2520cd67d2b7853699d8a21747091669e Mon Sep 17 00:00:00 2001 From: chrisjonesBSU Date: Mon, 29 Jan 2024 15:17:53 -0700 Subject: [PATCH 11/11] remove todo comments --- flowermd/modules/welding/welding.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/flowermd/modules/welding/welding.py b/flowermd/modules/welding/welding.py index 65855a38..36fc4084 100644 --- a/flowermd/modules/welding/welding.py +++ b/flowermd/modules/welding/welding.py @@ -75,16 +75,12 @@ def _build(self): interface = gsd.hoomd.Frame() interface.particles.N = snap_L.particles.N + snap_R.particles.N interface.bonds.N = snap_L.bonds.N + snap_R.bonds.N - # TODO: Do we need bonds.M? - interface.bonds.M = snap_L.bonds.M + interface.bonds.M = 2 interface.angles.N = snap_L.angles.N + snap_R.angles.N - # TODO: Do we need angles.M? - interface.angles.M = snap_L.angles.M + interface.angles.M = 3 interface.dihedrals.N = snap_L.dihedrals.N + snap_R.dihedrals.N - # TODO: Do we need dihedrals.M? - interface.dihedrals.M = snap_L.dihedrals.M + interface.dihedrals.M = 4 interface.pairs.N = snap_L.pairs.N + snap_R.pairs.N - # Set up box. Box edge is doubled along the interface axis direction, # plus the gap axis_index = np.where(self.interface_axis != 0)[0]