Skip to content

Commit

Permalink
Added 'findType' function to Forcefield variable. Added 'epsrmol' exp…
Browse files Browse the repository at this point in the history
…ort filter. Fixed - 'atomTypes' array accessor in Forcefield variable would only ever return the first element of the array, even if an array index was specified. Updated manual
  • Loading branch information
trisyoungs committed Dec 3, 2013
1 parent b579479 commit 0d8d9ca
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(Aten)
set(DESCRIPTION "Aten - Atomic configuration builder and editor")
set(AUTHOR "Tristan Youngs")
set(VERSION_MAJOR "1")
set(VERSION_MINOR "853")
set(VERSION_MINOR "854")
set(VERSION_PATCH "1")

set(CMAKE_BUILD_TYPE "Release")
Expand Down
2 changes: 1 addition & 1 deletion aten.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Name, brief description, and version
Summary: Aten - Atomic configuration builder and editor
Name: %{shortname}
Version: 1.853
Version: 1.854
Release: 1
License: GPL
%define fullname %{name}-%{version}
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
AC_PREREQ(2.60)

# Set program name, version, bug-address and source directory
m4_define([ATEN_VERSION],[1.853])
m4_define([ATEN_VERSION],[1.854])
AC_INIT(aten,ATEN_VERSION,[email protected])
AC_CONFIG_SRCDIR([src/main.cpp])

Expand Down
119 changes: 119 additions & 0 deletions data/filters/epsrmol
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# EPSR '.mol' file export
# Created: 02/12/2013
# Last modified: 02/12/2013
# ChangeLog:
# 02/12/2013 - Initial version

filter(type="exportmodel",name="EPSR Molfile", extension="mol", glob="*.mol", nickname="epsrmol")
{
# Variable declaration
pattern p;
int nvdw, n, nc, n2, nconstraints;
model m = aten.model;

# Main dialog creation function
void createDefaultDialog(Dialog ui)
{
Widget w;
ui.title = "EPSR Mol File Export Options";
ui.verticalFill = TRUE;

ui.addDoubleSpin("temperature", "Temperature", 0.0, 100000.0, 10.0, 300.0);
ui.addDoubleSpin("epsr_vtemp", "Vibrational Temperature", 0.0, 1500.0, 10.0, 65.0);
ui.addDoubleSpin("epsr_density", "Density (atoms/ang3)", 0.0, 10.0, 0.01, 0.1);
ui.addDoubleSpin("epsr_ecore", "Energy for core repulsion terms", 0.0, 10.0, 0.1, 1.0);
ui.addDoubleSpin("epsr_dcore", "Distance for core repulsion terms", 0.0, 10.0, 0.1, 1.0);
}
if (!showDefaultDialog()) error("Canceled through dialog.\n");
Dialog ui = defaultDialog();

# Create a temporary forcefield to store our terms in
Forcefield dummyFF = newFF("Dummy FF");

# Write distinguishing header line - we will use no atom ID offset
writeLineF(" .gmol 0\n");

# Write atom coordinates and bonds
for (Atom i = m.atoms; i; ++i)
{
writeLineF(" atom %i %s %f %f %f %i", i.id, i.type.name, i.rx, i.ry, i.rz, i.nBonds);
if (!dummyFF.findType(i.type.name))
{
int id = dummyFF.nAtomTypes+1;
FFAtom x = dummyFF.addType(id, i.type.name, i.type.name, i.z, "", "");
dummyFF.addInter("lj", id, i.type.charge, i.type.data[1], i.type.data[2]);
}
for (Bond b = i.bonds; b; ++b) writeLineF(" %i", b.partner(i).id);
writeLineF("\n");
}

# Loop over bonds and angles in the system, creating a 'dummy' forcefield for them
for (Bond b = m.bonds; b; ++b)
{
if (dummyFF.findBond(b.i.type.name, b.j.type.name)) continue;
dummyFF.addBond("harmonic", b.i.type.name, b.j.type.name, 0.0, geometry(b.i, b.j));
writeLineF("bond %s %s %f\n", b.i.type.name, b.j.type.name, geometry(b.i, b.j));
}
for (Atom j = m.atoms; j; ++j)
{
for (Bond b1 = j.bonds; b1; ++b1)
{
for (Bond b2 = b1; b2; ++b2)
{
if (b1 == b2) continue;
Atom i = b1.partner(j);
Atom k = b2.partner(j);
if (dummyFF.findAngle(i.type.name, j.type.name, k.type.name)) continue;
dummyFF.addAngle("harmonic", i.type.name, j.type.name, k.type.name, 0.0, geometry(i, j, k));
writeLineF("angle %s %s %s %f\n", i.type.name, j.type.name, k.type.name, geometry(i, j, k));
}
}
}

# Write dihedral information
for (Bond b = m.bonds; b; ++b)
{
# Loop over other bonds at first terminus, excluding the central one 'b'
for (Bond bi = b.i.bonds; bi; ++bi)
{
if (bi == b) continue;

# Loop over other bonds at second terminus, excluding the central one 'b'
for (Bond bj = b.j.bonds; bj; ++bj)
{
if (bj == b) continue;
Atom i = bi.partner(b.i);
Atom j = b.i;
Atom k = b.j;
Atom l = bj.partner(b.j);
writeLineF("dihedral %3i %3i %3i %3i %f\n", i.id, j.id, k.id, l.id, geometry(i,j,k,l) );
}
}
}

# Write rotational headgroup specifications
for (Bond b = m.bonds; b; ++b)
{
if (b.i.fixed && b.j.fixed) continue;
if (b.i.nBonds == 1) continue;
if (b.j.nBonds == 1) continue;
writeLineF("rot %i %i\n", b.i.id, b.j.id);
}

# Potential parameters
for (n=2; n<=dummyFF.nAtomTypes; ++n)
{
FFAtom at = dummyFF.atomTypes[n];
writeLineF("potential %s %f %f %f %f %s\n", at.name, at.data[1], at.data[2], aten.elements[at.z].mass, at.charge, aten.elements[at.z].symbol);
}

# Other variables
writeLineF("temperature %f\n", ui.asDouble("temperature"));
writeLineF("vibtemp %f\n", ui.asDouble("epsr_vtemp"));
writeLineF("density %f\n", ui.asDouble("epsr_density"));
writeLineF("ecoredcore %f %f\n", ui.asDouble("epsr_ecore"), ui.asDouble("epsr_dcore"));

# Remove our temporary forcefield
deleteFF(dummyFF);
}

Binary file modified doc/manual.docm
Binary file not shown.
Binary file modified doc/manual.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions extra/aten.dsc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Format: 1.0
Source: aten
Version: 1.853
Version: 1.854
Binary: aten
Maintainer: Tristan Youngs <[email protected]>
Architecture: any
Build-Depends: debhelper (>= 4.1.16), libqt4-dev | libqt4-core, libqt4-opengl-dev, libreadline5-dev | libreadline-dev, libgl1-mesa-dev, pkgconfig | pkg-config, libncurses5
Files:
c9261a9523963a7d298046de12c9b803 4307358 aten-1.853.tar.gz
c9261a9523963a7d298046de12c9b803 4307358 aten-1.854.tar.gz
4 changes: 2 additions & 2 deletions src/main/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef ATEN_VERSION_H
#define ATEN_VERSION_H

#define ATENVERSION "1.853"
#define ATENREVISION "1853"
#define ATENVERSION "1.854"
#define ATENREVISION "1854"
#define ATENDATE "Thu 28 Jun - 13:36"
#define ATENURL "http://aten.googlecode.com/svn/trunk"

Expand Down
16 changes: 14 additions & 2 deletions src/parser/forcefield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ FunctionAccessor ForcefieldVariable::functionData[ForcefieldVariable::nFunctions
{ "findBond", VTypes::ForcefieldBoundData, "CC", "string typei, string typej" },
{ "findImproper", VTypes::ForcefieldBoundData, "CCCC", "string typei, string typej, string typek, string typel" },
{ "findTorsion", VTypes::ForcefieldBoundData, "CCCC", "string typei, string typej, string typek, string typel" },
{ "findType", VTypes::ForcefieldAtomData, "C", "string type" },
{ "findUreyBradley", VTypes::ForcefieldBoundData, "CCC", "string typei, string typej, string typek" }
};

Expand Down Expand Up @@ -183,7 +184,16 @@ bool ForcefieldVariable::retrieveAccessor(int i, ReturnValue &rv, bool hasArrayI
if (result) switch (acc)
{
case (ForcefieldVariable::AtomTypes):
rv.set(VTypes::ForcefieldAtomData, ptr->types());
if (hasArrayIndex)
{
if (arrayIndex > ptr->nTypes())
{
msg.print("Error: Array index is out of bounds for 'atomTypes' accessor (n = %i, nTypes = %i)\n", arrayIndex, ptr->nTypes());
return FALSE;
}
else rv.set(VTypes::ForcefieldAtomData, ptr->type(arrayIndex-1));
}
else rv.set(VTypes::ForcefieldAtomData, ptr->types());
break;
case (FileName):
rv.set( ptr->filename() );
Expand Down Expand Up @@ -353,10 +363,12 @@ bool ForcefieldVariable::performFunction(int i, ReturnValue &rv, TreeNode *node)
case (ForcefieldVariable::FindTorsion):
rv.set(VTypes::ForcefieldBoundData, ptr->findTorsion(node->argc(0), node->argc(1), node->argc(2), node->argc(3)));
break;
case (ForcefieldVariable::FindType):
rv.set(VTypes::ForcefieldAtomData, ptr->findType(node->argc(0)));
break;
case (ForcefieldVariable::FindUreyBradley):
rv.set(VTypes::ForcefieldBoundData, ptr->findUreyBradley(node->argc(0), node->argc(1), node->argc(2)));
break;

default:
printf("Internal Error: Access to function '%s' has not been defined in ForcefieldVariable.\n", functionData[i].name);
result = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/parser/forcefield.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ForcefieldVariable : public PointerVariable
// Accessor list
enum Accessors { AtomTypes, FileName, Name, NAngles, NAtomTypes, NBonds, NImpropers, NTorsions, Units, nAccessors };
// Function list
enum Functions { AddAngle, AddBond, AddInter, AddTorsion, AddType, Finalise, FindAngle, FindBond, FindImproper, FindTorsion, FindUreyBradley, nFunctions };
enum Functions { AddAngle, AddBond, AddInter, AddTorsion, AddType, Finalise, FindAngle, FindBond, FindImproper, FindTorsion, FindType, FindUreyBradley, nFunctions };
// Search variable access list for provided accessor
StepNode *findAccessor(const char *s, TreeNode *arrayindex, TreeNode *arglist = NULL);
// Static function to search accessors
Expand Down

0 comments on commit 0d8d9ca

Please sign in to comment.