Esempio n. 1
0
def draw_molecule(molecule):
    import mogli

    mol = mogli.Molecule(positions=molecule.get_coordinates(),
                         atomic_numbers=molecule.get_atomic_numbers())

    mogli.show(mol, bonds_param=1.5, title='Molecule')
Esempio n. 2
0
def test_show():
    """
    Show a molecule and close the window after 1 second.
    """
    def alarm_handler(signal_number, stack_frame):
        """
        Close the current GLFW window when called due to a SIGALRM.
        """
        assert signal_number == signal.SIGALRM
        window = glfw.get_current_context()
        assert window is not None
        glfw.set_window_should_close(window, True)

    molecule = mogli.read('examples/dna.xyz')[0]
    # Set the signal handler
    signal.signal(signal.SIGALRM, alarm_handler)
    # Set the alarm to 1 second (and check no previous alarm had been set)
    assert signal.alarm(1) == 0
    # Show the molecule (and open the GLFW window closed by the alarm handler)
    mogli.show(molecule)
Esempio n. 3
0
def test_show():
    """
    Show a molecule and close the window after 1 second.
    """
    def alarm_handler(signal_number, stack_frame):
        """
        Close the current GLFW window when called due to a SIGALRM.
        """
        assert signal_number == signal.SIGALRM
        window = glfw.get_current_context()
        assert window is not None
        glfw.set_window_should_close(window, True)

    molecule = mogli.read('examples/dna.xyz')[0]
    # Set the signal handler
    signal.signal(signal.SIGALRM, alarm_handler)
    # Set the alarm to 1 second (and check no previous alarm had been set)
    assert signal.alarm(1) == 0
    # Show the molecule (and open the GLFW window closed by the alarm handler)
    mogli.show(molecule)
Esempio n. 4
0
"""
Example for interactively displaying a molecule using mogli
"""
import mogli

molecules = mogli.read('examples/dna.xyz')
for molecule in molecules:
    mogli.show(molecule, bonds_param=1.15)
Esempio n. 5
0
    #PRZEKSZTALCA LISTE ATOMY W TEKST GOTOWY DO WKLEJENIA DO PLIKU
    def dane(self):
        tekst = str(N + 1) + "\n" + "linia komentarza"
        for element in self.atomy:
            tekst = (tekst + "\n" + str(element))
        return tekst

    #'{0:s},{1:f}x,{2:f}y,{3:f}z\n'.format('Ar',x[i],y[i],z)

    def zapisz(self, nazwa_pliku):
        fout = open(nazwa_pliku, "w+")
        fout.write(self.dane())
        fout.close()


p = populacja(h_max=1.4)

#parametry
h = p.h_max
V = m.pi * R * R * h
Va = (4 / 3) * m.pi * r**3
sigma = N * Va / V

#print(p.dane())
print("h =", h, "V =", 2 * m.pi * r * h, "sigma =", sigma)
p.zapisz("dane.xyz")

molecules = mogli.read('dane.xyz')
mogli.show(molecules[0], bonds_param=d_max)
Esempio n. 6
0
            self.atomy.append(a)

    #PRZEKSZTALCA LISTE ATOMY W TEKST GOTOWY DO WKLEJENIA DO PLIKU
    def dane(self):
        tekst = str(N + 1) + "\n" + "linia komentarza"
        for element in self.atomy:
            tekst = (tekst + "\n" + str(element))
        return tekst

    def zapisz(self, nazwa_pliku):
        fout = open(nazwa_pliku, "w+")
        fout.write(self.dane())
        fout.close()


p = populacja(h_max=1.4)

#parametry
h = p.h_max
V = m.pi * R * R * h
Va = (4 / 3) * m.pi * r**3
sigma = N * Va / V

#print(p.dane())
print("h =", h, "V =", 2 * m.pi * r * h, "sigma =", sigma)
p.zapisz("dane.xyz")

molecules = mogli.read('dane.xyz')
mogli.show(molecules[0], bonds_param=1)