示例#1
0
def make_triangular_plate(atoms_per_side=10):
    """construct a single triangular plate
    """
    theta = 60. * np.pi / 180.
    v1 = np.array([1,0,0])
    v2 = np.array([0.5, np.sin(theta), 0])
    
    aps = atoms_per_side
    plate = RigidFragment()

    for i in xrange(aps-1):
        for j in xrange(aps-1):
            if i + j >= aps-1:
                break
            xnew = v1*i + v2*j
            if (i == 0 and j == 0 or 
                i == 0 and j == aps-2 or
                i == aps-2 and j == 0):
                atomtype = OTHER_TYPE
            elif i == 0:
                atomtype = EDGE1_TYPE
            elif j == 0:
                atomtype = EDGE2_TYPE
            elif i + j == aps-2:
                atomtype = EDGE3_TYPE
            else:
                atomtype = OTHER_TYPE
            plate.add_atom(atomtype, xnew, 1)

#    draw(coords)
    plate.finalize_setup()
    return plate
示例#2
0
def make_otp():
    """this constructs a single OTP molecule"""
    otp = RigidFragment()
    otp.add_atom("O", np.array([0.0, -2.0 / 3 * np.sin(7.0 * pi / 24.0), 0.0]), 1.0)
    otp.add_atom("O", np.array([cos(7.0 * pi / 24.0), 1.0 / 3.0 * sin(7.0 * pi / 24.0), 0.0]), 1.0)
    otp.add_atom("O", np.array([-cos(7.0 * pi / 24.0), 1.0 / 3.0 * sin(7.0 * pi / 24), 0.0]), 1.0)
    otp.finalize_setup()
    return otp
示例#3
0
def water():
    water = RigidFragment()
    rho   = 0.9572
    theta = 104.52/180.0*pi      
    water.add_atom("O", np.array([0., 0., 0.]), 16.)
    water.add_atom("H", rho*np.array([0.0, sin(0.5*theta), cos(0.5*theta)]), 1.)
    water.add_atom("H", rho*np.array([0.0, -sin(0.5*theta), cos(0.5*theta)]), 1.)
    water.finalize_setup()
    return water
示例#4
0
def make_otp():
    """this constructs a single OTP molecule"""
    otp = RigidFragment()
    otp.add_atom("O", np.array([0.0, -2. / 3 * np.sin(7. * pi / 24.), 0.0]),
                 1.)
    otp.add_atom(
        "O", np.array([cos(7. * pi / 24.), 1. / 3. * sin(7. * pi / 24.), 0.0]),
        1.)
    otp.add_atom(
        "O", np.array([-cos(7. * pi / 24.), 1. / 3. * sin(7. * pi / 24), 0.0]),
        1.)
    otp.finalize_setup()
    return otp
示例#5
0
文件: tip4p.py 项目: spraharsh/pele
def water():
    water = RigidFragment()
    rho = 0.9572
    theta = 104.52 / 180.0 * pi
    water.add_atom("O", np.array([0., 0., 0.]), 16.)
    water.add_atom("H",
                   rho *
                   np.array([0.0, sin(0.5 * theta),
                             cos(0.5 * theta)]), 1.)
    water.add_atom("H",
                   rho * np.array([0.0, -sin(0.5 * theta),
                                   cos(0.5 * theta)]), 1.)
    water.finalize_setup()
    return water
示例#6
0
文件: oxgui.py 项目: spraharsh/pele
def create_base():
    base = RigidFragment()
    base.add_atom("O", np.array([-0.4, 0., 0.]), 1.)
    base.add_atom("H", np.array([0.4, 0., 0.]), 1.)
    base.finalize_setup(shift_com=False)
    
    print("inversion:\n", base.inversion)
    print("symmetry:\n", base.symmetries)
    base.inversion=None
    
    return base
示例#7
0
def create_pap():
    pap = RigidFragment()
    rho   = 0.3572
    theta = 104.52/180.0*pi      
    pap.add_atom("O", np.array([0., 0., 0.]), 1.)
    pap.add_atom("H", np.array([-0.038490, 0.1204928, 0.3794728]), 1.)
    pap.add_atom("C", np.array([-0.038490, -0.1204928, -0.3794728]), 1.)
    pap.finalize_setup(shift_com=False)
    
    print "inversion:\n", pap.inversion
    print "symmetry:\n", pap.symmetries
    pap.inversion=None
    #print pap.S
    #pap.S = 0.3*np.identity(3)
    return pap
示例#8
0
def create_base():
    base = RigidFragment()
    base.add_atom("O", np.array([-0.4, 0., 0.]), 1.)
    base.add_atom("H", np.array([0.4, 0., 0.]), 1.)
    base.finalize_setup(shift_com=False)
    
    print "inversion:\n", base.inversion
    print "symmetry:\n", base.symmetries
    base.inversion=None
    
    return base
示例#9
0
文件: test_otp.py 项目: jdf43/pele
 def make_otp(self):
     """this constructs a single OTP molecule"""
     otp = RigidFragment()
     otp.add_atom("O", np.array([0.0, -2./3 * np.sin( 7.*pi/24.), 0.0]), 1.)
     otp.add_atom("O", np.array([cos( 7.*pi/24.),  1./3. * sin( 7.* pi/24.), 0.0]), 1.)
     otp.add_atom("O", np.array([-cos( 7.* pi/24.),  1./3. * sin( 7.*pi/24), 0.0]), 1.)
     otp.finalize_setup()
     print "otp"
     print otp.atom_positions
     return otp
示例#10
0
def make_triangular_plate(atoms_per_side=8):
    """construct a single triangular plate
    """
    theta = 60. * np.pi / 180.
    v1 = np.array([1,0,0])
    v2 = np.array([0.5, np.sin(theta), 0])
    
    aps = atoms_per_side
    plate = RigidFragment()

    for i in range(aps-1):
        for j in range(aps-1):
            if i + j >= aps-1:
                break
            xnew = v1*i + v2*j
            if (i == 0 and j == 0 or 
                i == 0 and j == aps-2 or
                i == aps-2 and j == 0):
                atomtype = OTHER_TYPE
            elif i == 0:
                atomtype = EDGE1_TYPE
            elif j == 0:
                atomtype = EDGE2_TYPE
            elif i + j == aps-2:
                atomtype = EDGE3_TYPE
            else:
                atomtype = OTHER_TYPE
            plate.add_atom(atomtype, xnew, 1)

#    draw(coords)
    plate.finalize_setup()
    return plate
示例#11
0
def create_pap():
    pap = RigidFragment()
    rho = 0.3572
    theta = 104.52 / 180.0 * pi
    pap.add_atom("O", np.array([0., 0., 0.]), 1.)
    pap.add_atom("H", np.array([-0.038490, 0.1204928, 0.3794728]), 1.)
    pap.add_atom("C", np.array([-0.038490, -0.1204928, -0.3794728]), 1.)
    pap.finalize_setup(shift_com=False)

    print "inversion:\n", pap.inversion
    print "symmetry:\n", pap.symmetries
    pap.inversion = None
    #print pap.S
    #pap.S = 0.3*np.identity(3)
    return pap