Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pysimm/amber.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def cleanup_antechamber():
print('problem removing {} during cleanup'.format(fname))


def calc_charges(s, charge_method='bcc', cleanup=True):
def calc_charges(s, charge_method='bcc', net_charge='0', cleanup=True):
"""pysimm.amber.calc_charges

Calculates charges using antechamber. Defaults to am1-bcc charges.
Calculates charges using antechamber. Defaults to am1-bcc charges and neutral charge.

Args:
s: System for which to calculate charges. System object is updated in place
Expand All @@ -77,7 +77,7 @@ def calc_charges(s, charge_method='bcc', cleanup=True):
None
"""
s.write_pdb('pysimm.tmp.pdb')
cl = '{} -fi pdb -i pysimm.tmp.pdb -fo ac -o pysimm.tmp.ac -c {}'.format(ANTECHAMBER_EXEC, charge_method)
cl = '{} -fi pdb -i pysimm.tmp.pdb -fo ac -o pysimm.tmp.ac -c {} -nc {}'.format(ANTECHAMBER_EXEC, charge_method, net_charge)
p = Popen(cl.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE)
p.communicate()
with file('pysimm.tmp.ac') as f:
Expand Down
8 changes: 6 additions & 2 deletions pysimm/forcefield/dreiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ def assign_ptypes(self, s):
p.nbonds += 1
for p in s.particles:
if p.elem == 'H':
p.type_name = 'H_'
for pb in p.bonded_to:
if pb.elem == 'O' or pb.elem == 'N':
p.type_name = 'H___A'
if not p.type_name:
p.type_name = 'H_'
elif p.elem == 'C':
if p.bond_orders and (4 in p.bond_orders or 'A' in p.bond_orders):
p.type_name = 'C_R'
Expand Down Expand Up @@ -357,4 +361,4 @@ def assign_charges(self, s, charges='gasteiger'):
"""
if charges == 'gasteiger':
print('adding gasteiger charges')
gasteiger.set_charges(s)
gasteiger.set_charges(s)