Ejemplo n.º 1
0
    def check_update(positions, particle_count, char_length, x):
        charges = np.random.rand(particle_count, 1)
        sigma = np.ones((particle_count, 1))
        epsilon_lj = np.ones((particle_count, 1))
        system = nbp.System(characteristic_length=char_length,
                            sigma=sigma,
                            epsilon_lj=epsilon_lj,
                            particle_charges=charges,
                            positions=positions,
                            lj=True,
                            ewald=True,
                            use_neighbours=True)
        neighbours = nbp.Neighbours(system.info(),
                                    system.state(),
                                    system,
                                    verbose=True)
        beginning_list = neighbours.get_neighbours(x)

        # new positions
        positions = positions + 1
        system.update_state()  # what has to go in here?
        updated_list1 = neighbours.update_neighbours

        positions = positions + 1
        nbp.System(char_length, sigma, charges, positions)
        updated_list2 = neighbours.update_neighbours

        return beginning_list, updated_list1, updated_list2
Ejemplo n.º 2
0
    def setup_neighbours(positions, particle_count, char_length, x):
        charges = np.random.rand(particle_count, 1)
        sigma = np.ones((particle_count, 1))
        epsilon_lj = np.ones((particle_count, 1))
        system = nbp.System(characteristic_length=char_length,
                            sigma=sigma,
                            epsilon_lj=epsilon_lj,
                            particle_charges=charges,
                            positions=positions,
                            lj=True,
                            ewald=True,
                            use_neighbours=True)
        neighbours = nbp.Neighbours(system.info(),
                                    system.state(),
                                    system,
                                    verbose=True)
        neighbours_list = neighbours.get_neighbours(x)

        return neighbours_list
Ejemplo n.º 3
0
def create_system(temperature, ewald_flag=True, lj_flag=True, neigh_flag=True):
    data = nbp.Parser(
        'C:/Users/ludov/Documents/Uni/Computational Sciences/git/non-bonded-periodic/sodium-chloride-example.npz'
    ).parse()

    sys0 = nbp.System(data['ch_length'],
                      data['sigma'][:, None],
                      data['epsilon'][:, None] * 1.0364e-2,
                      data['charge'][:, None],
                      data['pos'],
                      lj=lj_flag,
                      ewald=ewald_flag,
                      use_neighbours=neigh_flag,
                      epsilon0=55.3e-4)
    sys0.optimize(max_steps=500,
                  cov=sys0.info().cutoff() / 2**8,
                  num_particles=0.05)
    sys0.simulate(100, temperature)

    return sys0
Ejemplo n.º 4
0
def make_system(characteristic_length=10,
                sigma=None,
                epsilon_lj=None,
                particle_charges=None,
                positions=None,
                particle_count=None,
                lj=True,
                ewald=True,
                use_neighbours=False):
    if particle_count is None:
        if particle_charges is not None:
            particle_count = np.asarray(particle_charges).shape[0]
        elif positions is not None:
            particle_count = np.asarray(positions).shape[0]
        else:
            particle_count = 50

    if not sigma:
        sigma = np.ones((particle_count, 1))
    if not epsilon_lj:
        epsilon_lj = np.ones((particle_count, 1))

    if particle_charges is None:
        particle_charges = np.random.rand(particle_count, 1)
    if positions is None:
        positions = characteristic_length * np.random.rand(particle_count, 3)

    system = nbp.System(characteristic_length,
                        sigma,
                        epsilon_lj,
                        particle_charges,
                        positions,
                        lj=lj,
                        ewald=ewald,
                        use_neighbours=use_neighbours)
    return system