There is a maintenance of MPCDF Gitlab on Thursday, April 22st 2020, 9:00 am CEST - Expect some service interruptions during this time

Commit 0cd794a4 authored by Berk Onat's avatar Berk Onat

Initial commit for complete parser

parents
# GROMOS Parser
[NOMAD Laboratory CoE](http://nomad-coe.eu) parser for [GROMOS]()
## Version 0.0.1
This is the parser for GROMOS in [GROMOS]().
The official version lives at:
git@gitlab.mpcdf.mpg.de:nomad-lab/parser-gromos.git
You can browse it at:
https://gitlab.rzg.mpg.de/nomad-lab/parser-gromos
It relies on having the nomad-meta-info and the python-common repositories one level higher.
The simplest way to have this is to check out nomad-lab-base recursively:
git clone --recursive git@gitlab.mpcdf.mpg.de:nomad-lab/nomad-lab-base.git
This parser will be in the directory parsers/gromos of this repository.
## Running and Testing the Parser
### Requirements
The required python packages can be installed with (see [python-common](https://gitlab.rzg.mpg.de/nomad-lab/python-common)):
pip install -r nomad-lab-base/python-common/requirements.txt
### Usage
GROMOS MD log output files can be parsed with:
python GROMOSParser.py [path/toFile]
### Test Files
Example log output files of GROMOS can be found in the directory test/examples.
More details about the calculations and files are explained in README file of test/examples.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.1 virtualenv at /labEnv3" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/parser-amber.iml" filepath="$PROJECT_DIR$/.idea/parser-amber.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="projectConfiguration" value="Nosetests" />
<option name="PROJECT_TEST_RUNNER" value="Nosetests" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7426a5df-0b63-4709-ab28-0c6e68476f74" name="Default" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="303" />
<option name="y" value="66" />
<option name="width" value="1602" />
<option name="height" value="1164" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="parser-amber" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="parser-amber" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="parser-amber" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<method />
</configuration>
<configuration default="true" type="Tox" factoryName="Tox">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="parser-amber" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Doctests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="parser-amber" />
<option name="SCRIPT_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="FOLDER_NAME" value="" />
<option name="TEST_TYPE" value="TEST_SCRIPT" />
<option name="PATTERN" value="" />
<option name="USE_PATTERN" value="false" />
<method />
</configuration>
<configuration default="true" type="tests" factoryName="Nosetests">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="parser-amber" />
<option name="_new_regexPattern" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;.&quot;" />
<option name="_new_targetType" value="&quot;PATH&quot;" />
<method />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="7426a5df-0b63-4709-ab28-0c6e68476f74" name="Default" comment="" />
<created>1497006387415</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1497006387415</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="303" y="66" width="1602" height="1164" extended-state="0" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2496879" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32968035" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Data View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$PROJECT_DIR$/../.." />
</ignored-roots>
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/AMBERParser.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#24#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/AMBERParser.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="42" column="61" lean-forward="false" selection-start-line="42" selection-start-column="61" selection-end-line="42" selection-end-column="61" />
<folding>
<element signature="e#0#24#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
import logging
import os
PARSERNAME = "GROMOS"
PROGRAMNAME = "gromos"
PARSERVERSION = "0.0.1"
PARSERMETANAME = PARSERNAME.lower()
PARSERTAG = 'x_' + PARSERMETANAME
PARSER_INFO_DEFAULT = {
'name' : PARSERMETANAME+'-parser',
'version': PARSERVERSION
}
META_INFO_PATH = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../../../../nomad-meta-info/meta_info/nomad_meta_info/"+PARSERMETANAME+".nomadmetainfo.json"))
LOGGER = logging.getLogger("nomad."+PROGRAMNAME+"Parser")
def set_excludeList(self):
"""Sets the exclude list for x_
Returns:
the list of names
"""
excludelist = [
PARSERTAG+'_mdin_verbatim_writeout',
PARSERTAG+'_dumm_text',
PARSERTAG+'_dummy',
PARSERTAG+'_mdin_wt'
]
excludelist.extend([PARSERTAG+'_mdin_file_%s' % fileNL.lower() for fileNL in self.fileDict.keys()])
excludelist.extend([PARSERTAG+'_mdin_%s' % cntrlNL.lower() for cntrlNL in self.cntrlDict.keys()])
excludelist.extend([PARSERTAG+'_mdin_%s' % ewaldNL.lower() for ewaldNL in self.ewaldDict.keys()])
excludelist.extend([PARSERTAG+'_mdin_%s' % qmmmNL.lower() for qmmmNL in self.qmmmDict.keys()])
return excludelist
def set_includeList():
"""Sets the include list for x_
Returns:
the list of names
"""
includelist = []
return includelist
This diff is collapsed.
This diff is collapsed.
import sys
import os
import os.path
basedir = os.path.dirname(os.path.abspath(__file__))
commondir = os.path.normpath(os.path.join(basedir,"../../../../python-common/common/python"))
if not commondir in sys.path:
sys.path.insert(0, commondir)
package eu.nomad_lab.parsers
import eu.nomad_lab
import eu.nomad_lab.DefaultPythonInterpreter
import org.{ json4s => jn }
import eu.{ nomad_lab => lab }
import scala.collection.breakOut
object GromosParser extends SimpleExternalParserGenerator(
name = "GromosParser",
parserInfo = jn.JObject(
("name" -> jn.JString("GromosParser")) ::
("parserId" -> jn.JString("GromosParser" + lab.GromosVersionInfo.version)) ::
("versionInfo" -> jn.JObject(
("nomadCoreVersion" -> jn.JObject(lab.NomadCoreVersionInfo.toMap.map {
case (k, v) => k -> jn.JString(v.toString)
}(breakOut): List[(String, jn.JString)])) ::
(lab.GromosVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
mainFileRe = """^MD\+\+\s*\s*""".r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/gromos/parser/parser-gromos/GROMOSParser.py",
"${mainFilePath}"),
resList = Seq(
"parser-gromos/GROMOSParser.py",
"parser-gromos/GROMOSDictionary.py",
"parser-gromos/GROMOSCommon.py",
"parser-gromos/setup_paths.py",
"nomad_meta_info/public.nomadmetainfo.json",
"nomad_meta_info/common.nomadmetainfo.json",
"nomad_meta_info/meta_types.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-gromos" -> "parsers/gromos/parser/parser-gromos",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info",
"python" -> "python-common/common/python/nomadcore"
) ++ DefaultPythonInterpreter.commonDirMapping(),
metaInfoEnv = Some(lab.meta.KnownMetaInfoEnvs.gromos)
)
package eu.nomad_lab.parsers
import org.specs2.mutable.Specification
object GromosParserTests extends Specification {
"GromosParserTest" >> {
"[Peptide in Water with 2792 atoms] test with json-events" >> {
ParserRun.parse(NAMDParser, "parsers/gromos/test/examples/eq/eq_peptide_1.omd", "json-events") must_== ParseResult.ParseSuccess
}
"[Peptide in Water with 2792 atoms] test with json" >> {
ParserRun.parse(NAMDParser, "parsers/gromos/test/examples/eq/eq_peptide_1.omd", "json") must_== ParseResult.ParseSuccess
}
}
}
File added
# Tests:
### Source of Tests:
The tests are taken from Gromos Tutorial in [GROMOS](http://www.gromos.net).
### Example Tests:
#### Peptide in Water benchmark
2792 atoms, 908 water molecules as Solvent and 7 Solute residues
This diff is collapsed.
TITLE
Automatically generated input file
essmpc Mon Mar 12 14:31:13 2018
END
SYSTEM
# NPM NSM
1 908
END
STEP
# NSTLIM T DT
10000 0 0.002
END
BOUNDCOND
# NTB NDFMIN
1 3
END
MULTIBATH
# ALGORITHM:
# weak-coupling: use weak-coupling scheme
# nose-hoover: use Nose Hoover scheme
# nose-hoover-chains: use Nose Hoover chains scheme
# NUM: number of chains in Nose Hoover chains scheme
# !! only specify NUM when needed !!
# NBATHS: number of temperature baths to couple to
# ALGORITHM
0
# NBATHS
2
# TEMP0(1 ... NBATHS) TAU(1 ... NBATHS)
60 0.1
60 0.1
# DOFSET: number of distinguishable sets of d.o.f.
2
# LAST(1 ... DOFSET) COMBATH(1 ... DOFSET) IRBATH(1 ... DOFSET)
73 1 1 2797 2 2
END
FORCE
# NTF array
# bonds angles imp. dihe charge nonbonded
0 1 1 1 1 1
# NEGR NRE(1) NRE(2) ... NRE(NEGR)
4
71 72 73 2797
END
COVALENTFORM
# NTBBH NTBAH NTBDN
0 0 0
END
CONSTRAINT
# NTC
3
# NTCP NTCP0(1)
1 0.0001
# NTCS NTCS0(1)
1 0.0001
END
PAIRLIST
# algorithm NSNB RCUTP RCUTL SIZE TYPE
1 5 0.8 1.4 0.4 0
END
NONBONDED
# NLRELE
1
# APPAK RCRF EPSRF NSLFEXCL
0 1.4 61 1
# NSHAPE ASHAPE NA2CLC TOLA2 EPSLS
3 1.4 2 1e-10 0
# NKX NKY NKZ KCUT
10 10 10 100
# NGX NGY NGZ NASORD NFDORD NALIAS NSPORD
32 32 32 3 2 3 4
# NQEVAL FACCUR NRDGRD NWRGRD
100000 1.6 0 0
# NLRLJ SLVDNS
0 33.3
END
INITIALISE
# Default values for NTI values: 0
# NTIVEL NTISHK NTINHT NTINHB
1 0 0 0
# NTISHI NTIRTC NTICOM
1 0 0
# NTISTI
0
# IG TEMPI
210185 60
END
COMTRANSROT
# NSCM
1000
END
POSITIONRES
# values for NTPOR
# 0: no position re(con)straining
# 1: use CPOR
# 2: use CPOR/ ATOMIC B-FACTORS
# 3: position constraining
# NTPOR NTPORB NTPORS CPOR
1 1 0 25000
END
PRINTOUT
#NTPR: print out energies, etc. every NTPR steps
#NTPP: =1 perform dihedral angle transition monitoring
# NTPR NTPP
100 0
END
WRITETRAJ
# NTWX NTWSE NTWV NTWF NTWE NTWG NTWB
100 0 0 0 100 0 0
END
This diff is collapsed.
#!/bin/sh
# first we set some variables
NAME=`whoami`
PROGRAM=../../../BUILD/bin/md
SIMULDIR=/home/eng/essmpc/GROMOS/TESTS/peptide/eq
# create temporary directory
WORKDIR=${SIMULDIR}
mkdir -p ${WORKDIR}
cd ${WORKDIR}
# set the input files
TOPO=${SIMULDIR}/peptide_2Cl_54a7.top
IUNIT=${SIMULDIR}/eq_peptide_1.imd
INPUTCRD=${SIMULDIR}/peptide_2Cl_h2o.cnf
REFPOS=${SIMULDIR}/peptide_2Cl_h2o.rpr
POSRESSPEC=${SIMULDIR}/peptide_2Cl_h2o.por
#set the output files
OUNIT=eq_peptide_1.omd
OUTPUTCRD=eq_peptide_1.cnf
OUTPUTTRX=eq_peptide_1.trc
OUTPUTTRE=eq_peptide_1.tre
MDOK=1
${PROGRAM} \
@topo ${TOPO} \
@conf ${INPUTCRD} \
@input ${IUNIT} \
@posresspec ${POSRESSPEC} \
@refpos ${REFPOS} \
@fin ${OUTPUTCRD} \
@trc ${OUTPUTTRX} \
@tre ${OUTPUTTRE}\
> ${OUNIT}
grep "finished successfully" ${OUNIT} > /dev/null || MDOK=0
uname -a >> ${OUNIT}
# compress some files
#gzip ${OUTPUTTRX}
#gzip ${OUTPUTTRE}
# copy the files back
OK=1
cp ${OUNIT} ${SIMULDIR} || OK=0
cp ${OUTPUTCRD} ${SIMULDIR} || OK=0
cp ${OUTPUTTRX} ${SIMULDIR} || OK=0
cp ${OUTPUTTRE} ${SIMULDIR} || OK=0
# clean up after successful run
if `test ${OK} -eq 0`; then
uname -a > mess;
echo 'cp failed for eq_peptide, run 1' >> mess;
Mail -s "ERROR" ${NAME} < mess;
cd ${SIMULDIR};
else
cd ${SIMULDIR};
# rm ${WORKDIR}/*;
# rmdir ${WORKDIR};
fi