Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template for a class to calculate molecular volume
Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
- Loading branch information
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/org/openscience/cdk/geometry/volume/VABCVolume.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* Copyright (C) 2011 Egon Willighagen <egonw@users.sf.net> | ||
* | ||
* Contact: cdk-devel@lists.sourceforge.net | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public License | ||
* as published by the Free Software Foundation; either version 2.1 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
package org.openscience.cdk.geometry.volume; | ||
|
||
import org.openscience.cdk.annotations.TestClass; | ||
import org.openscience.cdk.interfaces.IMolecule; | ||
|
||
/** | ||
* Calculates the Vanderwaals volume using the method proposed | ||
* in {@cdk.cite Zhao2003}. The method is limited to molecules | ||
* with the folowing elements: H, C, N, O, F, Cl, Br, I, | ||
* P, S, As, B, Si, Se, and Te. | ||
* | ||
* @cdk.module standard | ||
* @cdk.keywords volume, molecular | ||
*/ | ||
@TestClass("org.openscience.cdk.geometry.volume.VABCVolumeTest") | ||
public class VABCVolume { | ||
|
||
/** | ||
* Calculates the volume for the given {@link IMolecule}. | ||
* | ||
* @param molecule {@link IMolecule} to calculate the volume of. | ||
* @return the volume in cubic Ångström. | ||
*/ | ||
public static double calculate(IMolecule molecule) { | ||
return 0.0; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/test/org/openscience/cdk/geometry/volume/VABCVolumeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* Copyright (C) 2011 Egon Willighagen <egonw@users.sf.net> | ||
* | ||
* Contact: cdk-devel@lists.sourceforge.net | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public License | ||
* as published by the Free Software Foundation; either version 2.1 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
package org.openscience.cdk.geometry.volume; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.openscience.cdk.exception.InvalidSmilesException; | ||
import org.openscience.cdk.interfaces.IMolecule; | ||
import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; | ||
import org.openscience.cdk.smiles.SmilesParser; | ||
|
||
public class VABCVolumeTest { | ||
|
||
private static SmilesParser smilesParser; | ||
|
||
@BeforeClass | ||
public static void setup() { | ||
smilesParser = new SmilesParser( | ||
NoNotificationChemObjectBuilder.getInstance() | ||
); | ||
} | ||
|
||
/** | ||
* Test from Table 1 from {@cdk.cite Zhao2003}. | ||
*/ | ||
@Test | ||
public void testMethane() throws InvalidSmilesException { | ||
IMolecule methane = smilesParser.parseSmiles("C"); | ||
double volume = VABCVolume.calculate(methane); | ||
Assert.assertEquals(25.83, volume, 0.01); | ||
} | ||
|
||
} |