Skip to content

Commit

Permalink
Write a CHARGE command when the entity has a non-zero charge
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw authored and rajarshi committed Jan 31, 2012
1 parent b635613 commit 5e81816
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/org/openscience/cdk/io/program/Mopac7Writer.java
Expand Up @@ -50,6 +50,7 @@
import org.openscience.cdk.io.setting.StringIOSetting;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;

/**
* Prepares input file for running MOPAC.
Expand Down Expand Up @@ -110,6 +111,9 @@ public synchronized void write(IChemObject arg0) throws CDKException {
try {
IAtomContainer container = (IAtomContainer) arg0;
writer.write(mopacCommands.getSetting());
int formalCharge = AtomContainerManipulator.getTotalFormalCharge(container);
if (formalCharge != 0)
writer.write(" CHARGE=" + formalCharge);
writer.newLine();
if (container.getProperty("Names") != null)
writer.write(container.getProperty("Names").toString());
Expand Down

0 comments on commit 5e81816

Please sign in to comment.