How to use the pyscal.core.System function in pyscal

To help you get started, we’ve selected a few pyscal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github srmnitc / pyscal / tests / test_nucsize.py View on Github external
def test_complex_system():
    sys = pc.System()
    sys.read_inputfile('examples/cluster.dump')
    sys.find_neighbors(method='cutoff', cutoff=3.63)
    assert 176 == sys.find_solids(bonds=6, threshold=0.5, avgthreshold=0.6, cluster=True)
github srmnitc / pyscal / tests / test_neighbors.py View on Github external
def test_neighbors_system():
    #create some atoms
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [6, 6, 6])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    #test that atoms are set properly
    assert len(sys.atoms) == 432

    #then lets find neighbors
    #cutoff method - first shell only
    sys.find_neighbors(method = 'cutoff', cutoff=0.867)
    #any atom should have 8 neighbors
    atoms = sys.atoms
    assert atoms[0].coordination == 8

    sys.reset_neighbors()

    #cutoff method - second shell
github srmnitc / pyscal / tests / test_pickling.py View on Github external
def test_pickle_system():

    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [1, 1, 1])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims
    sys.find_neighbors(method = 'voronoi')

    #test write and read system
    sys.to_pickle('tests/sy.npy')

    #now read the pickled system
    psys = pc.System()
    psys.from_pickle('tests/sy.npy')

    #now get atoms and a random number of atom
    satoms = sys.atoms
    patoms = psys.atoms

    rn = np.random.randint(0, len(satoms)-1)
github srmnitc / pyscal / tests / test_q10.py View on Github external
def test_q_10():
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [4, 4, 4])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    sys.find_neighbors(method = 'voronoi')

    sys.calculate_q(10, averaged=True)
    q = sys.get_qvals(10, averaged=True)
    assert np.round(np.mean(np.array(q)), decimals=2) == 0.41
github srmnitc / pyscal / tests / test_q8.py View on Github external
def test_q_8():
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [4, 4, 4])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims

    sys.find_neighbors(method = 'voronoi')

    sys.calculate_q(8, averaged=True)
    q = sys.get_qvals(8, averaged=True)
    assert np.round(np.mean(np.array(q)), decimals=2) == 0.33
github srmnitc / pyscal / tests / test_voronoi.py View on Github external
def test_voro_props():
    atoms, boxdims = pcs.make_crystal('bcc', repetitions = [2, 2, 2])
    sys = pc.System()
    sys.atoms = atoms
    sys.box = boxdims


    sys.find_neighbors(method = 'voronoi')
    sys.calculate_vorovector()
    atoms = sys.atoms
    atom = atoms[0]
    v = atom.vorovector
    assert v == [0,6,0,8]
github pyiron / pyiron / pyiron / atomistics / structure / pyscal.py View on Github external
def _get_steinhardt_parameter(cell, positions, cutoff=3.50, n_clusters=2, q=[4, 6]):
    sys = pc.System()
    prism = UnfoldingPrism(cell, digits=15)
    xhi, yhi, zhi, xy, xz, yz = prism.get_lammps_prism_str()
    coords = [prism.pos_to_lammps(position) for position in positions]
    sys.box = [[0.0, float(xhi)], [0.0, float(yhi)], [0.0, float(zhi)]]
    sys.atoms = [pc.Atom(pos=p, id=i) for i, p in enumerate(coords)]
    sys.find_neighbors(method='cutoff', cutoff=cutoff)
    sys.calculate_q(q, averaged=True)
    sysq = sys.get_qvals(q, averaged=True)
    cl = cluster.KMeans(n_clusters=n_clusters)
    ind = cl.fit(list(zip(*sysq))).labels_ == 0
    return sysq, ind