Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Write a CHARGE command when the entity has a non-zero charge

  • Loading branch information...
commit 5e8181616a06778d54a0ad1da990fd0ac59b586f 1 parent b635613
@egonw egonw authored rajarshi committed
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/main/org/openscience/cdk/io/program/Mopac7Writer.java
View
4 src/main/org/openscience/cdk/io/program/Mopac7Writer.java
@@ -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.
@@ -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());
Please sign in to comment.
Something went wrong with that request. Please try again.