Commit 265827b9 authored by eric pellegrini's avatar eric pellegrini
Browse files

Merge branch 'release-1.0.4.rc2'

parents 5dc706f0 dfeb62c3
Pipeline #1182 passed with stages
in 18 minutes and 25 seconds
...@@ -15,6 +15,7 @@ build:trusty: ...@@ -15,6 +15,7 @@ build:trusty:
- /^feature-.*$/ - /^feature-.*$/
- /^release-.*$/ - /^release-.*$/
- /^hotfix-.*$/ - /^hotfix-.*$/
- /^bugfix-.*$/
- develop - develop
artifacts: artifacts:
paths: paths:
...@@ -34,6 +35,7 @@ test:trusty: ...@@ -34,6 +35,7 @@ test:trusty:
- /^feature-.*$/ - /^feature-.*$/
- /^release-.*$/ - /^release-.*$/
- /^hotfix-.*$/ - /^hotfix-.*$/
- /^bugfix-.*$/
- develop - develop
dependencies: dependencies:
- build:trusty - build:trusty
...@@ -68,6 +70,7 @@ build:osx: ...@@ -68,6 +70,7 @@ build:osx:
- /^feature-.*$/ - /^feature-.*$/
- /^release-.*$/ - /^release-.*$/
- /^hotfix-.*$/ - /^hotfix-.*$/
- /^bugfix-.*$/
- develop - develop
artifacts: artifacts:
paths: paths:
...@@ -87,6 +90,7 @@ test:osx: ...@@ -87,6 +90,7 @@ test:osx:
- /^feature-.*$/ - /^feature-.*$/
- /^release-.*$/ - /^release-.*$/
- /^hotfix-.*$/ - /^hotfix-.*$/
- /^bugfix-.*$/
- develop - develop
dependencies: dependencies:
- build:osx - build:osx
...@@ -123,6 +127,7 @@ build:windows: ...@@ -123,6 +127,7 @@ build:windows:
- /^feature-.*$/ - /^feature-.*$/
- /^release-.*$/ - /^release-.*$/
- /^hotfix-.*$/ - /^hotfix-.*$/
- /^bugfix-.*$/
- develop - develop
artifacts: artifacts:
paths: paths:
...@@ -144,6 +149,7 @@ test:windows: ...@@ -144,6 +149,7 @@ test:windows:
- /^feature-.*$/ - /^feature-.*$/
- /^release-.*$/ - /^release-.*$/
- /^hotfix-.*$/ - /^hotfix-.*$/
- /^bugfix-.*$/
- develop - develop
dependencies: dependencies:
- build:windows - build:windows
......
version 1.0.4.rc2
----------------
* added support for gitflow bugfix branch to gitlab config file
* the DL_POLY converter is now compliant with DL_POLY 4
* added the mass tolerance to LAMMP converter
* updated the LAMMP example trajectory with more accurate masses
version 1.0.4.rc1 version 1.0.4.rc1
---------------- ----------------
* bug fix in IWidget: the label of the configurator was not taken into account * bug fix in IWidget: the label of the configurator was not taken into account
......
...@@ -18,19 +18,19 @@ ...@@ -18,19 +18,19 @@
Masses Masses
1 14.007 1 14.0067
2 12. 2 12.0107
3 12. 3 12.0107
4 15.999 4 15.9994
5 1.008 5 1.00790
6 1.008 6 1.00790
7 14.007 7 14.0067
8 12.011 8 12.0107
9 12.011 9 12.0107
10 15.999 10 15.9994
11 12.011 11 12.0107
12 1.008 12 1.00790
13 1.008 13 1.00790
Pair Coeffs Pair Coeffs
......
...@@ -48,8 +48,8 @@ from MDANSE.Framework.Jobs.Converter import Converter ...@@ -48,8 +48,8 @@ from MDANSE.Framework.Jobs.Converter import Converter
_HISTORY_FORMAT = {} _HISTORY_FORMAT = {}
_HISTORY_FORMAT["2"] = {"rec1" : 81, "rec2" : 31, "reci" : 61, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 43, "recb" : 37, "recc" : 37, "recd" : 37} _HISTORY_FORMAT["2"] = {"rec1" : 81, "rec2" : 31, "reci" : 61, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 43, "recb" : 37, "recc" : 37, "recd" : 37}
_HISTORY_FORMAT["3"] = {"rec1" : 73, "rec2" : 31, "reci" : 73, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 55, "recb" : 37, "recc" : 37, "recd" : 37} _HISTORY_FORMAT["3"] = {"rec1" : 73, "rec2" : 73, "reci" : 73, "recii" : 73, "reciii" : 73, "reciv" : 73, "reca" : 73, "recb" : 73, "recc" : 73, "recd" : 73}
_HISTORY_FORMAT["4"] = {"rec1" : 73, "rec2" : 51, "reci" : 73, "recii" : 37, "reciii" : 37, "reciv" : 37, "reca" : 55, "recb" : 37, "recc" : 37, "recd" : 37} _HISTORY_FORMAT["4"] = {"rec1" : 73, "rec2" : 73, "reci" : 73, "recii" : 73, "reciii" : 73, "reciv" : 73, "reca" : 73, "recb" : 73, "recc" : 73, "recd" : 73}
class FieldFileError(Error): class FieldFileError(Error):
pass pass
...@@ -188,22 +188,23 @@ class HistoryFile(dict): ...@@ -188,22 +188,23 @@ class HistoryFile(dict):
self['instance'] = open(filename, 'rb') self['instance'] = open(filename, 'rb')
testLine = len(self['instance'].readline()) testLine = len(self['instance'].readline())
if testLine not in [81,82]:
if (testLine not in [81,82]) and (testLine not in [73,74]):
raise HistoryFileError('Invalid DLPOLY history file') raise HistoryFileError('Invalid DLPOLY history file')
self['instance'].seek(0,0) self['instance'].seek(0,0)
offset = testLine-81
self["version"] = version self["version"] = version
offset = testLine - _HISTORY_FORMAT[self["version"]]["rec1"]
self._headerSize = _HISTORY_FORMAT[self["version"]]["rec1"] + _HISTORY_FORMAT[self["version"]]["rec2"] + 2*offset self._headerSize = _HISTORY_FORMAT[self["version"]]["rec1"] + _HISTORY_FORMAT[self["version"]]["rec2"] + 2*offset
self['instance'].read(_HISTORY_FORMAT[self["version"]]["rec1"]+offset) self['instance'].read(_HISTORY_FORMAT[self["version"]]["rec1"]+offset)
data = self['instance'].read(_HISTORY_FORMAT[self["version"]]["rec2"]+offset) data = self['instance'].read(_HISTORY_FORMAT[self["version"]]["rec2"]+offset)
self["keytrj"], self["imcon"], self["natms"] = [int(v) for v in data.split()] self["keytrj"], self["imcon"], self["natms"] = [int(v) for v in data.split()[0:3]]
if self["keytrj"] not in range(3): if self["keytrj"] not in range(3):
raise HistoryFileError("Invalid value for trajectory output key.") raise HistoryFileError("Invalid value for trajectory output key.")
...@@ -233,6 +234,9 @@ class HistoryFile(dict): ...@@ -233,6 +234,9 @@ class HistoryFile(dict):
self._maskStep = 3+3*(self["keytrj"]+1)+1 self._maskStep = 3+3*(self["keytrj"]+1)+1
if (self["version"] == u'3') or (self["version"] == u'4'):
self._maskStep += 1
self['instance'].seek(0) self['instance'].seek(0)
def read_step(self, step): def read_step(self, step):
...@@ -260,6 +264,8 @@ class HistoryFile(dict): ...@@ -260,6 +264,8 @@ class HistoryFile(dict):
mask[1::self._maskStep] = False mask[1::self._maskStep] = False
mask[2::self._maskStep] = False mask[2::self._maskStep] = False
mask[3::self._maskStep] = False mask[3::self._maskStep] = False
if (self["version"] == u'3') or (self["version"] == u'4'):
mask[4::self._maskStep] = False
config = numpy.array(numpy.compress(mask,data),dtype=numpy.float64) config = numpy.array(numpy.compress(mask,data),dtype=numpy.float64)
......
...@@ -54,10 +54,12 @@ class LAMMPSTrajectoryFileError(Error): ...@@ -54,10 +54,12 @@ class LAMMPSTrajectoryFileError(Error):
class LAMMPSConfigFile(dict): class LAMMPSConfigFile(dict):
def __init__(self, filename): def __init__(self, filename,tolerance):
self._filename = filename self._filename = filename
self._tolerance = tolerance
self['n_bonds'] = None self['n_bonds'] = None
self['bonds'] = [] self['bonds'] = []
...@@ -100,12 +102,15 @@ class LAMMPSConfigFile(dict): ...@@ -100,12 +102,15 @@ class LAMMPSConfigFile(dict):
for j in range(1, self["n_atom_types"]+1): for j in range(1, self["n_atom_types"]+1):
idx, mass = lines[i+j].strip().split() idx, mass = lines[i+j].strip().split()
tolerance = 1.0e-3
idx = int(idx) idx = int(idx)
mass = float(mass) mass = float(mass)
el = ELEMENTS.match_numeric_property("atomic_weight", mass, tolerance=tolerance) el = ELEMENTS.match_numeric_property("atomic_weight", mass, tolerance=self._tolerance)
if len(el) != 1: nElements = len(el)
raise LAMMPSConfigFileError("The atom %d with defined mass %f could not be assigned with a tolerance of %f. Please modify the mass in the config file to comply with MDANSE internal database" % (idx,mass,tolerance)) if nElements == 0:
raise LAMMPSConfigFileError("The atom %d with defined mass %f could not be assigned with a tolerance of %f. Please modify the mass in the config file to comply with MDANSE internal database" % (idx,mass,self._tolerance))
elif nElements > 1:
raise LAMMPSConfigFileError("The atoms %s of MDANSE database matches the mass %f with a tolerance of %f. Please modify the mass in the config file to comply with MDANSE internal database" % (el,mass,self._tolerance))
else:
self["elements"][idx] = el[0] self["elements"][idx] = el[0]
m = re.match("^bonds$",line, re.I) m = re.match("^bonds$",line, re.I)
...@@ -132,6 +137,7 @@ class LAMMPSConverter(Converter): ...@@ -132,6 +137,7 @@ class LAMMPSConverter(Converter):
'default':os.path.join('..','..','..','Data','Trajectories','LAMMPS','glycyl_L_alanine_charmm.config')}) 'default':os.path.join('..','..','..','Data','Trajectories','LAMMPS','glycyl_L_alanine_charmm.config')})
settings['trajectory_file'] = ('input_file', {'label':"LAMMPS trajectory file", settings['trajectory_file'] = ('input_file', {'label':"LAMMPS trajectory file",
'default':os.path.join('..','..','..','Data','Trajectories','LAMMPS','glycyl_L_alanine_charmm.lammps')}) 'default':os.path.join('..','..','..','Data','Trajectories','LAMMPS','glycyl_L_alanine_charmm.lammps')})
settings['mass_tolerance'] = ('float', {'label':"mass tolerance (uma)", 'default':1.0e-5, 'mini':1.0e-9})
settings['time_step'] = ('float', {'label':"time step (fs)", 'default':1.0, 'mini':1.0e-9}) settings['time_step'] = ('float', {'label':"time step (fs)", 'default':1.0, 'mini':1.0e-9})
settings['n_steps'] = ('integer', {'label':"number of time steps", 'default':1, 'mini':0}) settings['n_steps'] = ('integer', {'label':"number of time steps", 'default':1, 'mini':0})
settings['output_file'] = ('output_files', {'formats':["netcdf"]}) settings['output_file'] = ('output_files', {'formats':["netcdf"]})
...@@ -144,7 +150,7 @@ class LAMMPSConverter(Converter): ...@@ -144,7 +150,7 @@ class LAMMPSConverter(Converter):
# The number of steps of the analysis. # The number of steps of the analysis.
self.numberOfSteps = self.configuration["n_steps"]["value"] self.numberOfSteps = self.configuration["n_steps"]["value"]
self._lammpsConfig = LAMMPSConfigFile(self.configuration["config_file"]["value"]) self._lammpsConfig = LAMMPSConfigFile(self.configuration["config_file"]["value"],self.configuration["mass_tolerance"]["value"])
self.parse_first_step() self.parse_first_step()
...@@ -333,8 +339,8 @@ class LAMMPSConverter(Converter): ...@@ -333,8 +339,8 @@ class LAMMPSConverter(Converter):
for i in range(self._nAtoms): for i in range(self._nAtoms):
temp = self._lammps.readline().split() temp = self._lammps.readline().split()
idx = int(temp[self._id])-1 idx = int(temp[self._id])-1
ty = temp[self._type] ty = int(temp[self._type])
name = "%s%s" % (self._lammpsConfig["elements"][ty],idx) name = "%s%d" % (self._lammpsConfig["elements"][ty],idx)
self._rankToName[i] = name self._rankToName[i] = name
g.add_node(idx, element=self._lammpsConfig["elements"][ty], atomName=name) g.add_node(idx, element=self._lammpsConfig["elements"][ty], atomName=name)
......
__version__ = "1.0.4.rc1" __version__ = "1.0.4.rc2"
__date__ = "22-11-2016" __date__ = "22-11-2016"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment