Esempio n. 1
0
    def __init__(self,
                 ff_file_path,
                 label='reaxff',
                 specorder=None,
                 implementation='C',
                 update_charges=True,
                 save_bond_orders=False,
                 debug_energy=False,
                 **kwargs):

        LAMMPSBase.__init__(self,
                            label,
                            update_charges=update_charges,
                            **kwargs)

        self.parameters.atom_style = 'charge'
        self.parameters.pair_style = 'reax'
        if implementation == 'C':
            self.parameters.pair_style += '/c NULL'
            self.parameters.extra_cmds.append(
                'fix qeq all qeq/reax 1 0.0 10.0 1.0e-6 reax/c')

        self.parameters.units = 'real'

        if not specorder:
            self.specorder = get_element_order(ff_file_path)
        else:
            self.specorder = specorder

        self.ff_file = ff_file_path
        self.ff_data = FFData()

        self.save_bond_orders = save_bond_orders
        """
Esempio n. 2
0
mhg oh   ho 30.0    109.47
cao oh   ho 30.0    109.47
cah oh   ho 30.0    109.47
feo oh   ho 30.0    109.47
lio oh   ho 30.0    109.47
ao  ohs  ho 30.0    109.47
at  ohs  ho 30.0    109.47
mgo ohs  ho 30.0    109.47
mhg ohs  ho 30.0    109.47
cao ohs  ho 30.0    109.47
cah ohs  ho 30.0    109.47
feo ohs  ho 30.0    109.47
lio ohs  ho 30.0    109.47
'''

ff_data = FFData()

rho_fac = 2**(-1. / 6)
charges = {}
for line in nonbond_data.strip().split('\n'):
    fields = line.split()
    charges[fields[0]] = float(fields[1])
    parameters = [float(fields[2]), float(fields[3]) * rho_fac]
    ff_data.add('atom', fields[0], 'Pair Coeffs', parameters)

for line in bond_stretch_data.strip().split('\n'):
    fields = line.split()
    parameters = map(float, fields[2:4])
    ff_data.add('bond', SequenceType(fields[:2]), 'Bond Coeffs', parameters)

for line in angle_bend_data.strip().split('\n'):
Esempio n. 3
0
mhg oh   ho 30.0    109.47
cao oh   ho 30.0    109.47
cah oh   ho 30.0    109.47
feo oh   ho 30.0    109.47
lio oh   ho 30.0    109.47
ao  ohs  ho 30.0    109.47
at  ohs  ho 30.0    109.47
mgo ohs  ho 30.0    109.47
mhg ohs  ho 30.0    109.47
cao ohs  ho 30.0    109.47
cah ohs  ho 30.0    109.47
feo ohs  ho 30.0    109.47
lio ohs  ho 30.0    109.47
'''

ff_data = FFData()

rho_fac = 2**(-1./6)
charges = {}
for line in nonbond_data.strip().split('\n'):
	fields = line.split()
	charges[fields[0]] = float(fields[1])
	parameters = [float(fields[2]), float(fields[3])*rho_fac]
	ff_data.add('atom', fields[0], 'Pair Coeffs', parameters)

for line in bond_stretch_data.strip().split('\n'):
	fields = line.split()
	parameters = map(float, fields[2:4])
	ff_data.add('bond', SequenceType(fields[:2]), 'Bond Coeffs', parameters)

for line in angle_bend_data.strip().split('\n'):
Esempio n. 4
0
def read(infile):
	result = FFData()
	
	def parser(infile):
		for line in infile:
			if line.startswith('BONDS') or \
				line.startswith('ANGLES') or \
				line.startswith('DIHEDRALS') or \
				line.startswith('IMPROPERS') or \
				line.startswith('NONBONDED') or \
				line.startswith('HBOND'):
				break
			
			line = line.replace('!HGTIP', 'HGTIP')
			line = line.replace('!OGTIP', 'OGTIP')
			yield line.split('!')[0].split()
	
	# Skip masses
	for item in parser(infile): pass
		
	# Bonds
	for fields in parser(infile):
		if len(fields) != 4: continue
		
		type = SequenceType(fields[0:2])
		parameters = [float(f) for f in fields[2:]]
		result.bond[type] = {'Bond Coeffs': parameters}
	
	# Angles
	for fields in parser(infile):
		if len(fields) == 5: fields += [0, 0]
		if len(fields) != 7: continue
		
		type = SequenceType(fields[0:3])
		parameters = [float(f) for f in fields[3:]]
		result.angle[type] = {'Angle Coeffs': parameters}
		
	# Dihedrals
	for fields in parser(infile):
		if len(fields) == 7: fields += [0]
		if len(fields) != 8: continue
		
		type = SequenceType(fields[0:4])
		parameters = [float(fields[4]), int(fields[5]), int(float(fields[6])), float(fields[7])]
		result.dihedral[type] = {'Dihedral Coeffs': parameters}
		
	# Impropers
	for fields in parser(infile):
		if len(fields) != 7: continue
		
		type = ImproperType(central_type=fields[0], other_types=fields[1:4])
		parameters = [float(f) for f in fields[4:7:2]]
		result.improper[type] = {'Improper Coeffs': parameters}
	
	# Nonbonded
	for fields in parser(infile):
		if len(fields) == 4: fields += [0, 0, 0]
		if len(fields) != 7: continue
		
		eps = -float(fields[2])
		rmin = float(fields[3])*2
		sigma = rmin*2**(-1./6)
		
		type = fields[0]
		parameters = [eps, sigma]
		result.atom[type] = {'Pair Coeffs': parameters}
		
	return result
	
Esempio n. 5
0
def read(infile):
    result = FFData()

    def parser(infile):
        for line in infile:
            if line.startswith('BONDS') or \
             line.startswith('ANGLES') or \
             line.startswith('DIHEDRALS') or \
             line.startswith('IMPROPERS') or \
             line.startswith('NONBONDED') or \
             line.startswith('HBOND'):
                break

            line = line.replace('!HGTIP', 'HGTIP')
            line = line.replace('!OGTIP', 'OGTIP')
            yield line.split('!')[0].split()

    # Skip masses
    for item in parser(infile):
        pass

    # Bonds
    for fields in parser(infile):
        if len(fields) != 4: continue

        type = SequenceType(fields[0:2])
        parameters = [float(f) for f in fields[2:]]
        result.bond[type] = {'Bond Coeffs': parameters}

    # Angles
    for fields in parser(infile):
        if len(fields) == 5: fields += [0, 0]
        if len(fields) != 7: continue

        type = SequenceType(fields[0:3])
        parameters = [float(f) for f in fields[3:]]
        result.angle[type] = {'Angle Coeffs': parameters}

    # Dihedrals
    for fields in parser(infile):
        if len(fields) == 7: fields += [0]
        if len(fields) != 8: continue

        type = SequenceType(fields[0:4])
        parameters = [
            float(fields[4]),
            int(fields[5]),
            int(float(fields[6])),
            float(fields[7])
        ]
        result.dihedral[type] = {'Dihedral Coeffs': parameters}

    # Impropers
    for fields in parser(infile):
        if len(fields) != 7: continue

        type = ImproperType(central_type=fields[0], other_types=fields[1:4])
        parameters = [float(f) for f in fields[4:7:2]]
        result.improper[type] = {'Improper Coeffs': parameters}

    # Nonbonded
    for fields in parser(infile):
        if len(fields) == 4: fields += [0, 0, 0]
        if len(fields) != 7: continue

        eps = -float(fields[2])
        rmin = float(fields[3]) * 2
        sigma = rmin * 2**(-1. / 6)

        type = fields[0]
        parameters = [eps, sigma]
        result.atom[type] = {'Pair Coeffs': parameters}

    return result